public static class SparseLogisticRegression.Multinomial extends SparseLogisticRegression
SparseLogisticRegression.Binomial, SparseLogisticRegression.Multinomial
Constructor and Description |
---|
Multinomial(double[][] w,
double L,
double lambda,
smile.util.IntSet labels)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
double[][] |
coefficients()
Returns a 2d-array of size (k-1) x (p+1), containing the linear weights
of multi-class logistic regression, where k is the number of classes
and p is the dimension of feature vectors.
|
int |
predict(smile.util.SparseArray x)
Predicts the class label of an instance.
|
int |
predict(smile.util.SparseArray x,
double[] posteriori)
Predicts the class label of an instance and also calculate a posteriori
probabilities.
|
void |
update(smile.util.SparseArray x,
int y)
Online update the classifier with a new training instance.
|
AIC, binomial, binomial, binomial, fit, fit, fit, getLearningRate, loglikelihood, multinomial, multinomial, multinomial, setLearningRate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
predict
update
applyAsDouble, applyAsInt, predict, score
public Multinomial(double[][] w, double L, double lambda, smile.util.IntSet labels)
w
- the weights.L
- the log-likelihood of learned model.lambda
- λ > 0 gives a "regularized" estimate of linear
weights which often has superior generalization performance,
especially when the dimensionality is high.labels
- class labelspublic double[][] coefficients()
public int predict(smile.util.SparseArray x)
Classifier
x
- the instance to be classified.public int predict(smile.util.SparseArray x, double[] posteriori)
SoftClassifier
x
- an instance to be classified.posteriori
- a posteriori probabilities on output.public void update(smile.util.SparseArray x, int y)
OnlineClassifier
x
- training instance.y
- training label.