Package smile.base.cart
Interface Loss
public interface Loss
Regression loss function.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Loss
huber
(double p) Huber loss function for M-regression, which attempts resistance to long-tailed error distributions and outliers while maintaining high efficiency for normally distributed errors.double
intercept
(double[] y) Returns the intercept of model.static Loss
lad()
Least absolute deviation regression loss.static Loss
logistic
(int[] labels) Logistic regression loss for binary classification.static Loss
logistic
(int c, int k, int[] labels, double[][] p) Logistic regression loss for multi-class classification.static Loss
ls()
Least squares regression loss.static Loss
ls
(double[] y) Least squares regression loss.double
output
(int[] nodeSamples, int[] sampleCount) Calculate the node output.static Loss
quantile
(double p) Quantile regression loss.double[]
residual()
Returns the residual vector.double[]
response()
Returns the response variable for next iteration.static Loss
Parses the loss.
-
Method Details
-
output
double output(int[] nodeSamples, int[] sampleCount) Calculate the node output.- Parameters:
nodeSamples
- the index of node samples to their original locations in training dataset.sampleCount
- samples[i] is the number of sampling of dataset[i]. 0 means that the datum is not included and values of greater than 1 are possible because of sampling with replacement.- Returns:
- the node output
-
intercept
double intercept(double[] y) Returns the intercept of model.- Parameters:
y
- the response variable.- Returns:
- the intercept of model.
-
response
double[] response()Returns the response variable for next iteration.- Returns:
- the response variable for next iteration.
-
residual
double[] residual()Returns the residual vector.- Returns:
- the residual vector.
-
ls
Least squares regression loss. Least-squares is highly efficient for normally distributed errors but is prone to long tails and outliers.- Returns:
- the least square regression loss.
-
ls
Least squares regression loss. Least-squares is highly efficient for normally distributed errors but is prone to long tails and outliers.- Parameters:
y
- the response variable.- Returns:
- the least square regression loss.
-
quantile
Quantile regression loss. The gradient tree boosting based on this loss function is highly robust. The trees use only order information on the input variables and the pseudo-response has only two values {-1, +1}. The line searches (terminal node values) use only specified quantile ratio.- Parameters:
p
- the percentile.- Returns:
- the quantile regression loss.
-
lad
Least absolute deviation regression loss. The gradient tree boosting based on this loss function is highly robust. The trees use only order information on the input variables and the pseudo-response has only two values {-1, +1}. The line searches (terminal node values) use only medians. This is a special case of quantile regression of q = 0.5.- Returns:
- the least absolute deviation regression loss.
-
huber
Huber loss function for M-regression, which attempts resistance to long-tailed error distributions and outliers while maintaining high efficiency for normally distributed errors.- Parameters:
p
- of residuals- Returns:
- the Huber loss.
-
logistic
Logistic regression loss for binary classification.- Parameters:
labels
- the class label encoder.- Returns:
- the logistic regression loss for binary classification.
-
logistic
Logistic regression loss for multi-class classification.- Parameters:
c
- the class id that this loss function fits on.k
- the number of classes.labels
- the class label encoder.p
- the posteriori probabilities.- Returns:
- the logistic regression loss for multi-class classification.
-
valueOf
Parses the loss.- Parameters:
s
- the string specification of loss.- Returns:
- the loss function.
-