/// <summary> /// Predicts a class label vector for the given input vector, returning the /// log-likelihood that the input vector belongs to its predicted class. /// </summary> /// <param name="input">The input vector.</param> /// <param name="decision">The class label predicted by the classifier.</param> /// <returns></returns> public override double LogLikelihood(double[] input, out bool decision) { double sum = coefficients[0]; for (int i = 1; i < coefficients.Length; i++) { sum += input[i - 1] * coefficients[i]; } decision = Classes.Decide(linkFunction.Log(sum) + 0.5); return(linkFunction.Log(sum)); }
/// <summary> /// Predicts a class label vector for the given input vector, returning the /// log-likelihood that the input vector belongs to its predicted class. /// </summary> /// <param name="input">The input vector.</param> /// <returns></returns> public override double LogLikelihood(double[] input) { double sum = linear.Transform(input); return(linkFunction.Log(sum)); }