Classification Metrics API Reference
Functions
ChemometricsTools.ColdToHot
— Method.ColdToHot(Y, Schema::ClassificationLabel)
Turns a cold encoded Y
vector into a one hot encoded array.
ChemometricsTools.DataFrameToLaTeX
— Method.DataFrameToLaTeX( df, caption = "" )
Converts a DataFrame object to a LaTeX table (string).
ChemometricsTools.HighestVote
— Method.HighestVote(yhat)
Returns the column index for each row that has the highest value in one hot encoded yhat
. Returns a one cold encoded vector.
ChemometricsTools.HighestVoteOneHot
— Method.HighestVoteOneHot(yhat)
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.
ChemometricsTools.HotToCold
— Method.HotToCold(Y, Schema::ClassificationLabel)
Turns a one hot encoded Y
array into a cold encoded vector.
ChemometricsTools.IsColdEncoded
— Method.IsColdEncoded(Y)
Returns a boolean true if the array Y is cold encoded, and false if not.
ChemometricsTools.LabelEncoding
— Method." 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.
ChemometricsTools.MulticlassStats
— Method.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 ...
ChemometricsTools.MulticlassThreshold
— Method.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
ChemometricsTools.StatsDictToDataFrame
— Method.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.
ChemometricsTools.StatsFromTFPN
— Method.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.
ChemometricsTools.StatsToCSVs
— Method.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"
ChemometricsTools.StatsToLaTeX
— Function.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).
ChemometricsTools.Threshold
— Method.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
.