nimble.calculate

Functions that perform calculations on Nimble-defined objects.

This includes functions that can be used as performance functions in the Nimble testing and cross-validation API. Some similar functionality may be available as methods off of data objects; the versions here are functions, and take any inputs as arguments.

Binary

Metrics available for binary classification.

balancedAccuracy(knownValues, predictedValues)

Accurracy measure accounting for imbalances in the label counts.

f1Score(knownValues, predictedValues)

The harmonic mean of precision and recall.

falseNegative(knownValues, predictedValues)

Number of predicted negative values that were known to be positive.

falsePositive(knownValues, predictedValues)

Number of predicted positive values that were known to be negative.

precision(knownValues, predictedValues)

The ratio of true positive values to predicted positive values.

recall(knownValues, predictedValues)

The ratio of true positive values to known positive values.

specificity(knownValues, predictedValues)

The ratio of true negative values to known negative values.

truePositive(knownValues, predictedValues)

Number of predicted positive values that were known to be positive.

trueNegative(knownValues, predictedValues)

Number of predicted negative values that were known to be negative.

Confidence

Confidence Intervals for error metrics.

rootMeanSquareErrorConfidenceInterval(known, ...)

Estimate a confidence interval for the root mean square error.

meanAbsoluteErrorConfidenceInterval(known, ...)

Estimate a confidence interval for the mean absolute error.

fractionIncorrectConfidenceInterval(known, ...)

Estimate a confidence interval for the fraction incorrect.

Linear Algebra

Linear algebra functions that can be used with nimble base objects.

leastSquaresSolution(aObj, bObj)

Compute least-squares solution to equation A x = b.

inverse(aObj)

Compute the (multiplicative) inverse of a nimble Base object.

pseudoInverse(aObj)

Compute the (Moore-Penrose) pseudo-inverse of a nimble Base object.

solve(aObj, bObj)

Solves the linear equation set A x = b for the unknown vector x.

Loss

Definitions for functions that can be used as performance functions by nimble. Specifically, this only contains those functions that measure loss; or in other words, those where smaller values indicate a higher level of correctness in the predicted values.

fractionIncorrect(knownValues, predictedValues)

Compute the proportion of incorrect predictions within a set of instances.

meanAbsoluteError(knownValues, predictedValues)

Compute mean absolute error.

meanFeaturewiseRootMeanSquareError(...)

For 2d prediction data, compute the RMSE of each feature, then average the results.

rootMeanSquareError(knownValues, predictedValues)

Compute the root mean square error.

varianceFractionRemaining(knownValues, ...)

Calculate the how much variance has not been correctly predicted in the predicted values.

Matrix

Matrix calculations.

elementwiseMultiply(left, right)

Perform element wise multiplication of two provided nimble Base objects with the result being returned in a separate nimble Base object.

elementwisePower(left, right)

Perform an element-wise power operation, with the values in the left object as the bases and the values in the right object as exponents.

Normalize

Normalize

meanNormalize(values1[, values2])

Subtract the vector mean from each element.

meanStandardDeviationNormalize(values1[, ...])

Subtract the mean and divide by standard deviation for each element.

range0to1Normalize(values1[, values2])

Convert values to range of 0 to 1.

percentileNormalize(values1[, values2])

Convert elements to a percentile.

Similarity

Similarity calculations.

correlation(X[, X_T])

Calculate the Pearson correlation coefficients between points in X.

cosineSimilarity(knownValues, predictedValues)

Calculate the cosine similarity between known and predicted values.

confusionMatrix(knownValues, predictedValues)

Generate a confusion matrix for known and predicted label values.

covariance(X[, X_T, sample])

Calculate the covariance between points in X.

fractionCorrect(knownValues, predictedValues)

Calculate how many values in predictedValues are equal to the values in the corresponding positions in knownValues.

rSquared(knownValues, predictedValues)

Calculate the r-squared (or coefficient of determination) of the predictedValues given the knownValues.

Statistic

Statistics calculations.

count(values)

The number of values in the vector.

maximum(values)

The maximum value in a vector.

mean(values)

The mean of the values in a vector.

median(values)

The median of the values in a vector.

medianAbsoluteDeviation(values)

The median absolute deviation of the values in a vector.

minimum(values)

The minimum value in a vector.

mode(values)

The mode of the values in a vector.

proportionMissing(values)

The proportion of values in the vector that are missing.

proportionZero(values)

The proportion of values in the vector that are equal to zero.

quartiles(values)

A vector's lower quartile, the median, and the upper quartile.

residuals(toPredict, controlVars)

Calculate the residuals by a linear regression model.

standardDeviation(values[, sample])

The standard deviation of the values in a vector.

sum(values)

The sum of the values in the vector.

uniqueCount(values)

The number of unique values in the vector.

variance(values[, sample])

The variance of the values in a vector.

Utility

Functions (and their helpers) used to analyze arbitrary performance functions.

performanceFunction(optimal[, best, ...])

Decorator factory for Nimble performance functions.

detectBestResult(functionToCheck)

Determine if higher or lower values are optimal for the function.