首页 > 其他分享 >sklearn miscellenous

sklearn miscellenous

时间:2023-04-08 14:22:33浏览次数:50  
标签:None features fit feature shape mean miscellenous sklearn

StandardScaler in preprocessing

 

Standardize features by removing the mean and scaling to unit variance.

 

scaler = StandardScaler() can have .tranform

with_stdbool, default=True   with_meanbool, default=True     copybool, default=True

>>> scaler = StandardScaler()
>>> print(scaler.fit(data))

Attributes ----------------------

scale_ndarray of shape (n_features,) or None

Per feature relative scaling of the data to achieve zero mean and unit(1) variance. Generally this is calculated using np.sqrt(var_). If a variance is zero, we can’t achieve unit variance, and the data is left as-is, giving a scaling factor of 1. scale_ is equal to None when with_std=False.

New in version 0.17: scale_

mean_ndarray of shape (n_features,) or None

The mean value for each feature in the training set. Equal to None when with_mean=False.

var_ndarray of shape (n_features,) or None

The variance for each feature in the training set. Used to compute scale_. Equal to None when with_std=False.

n_features_in_int

Number of features seen during fit.

New in version 0.24.

feature_names_in_ndarray of shape (n_features_in_,)

Names of features seen during fit. Defined only when X has feature names that are all strings.

New in version 1.0.

n_samples_seen_int or ndarray of shape (n_features,)

The number of samples processed by the estimator for each feature. If there are no missing samples, the n_samples_seen will be an integer, otherwise it will be an array of dtype int. If sample_weights are used it will be a float (if no missing data) or an array of dtype float that sums the weights seen so far. Will be reset on new calls to fit, but increments across partial_fit calls.

 

sklearn.feature_selection.f_regression

Univariate linear regression tests returning F-statistic and p-values.

Quick linear model for testing the effect of a single regressor, sequentially for many regressors.

标签:None,features,fit,feature,shape,mean,miscellenous,sklearn
From: https://www.cnblogs.com/selfmade-Henderson/p/17298425.html

相关文章

  • 基于Python的机器学习算法——sklearn模块
    基于Python的机器学习算法安装包:pipinstallnumpy#安装numpy包pipinstallsklearn#安装sklearn包importnumpyasnp#加载包numpy,并将包记为np(别名)importsklearn#加载sklearn包python中的基础包:numpy:科学计算的基础库,包括多维数组处理、线性代数等pandas:主......
  • 180114 Sklearn.GaussianMixture中的convaiance_type说明
    协方差矩阵的几何解释sklearn.GaussianMixturecovariance_type:{‘full’,‘tied’,‘diag’,‘spherical’},‘full’(eachcomponenthasitsowngeneralcovariancematrix),‘tied’(allcomponentssharethesamegeneralcovariancematrix),‘diag’(eachcom......
  • 深度学习之路三 将上一篇稍微通用的模型用sklearn代替
    fromsklearn.neural_networkimportMLPRegressorimportnumpyasnp#创建神经网络对象#使用adam优化器adam是一种梯度下降算法#使用sgd优化器adam是一种随机......
  • 【sklearn版本问题解决】
    一、报错fromsklearn.utils.validationimportcheck_memoryImportError:cannotimportname'check_memory'二、解决1.首先我去看了相关位置的源码发现validation.py里......
  • ImportError: cannot import name 'joblib' from 'sklearn.externals'错误
    当输入fromsklearn.externalsimportjoblib会出现如下错  需要把代码直接改为如下代码即可:importjoblib ......
  • sklearn.model_selection.train_test_split
    参考:sklearn.model_selection.train_test_split(*arrays,test_size=None,train_size=None,random_state=None,shuffle=True,stratify=None)目的:将数组或矩阵分割为随......
  • 关于sklearn中StandardScaler的使用方式
    在机器学习中经常会使用StandardScaler进行数据归一化,注意一旦调整好StandardScaler以后就保存下来,后面如果进行测试单个时,可以进行加载并对其进行标准化StandardScaler......
  • 关于sklearn,监督学习几种模型的对比
    喜欢这篇文章的话,就点个关注吧,或者关注一下我的公众号也可以,会持续分享高质量Python文章,以及其它相关内容。:点击查看公众号123456789101112131415......
  • sklearn的常用函数以及参数
    sklearn中的算法可以分为如下几部分分类算法回归算法聚类算法降维算法模型优化文本预处理其中分类算法和回归算法又叫做监督学习,聚类算法和降维算法......
  • 第4章:决策树-sklearn实验
    决策树有以下优点:可解释性和便于理解决策树不支持缺失值,而且基本上不需要数据预处理使用树的成本与用于训练树的数据数量乘对数关系能够同时处理数字变量和字符串变量......