public class PlattScaling
extends java.lang.Object
implements java.io.Serializable
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.
| Constructor and Description |
|---|
PlattScaling(double alpha,
double beta)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static <T> PlattScaling |
fit(Classifier<T> model,
T[] x,
int[] y)
Fits Platt Scaling to estimate posteriori probabilities.
|
static PlattScaling |
fit(double[] scores,
int[] y)
Trains the Platt scaling.
|
static PlattScaling |
fit(double[] scores,
int[] y,
int maxIters)
Trains the Platt scaling.
|
double |
scale(double y)
Returns the posterior probability estimate P(y = 1 | x).
|
public PlattScaling(double alpha,
double beta)
alpha - The scaling parameter.beta - The scaling parameter.public double scale(double y)
y - the binary classifier output score.public static PlattScaling fit(double[] scores, int[] y)
scores - The predicted scores.y - The training labels.public static PlattScaling fit(double[] scores, int[] y, int maxIters)
scores - The predicted scores.y - The training labels.maxIters - The maximal number of iterations.public static <T> PlattScaling fit(Classifier<T> model, T[] x, int[] y)
model - the binary-class model to fit Platt scaling.x - training samples.y - training labels.