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

Mse fix #58

Merged
merged 5 commits into from
Apr 12, 2018
Merged

Mse fix #58

merged 5 commits into from
Apr 12, 2018

Conversation

DominiqueMakowski
Copy link
Member

@DominiqueMakowski DominiqueMakowski commented Apr 12, 2018

Follow up of #57
Fixing multiscale entropy

gattia and others added 4 commits April 6, 2018 10:23
Trying to replicate methods from another study I realized that there may be issues with this and the pyentrp implementations of MSE. emb_dim is the length of the vectors to compare. However, in this implementation it is used as the scale_factor as defined in the literature. It appears that the true place that emb_dim should be placed (in the sample entropy calculation) is hard coded as one. I have added a new input called max_scale_factor (tau in the costa paper referenced) - this will ensure that the for loop iterates over all scales between 1 and the inputted max_scale_factor. I placed the emb_dim in the locations it should be in the sample entropy function (replacing the hard coded 1). Last, I think the output of this function is incorrect. From my brief viewing of the literature it seems there are two general outputs that may be used. 1) the sample entropy for each of the individual scale_factors (1:max_scale_factor defined above), or 2) the area under a curve created by these individual scale factors. I have added a variable that allows the user to output either a single value, or the data from all of the scale_factors. I have not changed the output of the individual value that is outputted, but have included a comment with that I think is going on and a one line implementation that I beleive will produce the area output described.
output both the coarse grained entropy data, as well as the area under the curve as output. Update the documentation within the function to identify what the function does and the inputs/outputs. Updated to add self to contributors.
@DominiqueMakowski
Copy link
Member Author

Beside fixing testing, I've also added some minor changes:

  1. Renaming the MSE parameters to "m" and "r" so it is closer to what is in the papers (I feel this way the transition from litterature to code is smoother)
  2. I've found in Norris 2008 the use of another point estimate (the sum of MSE values). Since I like to return many indices by default (for serendipity...), I thought the most neat way to output stuff was to return a dict, which keys are described in the docs.
  3. I've added a default value based on Costa 2005 for max_scale_factor (20) with automated cuts in case of problem in SampEn calculation.

What do you think of these changes?

@gattia
Copy link
Contributor

gattia commented Apr 12, 2018

  1. Perfect
  2. Sounds good
  3. Sounds good.

I've checked out the commit and everything looks good to me.

@DominiqueMakowski DominiqueMakowski merged commit 4b825a5 into master Apr 12, 2018
@DominiqueMakowski DominiqueMakowski deleted the MSE_fix branch April 12, 2018 14:19
@DominiqueMakowski
Copy link
Member Author

It is merged 🎉
thanks @gattia for everything 😸

@gattia
Copy link
Contributor

gattia commented Apr 12, 2018

Awesome! Thanks for including me in the process. I do most of my coding and work independently, so it's great to learn and see how others do things, thanks for maintaining this.

@DominiqueMakowski
Copy link
Member Author

Do not hesitate if you have other suggestions or ideas ;) cheers

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.

None yet

2 participants