sklearn.utils.sparsefuncs.incr_mean_variance_axis?

sklearn.utils.sparsefuncs.incr_mean_variance_axis(X, *, axis, last_mean, last_var, last_n)

源碼

計算CSR或CSC矩陣上沿軸的增量平均值和方差。

last_mean,last_var是此函數在最后一步計算的統計信息。 兩者都必須初始化為適當大小的0數組,即X中的特征數量.last_n是到目前為止遇到的樣本數量。

參數 說明
X CSR or CSC sparse matrix, shape (n_samples, n_features)
輸入數據
axis int (either 0 or 1)
應該沿哪個軸進行計算
last_mean float array with shape (n_features,)
使用新數據X進行更新。
last_var float array with shape (n_features,)
要用新數據X更新的特性變量數組。
last_n int with shape (n_features,)
到目前為止看到的樣本數,不包括X
返回值 說明
means float array with shape (n_features,)
更新了功能方面的方法。
variances float array with shape (n_features,)
更新了功能方面的方差。
n int with shape (n_features,)
更新了可見樣本的數量。

注:

NaN在算法中被忽略。