jhpro.nnet.jknnl
Class MinkowskiMetric
- java.lang.Object
-
- jhpro.nnet.jknnl.MinkowskiMetric
-
- All Implemented Interfaces:
- MetricModel
public class MinkowskiMetric extends java.lang.Object implements MetricModel
Minkowski metric return distance calculated by function: {sum[(x_i - y_i)^p]}^(1/p)
-
-
Constructor Summary
Constructors Constructor and Description MinkowskiMetric(double p)Creates a new instance of MinkowskiMetrics.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublegetDistance(double[] firstVector, double[] secondVector)Return distance between input vectors.double[]getParamateres()Return array of parameters containing pvoidsetParameteres(double[] paramateresList)Set parameter p
-
-
-
Constructor Detail
-
MinkowskiMetric
public MinkowskiMetric(double p)
Creates a new instance of MinkowskiMetrics. Default value of the parameter p is 1- Parameters:
p- metrics parameter
-
-
Method Detail
-
setParameteres
public void setParameteres(double[] paramateresList)
Set parameter p- Parameters:
paramateresList- array of parameter
-
getParamateres
public double[] getParamateres()
Return array of parameters containing p- Returns:
- array of parameter containing p
-
getDistance
public double getDistance(double[] firstVector, double[] secondVector)Return distance between input vectors. firstVector vector and secondVector must have the same size otherwise function return -1 d = {sum[(x_i - y_i)^p]}^(1/p)- Specified by:
getDistancein interfaceMetricModel- Parameters:
firstVector- first input vectorsecondVector- second input vector- Returns:
- distance between vectors
-
-
DMelt 3.0 © DataMelt by jWork.ORG