Classification Metrics

Classification Metrics API Reference


ColdToHot(Y, Schema::ClassificationLabel)

Turns a cold encoded Y vector into a one hot encoded array.

DataFrameToLaTeX( df, caption = "" )

Converts a DataFrame object to a LaTeX table (string).


Returns the column index for each row that has the highest value in one hot encoded yhat. Returns a one cold encoded vector.


Turns the highest column-wise value to a 1 and the others to zeros per row in a one hot encoded yhat. Returns a one cold encoded vector.

HotToCold(Y, Schema::ClassificationLabel)

Turns a one hot encoded Y array into a cold encoded vector.


Returns a boolean true if the array Y is cold encoded, and false if not.


" LabelEncoding( HotOrCold )

Determines if an Array, Y, is one hot encoded, or cold encoded by it's dimensions. Returns a ClassificationLabel object/schema to convert between the formats.

MulticlassStats(Y, GT, schema; Microaverage = true)

Calculates many essential classification statistics based on predicted values Y, and ground truth values GT, using the encoding schema. Returns a tuple whose first entry is a dictionary of averaged statistics, and whose second entry is a dictionary of the form "Class" => Statistics Dictionary ...

MulticlassThreshold(yhat; level = 0.5)

Effectively does the same thing as Threshold() but per-row across columns.

Warning this function can allow for no class assignments. HighestVote is preferred

StatsDictToDataFrame(DictOfStats, schema)

Converts a dictionary of statistics which is returned from MulticlassStats into a labelled dataframe. This is an intermediate step for automated report generation.

StatsFromTFPN(TP, TN, FP, FN)

Calculates many essential classification statistics based on the numbers of True Positive(TP), True Negative(TN), False Positive(FP), and False Negative(FN) examples.

StatsToDataFrame(stats, schema, filepath, name)

Converts the 2-Tuple returned from MulticlassStats() (stats) to a CSV file with a specified name in a specified filepath using the prescribed encoding schema.

The statistics associated with the global analysis will end in a file name of "-global.csv" and the local statistics for each class will end in a file named "-classwise.csv"

StatsToLaTeX(Stats, filepath = nothing, name = nothing,
                    digits = 3, maxcolumns = 6; Comment = "",
                    StatsList = [   "FMeasure", "Accuracy", "Specificity",
                                    "Precision", "Recall", "FAR", "FNR" ])

Converts a MulticlassStats object to a LaTeX table (string or saved file). LaTeX tables contain rows of StatsList, and a maximum column number of maxcolumns. Information is presented with a set number of decimals(digits).

Threshold(yhat; level = 0.5)

For a binary vector yhat this decides if the label is a 0 or a 1 based on it's value relative to a threshold level.