第四章 监督学习

来源:互联网 发布:java版qq还能用吗 编辑:程序博客网 时间:2024/05/30 02:52

4.1 Generalized Linear Models  广义线性模型

yˆ(w,x)=w0+w1x1+...+wpxp w是权重
线性回归就是找到 = (w, ..., w)  使平方差最小

>>>fromsklearnimportlinear_model
>>>clf =linear_model.LinearRegression()
>>>clf.fit ([[0,0], [1,1], [2,2]], [0,1,2])

LinearRegression(copy_X=True, fit_intercept=True, n_jobs=1, normalize=False)

>>>clf.coef_
array([ 0.5, 0.5]) 

4.1.2 岭回归

Ridge Regression  待研究

4.1.3 Lasso 

4.1.4 Elastic Net 

ElasticNetis a linear regression model trained with L1 and L2 prior as regularizer. 

4.1.5 Multi-task Lasso 

The MultiTaskLassois a linear model that estimates sparse coefficients for multiple regression problems jointly: 

4.1.6 Least Angle Regression 

4.1.7 LARS Lasso 

4.1.8 Orthogonal Matching Pursuit (OMP) 

4.1.9 Bayesian Regression 

4.1.10 Logistic regression 

4.1.11 Stochastic Gradient Descent - SGD 

随机梯度下降

4.1.12 Perceptron 

感知机

4.1.13 Passive Aggressive Algorithms 

4.1.15 Polynomial regression: extending linear models with basis functions 

4.2 Linear and quadratic discriminant analysis 线性与二次方程分析

Linear discriminant analysis (lda.LDA) and quadratic discriminant analysis (qda.QDA) are two classic classifiers, 

4.2.1 Dimensionality reduction using LDA 

使用LDA降维在

lda.LDA.transform 中

4.4.1 Classification 

>>>fromsklearnimportsvm>>>X =[[0,0], [1,1]]>>>y =[0,1]
>>>clf =svm.SVC()

>>>clf.fit(X, y)

>>>clf.predict([[2.,2.]]) 

>>># get support vectors

>>>clf.support_vectors_ 

>>># get indices of support vectors
>>>clf.support_

>>># get number of support vectors for each class

>>>clf.n_support_ 









0 0
原创粉丝点击