public class ModelUtils
extends java.lang.Object
| Constructor and Description |
|---|
ModelUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String[] |
createConfusionMatrixHeader(long[] xs,
java.lang.String[] ds) |
static int |
getPrediction(float[] preds,
double[] data)
Utility function to get a best prediction from an array of class
prediction distribution.
|
static int |
getPrediction(float[] preds,
int row) |
static int[] |
getPredictions(int numK,
float[] preds,
double[] data)
Create labels from per-class probabilities with pseudo-random tie-breaking, if needed.
|
public static java.lang.String[] createConfusionMatrixHeader(long[] xs,
java.lang.String[] ds)
public static int[] getPredictions(int numK,
float[] preds,
double[] data)
numK - Number of top probabilities to make labels forpreds - Predictions (first element is ignored here: placeholder for a label)data - Data to break ties (typically, the test set data for this row)public static int getPrediction(float[] preds,
int row)
public static int getPrediction(float[] preds,
double[] data)
preds - an array of prediction distribution. Length of arrays is equal to a number of classes+1.