public override double Predict(Vector y) { if (Normalized) y = y / y.Norm(); return W.Dot(y) + B; }
/// <summary>Predicts the given o.</summary> /// <param name="y">The Vector to process.</param> /// <returns>An object.</returns> public override double Predict(Vector y) { this.Preprocess(y); if (Normalized) y = y / y.Norm(); return W.Dot(y) + B; }
/// <summary>Predicts the given o.</summary> /// <param name="y">The Vector to process.</param> /// <returns>An object.</returns> public override double Predict(Vector y) { if (this.Normalized) { y = y / y.Norm(); } return this.W.Dot(y) + this.B; }
public double Compute(Vector x, Vector y) { double dot = x.Dot(y); return dot / (System.Math.Pow(x.Norm(), 2) + System.Math.Pow(y.Norm(), 2) - dot); }
/// <summary>Computes.</summary> /// <param name="x">The Vector to process.</param> /// <param name="y">The Vector to process.</param> /// <returns>A double.</returns> public double Compute(Vector x, Vector y) { return x.Dot(y) / (x.Norm() * y.Norm()); }
/// <summary>Computes.</summary> /// <param name="x">The Vector to process.</param> /// <param name="y">The Vector to process.</param> /// <returns>A double.</returns> public double Compute(Vector x, Vector y) { var dot = x.Dot(y); return dot / (Math.Pow(x.Norm(), 2) + Math.Pow(y.Norm(), 2) - dot); }
public static double Norm(this Vector v) { return(Vector.Norm(v, 2)); }
/// <summary>A Vector extension method that normals.</summary> /// <param name="v">The v to act on.</param> /// <param name="p">The double to process.</param> /// <returns>A double.</returns> public static double Norm(this Vector v, double p) { return(Vector.Norm(v, p)); }