Skip to content
This repository was archived by the owner on Nov 19, 2020. It is now read-only.
This repository was archived by the owner on Nov 19, 2020. It is now read-only.

Bug in Kurtosis Contrast Function #252

@armwal

Description

@armwal

Hi,

there seems to be a bug in Accord.Statistics.Analysis.ContrastFunctions.Kurtosis.cs

The Evaluate function reads

public void Evaluate(double[] x, double[] output, double[] derivative)
        {
            for (int j = 0; j < x.Length; j++)
            {
                // Kurtosis contrast function and its derivative, as given
                //  in original Hyvärinen's paper. See main references for the
                //  Independent Component Analysis class for details.

                double v = x[j];

                // g(w*x)
                output[j] = v * v * v;

                // g'(w*x)
                derivative[j] = (1.0 / 3.0) * v * v;
            }
        }

However, the derivative should be:

derivative[j] = 3.0 * v * v;

This can be confirmed for example with the ComputeTest() unit test in Accord.Tests.Statistics.IndependentComponentAnalysisTest: Setting ica.Contrast = new Kurtosis(); before computing the ICA fails the test with the old derivative and succeeds with the new one.

Armin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions