kumulant

GaussianNaiveBayesResult

@Serializable
@SerialName(value = "GaussianNaiveBayesResult")
data class GaussianNaiveBayesResult(val featureSize: Int, val numClasses: Int, val means: DenseMatrix, val variances: DenseMatrix, val classWeights: DenseVector, val totalWeights: Double, val varianceFloor: Double) : Result(source)

Snapshot from GaussianNaiveBayesStat: per-class feature statistics and class priors. Each row of means and variances holds the running mean / variance of every feature conditioned on a given class.

Prediction uses the standard Gaussian-NB log-posterior: log p(c | x) proportional to log prior[c] - 0.5 * Sum_i [log(2 pi var) + (x_i - mu)^2 / var] with varianceFloor applied to each per-class variance to keep the log term finite.

Constructors

Link copied to clipboard
constructor(featureSize: Int, numClasses: Int, means: DenseMatrix, variances: DenseMatrix, classWeights: DenseVector, totalWeights: Double, varianceFloor: Double)

Properties

Link copied to clipboard

Cumulative observation weight per class; length numClasses.

Link copied to clipboard

Number of input features.

Link copied to clipboard

K-by-p matrix of per-class running means; means[c][i] is the mean of feature i given class c.

Link copied to clipboard

Number of classes.

Link copied to clipboard

Total cumulative observation weight across all classes.

Link copied to clipboard

Lower bound applied to per-class variances at predict time.

Link copied to clipboard

K-by-p matrix of per-class running variances (population, weight-normalised).

Functions

Link copied to clipboard

Unnormalised log-posterior log prior[c] + Sum_i log N(x_i | mu_c, var_c).

Link copied to clipboard

Argmax class index for x.

Link copied to clipboard
fun prior(c: Int): Double

Class prior, computed from accumulated class weights.

Link copied to clipboard

Normalised class probabilities via log-sum-exp on the log-posterior.

GaussianNaiveBayesResult

constructor(featureSize: Int, numClasses: Int, means: DenseMatrix, variances: DenseMatrix, classWeights: DenseVector, totalWeights: Double, varianceFloor: Double)(source)

classWeights

Cumulative observation weight per class; length numClasses.

featureSize

Number of input features.

logPosterior

Unnormalised log-posterior log prior[c] + Sum_i log N(x_i | mu_c, var_c).

means

K-by-p matrix of per-class running means; means[c][i] is the mean of feature i given class c.

numClasses

Number of classes.

predict

Argmax class index for x.

prior

Class prior, computed from accumulated class weights.

probabilities

Normalised class probabilities via log-sum-exp on the log-posterior.

totalWeights

Total cumulative observation weight across all classes.

varianceFloor

Lower bound applied to per-class variances at predict time.

variances

K-by-p matrix of per-class running variances (population, weight-normalised).