Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mutual information and related methods #89

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bogovicj
Copy link
Contributor

@bogovicj bogovicj commented Nov 4, 2020

No description provided.

@imagesc-bot
Copy link

This pull request has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/migrating-mutualinformation-into-imglib2-algorithm/44798/3

Comment on lines +162 to +170
for( int i = 0; i < ni; i++ )
{
count = subHistCount( hist, dim, i );
ctot += count;
double p = 1.0 * count / total;

if( p > 0 )
entropy -= p * Math.log( p );
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something we can run multi-threaded using LoopBuilder? See also #83.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I'll check 👍 thanks @imagejan

@bogovicj bogovicj marked this pull request as ready for review December 9, 2020 13:42
Comment on lines +33 to +34
final IterableInterval< T > dataA,
final IterableInterval< T > dataB,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a need to pass IterableInterval? Could it just be Iterable?

Comment on lines +28 to +29
* @param rai the RandomAccessibleInterval
* @param ra the RandomAccessible
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent with actual types of parameters in method signature

Comment on lines +106 to +108
ArrayList< BinMapper1d< T > > binMappers = new ArrayList< BinMapper1d< T > >( 2 );
binMappers.add( binMapper );
binMappers.add( binMapper );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not tested but something like this should be possible:

Suggested change
ArrayList< BinMapper1d< T > > binMappers = new ArrayList< BinMapper1d< T > >( 2 );
binMappers.add( binMapper );
binMappers.add( binMapper );
List< BinMapper1d< T > > binMappers = Arrays.asList( binMapper, binMapper );

Comment on lines +110 to +112
List< Iterable< T > > data = new ArrayList< Iterable< T > >( 2 );
data.add( dataA );
data.add( dataB );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not tested but something like this should be possible:

Suggested change
List< Iterable< T > > data = new ArrayList< Iterable< T > >( 2 );
data.add( dataA );
data.add( dataB );
List< Iterable< T > > data = Arrays.asList( dataA, dataB );

Comment on lines +68 to +72
double HA = marginalEntropy( jointHist, 0 );
double HB = marginalEntropy( jointHist, 1 );
double HAB = entropy( jointHist );

return HA + HB - HAB;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should call mutualInformation( jointHist ) instead of duplicating the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants