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

Questions about tolerance methods in Multiscale Entropy (MSE) ❓ #1059

Open
DongCheninmuenster opened this issue Dec 23, 2024 · 1 comment

Comments

@DongCheninmuenster
Copy link

DongCheninmuenster commented Dec 23, 2024

When calculating MSE using this package, I encountered the following issue. According to the original algorithm by Costa et al., 2005, the tolerance ($r$) is defined as a percentage (sometimes denoted as $\rho$) of the standard deviation (SD) of the original time series. In the referenced paper, a value of 15% is used, though this can be adjusted.

However, I didn't find the approach to change the $\rho$ in this package. Additionally, the comments within the corresponding functions are unclear and may lead to confusion.

Function entropy_multiscale accepts arguments tolerance to set $r$ for MSE:

tolerance : float
Tolerance (often denoted as r), distance to consider two data points as similar. If "sd" (default), will be set to :math:0.2 * SD_{signal}. See :func:complexity_tolerance to estimate the optimal value for this parameter.

As mentioned in the comments above, tolerance can accepts a float in addition to the default string "sd".


    # Store parameters
    info = {
        "Method": method,
        "Algorithm": algorithm.__name__,
        "Coarsegraining": coarsegraining,
        "Dimension": dimension,
        "Scale": _get_scales(signal, scale=scale, dimension=dimension),
        "Tolerance": complexity_tolerance(
            signal,
            method=tolerance,
            dimension=dimension,
            show=False,
        )[0],
    }

    # Compute entropy for each coarsegrained segment
    info["Value"] = np.array(
        [
            _entropy_multiscale(
                signal,
                scale=scale,
                coarsegraining=coarsegraining,
                algorithm=algorithm,
                dimension=dimension,
                tolerance=info["Tolerance"],
                refined=refined,
                **kwargs,
            )
            for scale in info["Scale"]
        ]
    )

As shown in code above, tolerance is provided by info dict and is calculated using the function complexity_tolerance. And the parameter tolerance is passed to the argument method.


Within the function complexity_tolerance:

method : str
Can be "maxApEn" (default), "sd", "recurrence", "neighbours", "nolds", "chon2009", or "neurokit".

, however, the argument method can only accept str and Not float. As a result, it is not possible to adjust the tolerance by simply modifying $\rho$, such as setting $\rho$ = 0.15 as done by Costa et al.

I'm not sure if I've missed something important, so I would appreciate any help in solving my question. Otherwise, an additional method like "Costa" should be added. 😊

Copy link

welcome bot commented Dec 23, 2024

Hi 👋 Thanks for reaching out and opening your first issue here! We'll try to come back to you as soon as possible. ❤️ kenobi

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

No branches or pull requests

1 participant