NMath Reference Guide

## DistancePower |

Class PowerDistance compute the power distance between two vectors.

Inheritance Hierarchy

Syntax

The DistancePowerDistance type exposes the following members.

Constructors

Name | Description | |
---|---|---|

DistancePowerDistance | Default constructor. Sets p and r equal to 2, equivalent to the Euclidean distance. | |

DistancePowerDistance(Double, Double) | Constructs a PowerDistance instance using the given parameters. |

Properties

Name | Description | |
---|---|---|

Function | Returns a Distance.Function delegate that encapsulates this.GetDistance. | |

P | Gets and sets the power for the power distance calculation. | |

R | Gets and sets the root for the power distance calculation. |

Methods

Name | Description | |
---|---|---|

Clone | Creates a deep copy of this PowerDistance. | |

GetDistance | Returns the power distance between two data sets, using the current values of parameters p and r. |

Remarks

The power distance is computed as:
where p and r are user-defined parameters. Parameter p
controls the progressive weight that is placed on differences on individual
dimensions; parameter r controls the progressive weight that is placed
on larger differences between objects. Appropriate selections of p and
r yield Euclidean, squared Euclidean, Minkowski, city-block, and many
other distance metrics. For example, if p and r are equal to 2,
the power distance is equal to the Euclidean distance.

Property DistanceDelegate returns a Distance.Function delegate that encapsulates this.GetDistance. The returned delegate can be used by an instance of class ClusterAnalysis for computing the distances between objects during cluster analysis using the power distance metric.

C#

`distance( x, y ) = ( |xi - yi|^p )^1/r`

Property DistanceDelegate returns a Distance.Function delegate that encapsulates this.GetDistance. The returned delegate can be used by an instance of class ClusterAnalysis for computing the distances between objects during cluster analysis using the power distance metric.

See Also