Click or drag to resize
Accord.NET (logo)

EpanechnikovKernel Class

Epanechnikov density kernel.
Inheritance Hierarchy
SystemObject
  Accord.Statistics.Distributions.DensityKernelsEpanechnikovKernel

Namespace:  Accord.Statistics.Distributions.DensityKernels
Assembly:  Accord.Statistics (in Accord.Statistics.dll) Version: 3.8.0
Syntax
[SerializableAttribute]
public class EpanechnikovKernel : IRadiallySymmetricKernel, 
	IDensityKernel
Request Example View Source

The EpanechnikovKernel type exposes the following members.

Constructors
  NameDescription
Public methodEpanechnikovKernel
Initializes a new instance of the EpanechnikovKernel class.
Public methodEpanechnikovKernel(Double)
Initializes a new instance of the EpanechnikovKernel class.
Public methodEpanechnikovKernel(Int32)
Initializes a new instance of the EpanechnikovKernel class.
Top
Properties
  NameDescription
Public propertyConstant
Gets or sets the kernel's normalization constant.
Top
Methods
  NameDescription
Public methodDerivative
Computes the derivative of the kernel profile function.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodFunction
Computes the kernel density function.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodProfile
Computes the kernel profile function.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Extension Methods
  NameDescription
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodIsEqual
Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.)
Public Extension MethodTo(Type)Overloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Public Extension MethodToTOverloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Top
Remarks

References:

  • Comaniciu, Dorin, and Peter Meer. "Mean shift: A robust approach toward feature space analysis." Pattern Analysis and Machine Intelligence, IEEE Transactions on 24.5 (2002): 603-619. Available at: http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=1000236
  • Dan Styer, Oberlin College Department of Physics and Astronomy; Volume of a d-dimensional sphere. Last updated 30 August 2007. Available at: http://www.oberlin.edu/physics/dstyer/StatMech/VolumeDSphere.pdf
  • David W. Scott, Multivariate Density Estimation: Theory, Practice, and Visualization, Wiley, Aug 31, 1992

Examples

The following example shows how to fit a MultivariateEmpiricalDistribution using Epanechnikov kernels.

// Suppose we have the following data, and we would
// like to estimate a distribution from this data

double[][] samples =
{
    new double[] { 0, 1 },
    new double[] { 1, 2 },
    new double[] { 5, 1 },
    new double[] { 7, 1 },
    new double[] { 6, 1 },
    new double[] { 5, 7 },
    new double[] { 2, 1 },
};

// Start by specifying a density kernel
IDensityKernel kernel = new EpanechnikovKernel(dimension: 2);

// Create a multivariate Empirical distribution from the samples
var dist = new MultivariateEmpiricalDistribution(kernel, samples);


// Common measures
double[] mean = dist.Mean;     // { 3.71, 2.00 }
double[] median = dist.Median; // { 3.71, 2.00 }
double[] var = dist.Variance;  // { 7.23, 5.00 } (diagonal from cov)
double[,] cov = dist.Covariance; // { { 7.23, 0.83 }, { 0.83, 5.00 } }

// Probability mass functions
double pdf1 = dist.ProbabilityDensityFunction(new double[] { 2, 1 }); // 0.039131176997318849
double pdf2 = dist.ProbabilityDensityFunction(new double[] { 4, 2 }); // 0.010212109770266639
double pdf3 = dist.ProbabilityDensityFunction(new double[] { 5, 7 }); // 0.02891906722705221
double lpdf = dist.LogProbabilityDensityFunction(new double[] { 5, 7 }); // -3.5432541357714742
See Also