예제 #1
0
        /// <summary>
        /// Calculates the distance between two vectors
        /// </summary>
        /// <param name="distance"></param>
        /// <param name="vector1"></param>
        /// <param name="vector2"></param>
        public static float Calculate(this DistanceMetric distance, IVector vector1, IVector vector2)
        {
            switch (distance)
            {
            case DistanceMetric.Cosine:
                return(vector1.CosineDistance(vector2));

            case DistanceMetric.Euclidean:
                return(vector1.EuclideanDistance(vector2));

            case DistanceMetric.Manhattan:
                return(vector1.ManhattanDistance(vector2));

            case DistanceMetric.SquaredEuclidean:
                return(vector1.SquaredEuclidean(vector2));

            default:
                return(vector1.MeanSquaredDistance(vector2));
            }
        }
예제 #2
0
 public double Distance(IVector <double> x, double[] y, int offy)
 {
     return(x.ManhattanDistance(y, offy));
 }
예제 #3
0
 public float Distance(IVector <float> x, float[] y, int offy)
 {
     return(x.ManhattanDistance(y, offy));
 }