Python 第三方模块 机器学习 Scikit-Learn模块 有监督学习4 线性模型1

一.linear_model
1.简介:

该模块实现了各种"线性模型"(linear models)

2.线性分类器(Linear classifiers):

"逻辑回归分类器"(Logistic Regression classifier):class sklearn.linear_model.LogisticRegression([penalty='l2',dual=False,tol=0.0001,C=1.0,fit_intercept=True,intercept_scaling=1,class_weight=None,random_state=None,solver='lbfgs',max_iter=100,multi_class='auto',verbose=0,warm_start=False,n_jobs=None,l1_ratio=None])
  #参数说明:
	penalty:指定使用的范数惩罚正则项;"L1"/"L2"/"elasticnet"/"none"
	dual:指定是否进行对偶化;bool
	tol:指定最小误差(若误差小于该值,则停止);float
	C:指定"正则化强度"(regularization strength)的倒数;float>0
	  #即范数惩罚正则化项前系数的倒数
	fit_intercept:指定是否估计截距;bool
	intercept_scaling:float
	  Useful only when the solver 'liblinear' is used and self.fit_intercept is set to True. In this case, x becomes
	  [x, self.intercept_scaling], i.e. a 'synthetic' feature with constant value equal to intercept_scaling is 
	  appended to the instance vector. The intercept becomes intercept_scaling * synthetic_feature_weight
	  #注意:the synthetic feature weight is subject to l1/l2 regularization as all other features. To lessen the effect 
	  #     of regularization on synthetic feature weight (and therefore on the intercept) intercept_scaling has to be 
	  #    increased
	class_weight:指定各个类别的权重;dict/"balanced"
	random_state:指定使用的随机数;int/RandomState instance/None
	solver:指定用于优化的算法;"newton-cg"/"lbfgs"/"liblinear"/"sag"/"saga"
	max_iter:指定最大迭代次数;int
	multi_class:指定如何处理多类别分类问题;"auto"/"ovr"/"multinomial"
	verbose:指定输出信息的冗余度;int/bool
	warm_start:指定是否启用热启动;bool
	n_jobs:指定用于并行计算的CPU核心数;int
	l1_ratio:指定"弹性网络混合参数"(Elastic-Net mixing parameter);float
	  #用于控制L1/L2惩罚项的占比,l1_ratio=0相当于penalty="l2",而l1_ratio=1相当于penalty="l1"

######################################################################################################################

进行了"交叉验证"(cross-validation)的逻辑回归分类器:class sklearn.linear_model.LogisticRegressionCV([Cs=10,fit_intercept=True,cv=None,dual=False,penalty='l2',scoring=None,solver='lbfgs',tol=0.0001,max_iter=100,class_weight=None,n_jobs=None,verbose=0,refit=True,intercept_scaling=1.0,multi_class='auto',random_state=None,l1_ratios=None])
  #参数说明:其他参数同class sklearn.linear_model.LogisticRegression()
	Cs:功能同class sklearn.linear_model.LogisticRegression()的参数C;int/float list
	cv:指定交叉验证的拆分策略;int/cross-validation generator
	scoring:指定如何打分;str/callable
	refit:If set to True,the scores are averaged across all folds,and the coefs and the C that corresponds to the best score is taken,and a final refit is done using these parameters
	      Otherwise the coefs, intercepts and C that correspond to the best scores across folds are averaged

######################################################################################################################

"被动攻击性分类器"(Passive Aggressive Classifier;PA Classifier):class sklearn.linear_model.PassiveAggressiveClassifier([C=1.0,fit_intercept
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值