Documentation of 'smile.classification.PlattScaling' Java class
PlattScaling
smile.classification

Class PlattScaling

  • All Implemented Interfaces:
    java.io.Serializable


    public class PlattScaling
    extends java.lang.Object
    implements java.io.Serializable
    Platt scaling or Platt calibration is a way of transforming the outputs of a classification model into a probability distribution over classes. The method was invented by John Platt in the context of support vector machines, but can be applied to other classification models. Platt scaling works by fitting a logistic regression model to a classifier's scores. Platt suggested using the Levenberg–Marquardt algorithm to optimize the parameters, but a Newton algorithm was later proposed that should be more numerically stable, which is implemented in this class.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      PlattScaling(double[] scores, int[] y)
      Trains the Platt scaling.
      PlattScaling(double[] scores, int[] y, int maxIters)
      Trains the Platt scaling.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      static void multiclass(int k, double[][] r, double[] p)
      Estimates the multiclass probabilies.
      double predict(double y)
      Returns the posterior probability estimate P(y = 1 | x).
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PlattScaling

        public PlattScaling(double[] scores,
                            int[] y)
        Trains the Platt scaling.
        Parameters:
        scores - The predicted scores.
        y - The training labels.
      • PlattScaling

        public PlattScaling(double[] scores,
                            int[] y,
                            int maxIters)
        Trains the Platt scaling.
        Parameters:
        scores - The predicted scores.
        y - The training labels.
        maxIters - The maximal number of iterations.
    • Method Detail

      • predict

        public double predict(double y)
        Returns the posterior probability estimate P(y = 1 | x).
        Parameters:
        y - the binary classifier output score.
        Returns:
        the estimated probability.
      • multiclass

        public static void multiclass(int k,
                                      double[][] r,
                                      double[] p)
        Estimates the multiclass probabilies.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.