-
Notifications
You must be signed in to change notification settings - Fork 20
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
base: master
Are you sure you want to change the base?
Conversation
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 |
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 ); | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
final IterableInterval< T > dataA, | ||
final IterableInterval< T > dataB, |
There was a problem hiding this comment.
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
?
* @param rai the RandomAccessibleInterval | ||
* @param ra the RandomAccessible |
There was a problem hiding this comment.
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
ArrayList< BinMapper1d< T > > binMappers = new ArrayList< BinMapper1d< T > >( 2 ); | ||
binMappers.add( binMapper ); | ||
binMappers.add( binMapper ); |
There was a problem hiding this comment.
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:
ArrayList< BinMapper1d< T > > binMappers = new ArrayList< BinMapper1d< T > >( 2 ); | |
binMappers.add( binMapper ); | |
binMappers.add( binMapper ); | |
List< BinMapper1d< T > > binMappers = Arrays.asList( binMapper, binMapper ); |
List< Iterable< T > > data = new ArrayList< Iterable< T > >( 2 ); | ||
data.add( dataA ); | ||
data.add( dataB ); |
There was a problem hiding this comment.
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:
List< Iterable< T > > data = new ArrayList< Iterable< T > >( 2 ); | |
data.add( dataA ); | |
data.add( dataB ); | |
List< Iterable< T > > data = Arrays.asList( dataA, dataB ); |
double HA = marginalEntropy( jointHist, 0 ); | ||
double HB = marginalEntropy( jointHist, 1 ); | ||
double HAB = entropy( jointHist ); | ||
|
||
return HA + HB - HAB; |
There was a problem hiding this comment.
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.
No description provided.