4.1 Generalized Linear Models 广义线性模型
yˆ(w,x)=w0 +w1x1 +...+wpxp w是权重
线性回归就是找到 w = (w1 , ..., wp ) 使平方差最小
>>> from sklearn import linear_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
ElasticNet is a linear regression model trained with L1 and L2 prior as regularizer.
4.1.5 Multi-task Lasso
The MultiTaskLasso is 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.transform 中
4.4.1 Classification
>>> from sklearn import svm>>> 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_