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

Fix issue related to radius for MATLAB Multiscale Fuzzy Entropy #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mrrezaie
Copy link
Contributor

@mrrezaie mrrezaie commented Nov 3, 2023

Hi, the radius times std has been occurred two times for Multiscale Fuzzy Entropy.
First, at the beginning:

R = r*std(x);

Second, inside the Fuzzy_Ent function:

r = r*std(series);

@mrrezaie
Copy link
Contributor Author

mrrezaie commented Nov 6, 2023

@UNONONAN, please let me know your thoughts about this PR.

@mrrezaie
Copy link
Contributor Author

mrrezaie commented Nov 8, 2023

@JSommerfeld36, please let me know your thoughts about this PR.

@JSommerfeld36
Copy link
Contributor

JSommerfeld36 commented Nov 8, 2023

Hi,
You are correct that the radius has been calculated twice. This appears to be somewhat deliberate, possibly for clarity of what is happening in the functions. When the radius is calculated on line 33 it is assigned to the variable "R" and used as such in the main Ent_MS_Plus function. Again radius is calculated on line 173 like you say. This time however, it is assigned to the variable "r" (note one is upper and one is lower case). If we make all references to the radius "R" and comment out line 173, the results are the same as they are currently. Across 1000 simulations of these two configurations we do see a very small speed improvement of 0.0002 seconds on average per function call (attached is a graph of the results). As such, I am electing to close the issue for now knowing that we are already in the process of revisiting our code and making improvements.

Ent_MS_Plus-GitHubIssue#5

@mrrezaie
Copy link
Contributor Author

mrrezaie commented Nov 8, 2023

@JSommerfeld36, thanks for your reply.

Across 1000 simulations of these two configurations we do see a very small speed improvement of 0.0002 seconds on average per function call

Speed improvement was not the intention.

If we make all references to the radius "R" and comment out line 173, the results are the same as they are currently.

This cannot be the same due to the doubled multiplication. Perhaps the difference would be negligible in some tests. But, computationally, there is no reason for the redundant duplication.

When the radius is calculated on line 33 it is assigned to the variable "R" and used as such in the main Ent_MS_Plus function. Again radius is calculated on line 173 like you say. This time however, it is assigned to the variable "r" (note one is upper and one is lower case).

Please note that R (i.e., r*std(x)) is the input to Fuzzy_Ent function:

MSFE(i,1) = Fuzzy_Ent(y_tau_kj(1,~isnan(y_tau_kj(1,:))),m,R,2);

Does it make sense?

@UNONONAN UNONONAN reopened this Nov 10, 2023
@UNONONAN
Copy link
Contributor

@JSommerfeld36, thanks for your reply.

Across 1000 simulations of these two configurations we do see a very small speed improvement of 0.0002 seconds on average per function call

Speed improvement was not the intention.

If we make all references to the radius "R" and comment out line 173, the results are the same as they are currently.

This cannot be the same due to the doubled multiplication. Perhaps the difference would be negligible in some tests. But, computationally, there is no reason for the redundant duplication.

When the radius is calculated on line 33 it is assigned to the variable "R" and used as such in the main Ent_MS_Plus function. Again radius is calculated on line 173 like you say. This time however, it is assigned to the variable "r" (note one is upper and one is lower case).

Please note that R (i.e., r*std(x)) is the input to Fuzzy_Ent function:

MSFE(i,1) = Fuzzy_Ent(y_tau_kj(1,~isnan(y_tau_kj(1,:))),m,R,2);

Does it make sense?

Can you please elaborate more fully your intention with this pull request. And, can you provide a worked out example that demonstrates the improvement?

@mrrezaie
Copy link
Contributor Author

@UNONONAN, thanks for reopening this PR.

Can you please elaborate more fully your intention with this pull request.

I was about to use the code in my research and found this error. Don't you think the second multiplication, i.e., line 137, is redundant? (If this is not the case or if you are not interested in external collaboration, feel free to reclose this PR)

And, can you provide a worked out example that demonstrates the improvement?

I have no example of improvement. When I was studying the computations of multi-scale sample entropy and multi-scale fuzzy entropy, I found that both algorithms would have similar radius parameter.

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

3 participants