提交 71d08b24 编写于 作者: L loopyme

更新1-[15,18]

上级 fb404119
......@@ -2,25 +2,24 @@
校验者:
        [@STAN,废柴0.1](https://github.com/apachecn/scikit-learn-doc-zh)
[@Loopy](https://github.com/loopyme)
翻译者:
        [@那伊抹微笑](https://github.com/apachecn/scikit-learn-doc-zh)
[半监督学习](https://en.wikipedia.org/wiki/Semi-supervised_learning) 适用于在训练数据上的一些样本数据没有贴上标签的情况。 [`sklearn.semi_supervised`](classes.html#module-sklearn.semi_supervised "sklearn.semi_supervised") 中的半监督估计, 能够利用这些附加的未标记数据来更好地捕获底层数据分布的形状,并将其更好地类推到新的样本。 当我们有非常少量的已标签化的点和大量的未标签化的点时,这些算法表现均良好。
*y* 中含有未标记的数据
在使用 `fit` 方法训练数据时, 将标识符与已标签化的数据一起分配给未标签化的点是尤其重要的. 实现该标记的方法是使用整数值 ![-1](img/8b3be66a25e0c33787b341667b261360.jpg).
> *y* 中含有未标记的数据
>
>在使用 `fit` 方法训练数据时, 将标识符与已标签化的数据一起分配给未标签化的点是尤其重要的. 实现该标记的方法是使用整数值 ![-1](img/8b3be66a25e0c33787b341667b261360.jpg).
## 1.14.1\. 标签传播
标签传播表示半监督图推理算法的几个变体。
```py
该模型的一些特性如下:
```
*该模型的一些特性如下:*
* 可用于分类和回归任务
* Kernel methods to project data into alternate dimensional spaces
* 使用内核方法将数据投影到备用维度空间
*scikit-learn* 提供了两种标签传播模型: [`LabelPropagation`](https://scikit-learn.org/stable/modules/generated/sklearn.semi_supervised.LabelPropagation.html#sklearn.semi_supervised.LabelPropagation "sklearn.semi_supervised.LabelPropagation")[`LabelSpreading`](https://scikit-learn.org/stable/modules/generated/sklearn.semi_supervised.LabelSpreading.html#sklearn.semi_supervised.LabelSpreading "sklearn.semi_supervised.LabelSpreading") 。 两者都通过在输入的 dataset(数据集)中的所有 items(项)上构建 similarity graph (相似图)来进行工作。
......@@ -34,19 +33,17 @@
标签传播模型有两种内置的 kernel methods(核函数)。 kernel (核)的选择会影响算法的可扩展性和性能。 以下是可用的:
> * rbf (![\exp(-\gamma |x-y|^2), \gamma > 0](img/26f66401927461c0129b7f4ad33e5322.jpg)). ![\gamma](img/6552bde3d3999c1a9728016416932af7.jpg) 通过关键字 gamma 来指定。
> * knn (![1[x' \in kNN(x)]](img/6db85b1ad926d9ad860d58629ff5f235.jpg)). ![k](img/f93871977da52a6d11045d57c3e18728.jpg) 通过关键字 n_neighbors 来指定。
* rbf (![\exp(-\gamma |x-y|^2), \gamma > 0](img/26f66401927461c0129b7f4ad33e5322.jpg)). ![\gamma](img/6552bde3d3999c1a9728016416932af7.jpg) 通过关键字 gamma 来指定。
* knn (![1[x' \in kNN(x)]](img/6db85b1ad926d9ad860d58629ff5f235.jpg)). ![k](img/f93871977da52a6d11045d57c3e18728.jpg) 通过关键字 n_neighbors 来指定。
RBF 核将产生一个完全连接的图形, 它通过密集矩阵在内存中表示。 该矩阵可能非常大, 与算法的每次迭代执行全矩阵乘法计算的成本相结合可导致超长的运行时间。 在另一方面, KNN 核将产生更多的内存友好的稀疏矩阵, 这样可以大幅度的减少运行时间。
例子
* [Decision boundary of label propagation versus SVM on the Iris dataset](https://scikit-learn.org/stable/auto_examples/semi_supervised/plot_label_propagation_versus_svm_iris.html#sphx-glr-auto-examples-semi-supervised-plot-label-propagation-versus-svm-iris-py)
* [Label Propagation learning a complex structure](https://scikit-learn.org/stable/auto_examples/semi_supervised/plot_label_propagation_structure.html#sphx-glr-auto-examples-semi-supervised-plot-label-propagation-structure-py)
* [Label Propagation digits active learning](https://scikit-learn.org/stable/auto_examples/semi_supervised/plot_label_propagation_digits_active_learning.html#sphx-glr-auto-examples-semi-supervised-plot-label-propagation-digits-active-learning-py)
参考
[1] Yoshua Bengio, Olivier Delalleau, Nicolas Le Roux. In Semi-Supervised Learning (2006), pp. 193-216
>示例
>
>* [Decision boundary of label propagation versus SVM on the Iris dataset](https://scikit-learn.org/stable/auto_examples/semi_supervised/plot_label_propagation_versus_svm_iris.html#sphx-glr-auto-examples-semi-supervised-plot-label-propagation-versus-svm-iris-py)
>* [Label Propagation learning a complex structure](https://scikit-learn.org/stable/auto_examples/semi_supervised/plot_label_propagation_structure.html#sphx-glr-auto-examples-semi-supervised-plot-label-propagation-structure-py)
>* [Label Propagation digits active learning](https://scikit-learn.org/stable/auto_examples/semi_supervised/plot_label_propagation_digits_active_learning.html#sphx-glr-auto-examples-semi-supervised-plot-label-propagation-digits-active-learning-py)
[2] Olivier Delalleau, Yoshua Bengio, Nicolas Le Roux. Efficient Non-Parametric Function Induction in Semi-Supervised Learning. AISTAT 2005 [http://research.microsoft.com/en-us/people/nicolasl/efficient_ssl.pdf](http://research.microsoft.com/en-us/people/nicolasl/efficient_ssl.pdf)
\ No newline at end of file
>参考
>* [1] Yoshua Bengio, Olivier Delalleau, Nicolas Le Roux. In Semi-Supervised Learning (2006), pp. 193-216
>* [2] Olivier Delalleau, Yoshua Bengio, Nicolas Le Roux. Efficient Non-Parametric Function Induction in Semi-Supervised Learning. AISTAT 2005 [http://research.microsoft.com/en-us/people/nicolasl/efficient_ssl.pdf](http://research.microsoft.com/en-us/people/nicolasl/efficient_ssl.pdf)
......@@ -7,10 +7,10 @@
[`IsotonicRegression`](https://scikit-learn.org/stable/modules/generated/sklearn.isotonic.IsotonicRegression.html#sklearn.isotonic.IsotonicRegression "sklearn.isotonic.IsotonicRegression") 类对数据进行非降函数拟合. 它解决了如下的问题:
> 最小化 ![\sum_i w_i (y_i - \hat{y}_i)^2](img/156554c81cfe5f0230627ac0487fd07f.jpg)
>
> 服从于 ![\hat{y}_{min} = \hat{y}_1 \le \hat{y}_2 ... \le \hat{y}_n = \hat{y}_{max}](img/6c446734a6837b7541db12e2b55f1a2b.jpg)
* 最小化 ![\sum_i w_i (y_i - \hat{y}_i)^2](img/156554c81cfe5f0230627ac0487fd07f.jpg)
* 服从于 ![\hat{y}_{min} = \hat{y}_1 \le \hat{y}_2 ... \le \hat{y}_n = \hat{y}_{max}](img/6c446734a6837b7541db12e2b55f1a2b.jpg)
其中每一个 ![w_i](img/6689aa593e8e42bb5c2caa474e642b5f.jpg) 是 strictly 正数而且每个 ![y_i](img/4a22ca544916918b2358e5fc7c71b8e6.jpg) 是任意实 数. 它生成一个由平方误差接近的不减元素组成的向量.实际上这一些元素形成 一个分段线性的函数.
[![http://sklearn.apachecn.org/cn/0.19.0/_images/sphx_glr_plot_isotonic_regression_0011.png](img/87ae31ef4f2e7b4385b9a25aa8fed533.jpg)](https://scikit-learn.org/stable/auto_examples/plot_isotonic_regression.html)
\ No newline at end of file
[![http://sklearn.apachecn.org/cn/0.19.0/_images/sphx_glr_plot_isotonic_regression_0011.png](img/87ae31ef4f2e7b4385b9a25aa8fed533.jpg)](https://scikit-learn.org/stable/auto_examples/plot_isotonic_regression.html)
......@@ -16,7 +16,7 @@
* [`GaussianNB`](https://scikit-learn.org/stable/modules/generated/sklearn.naive_bayes.GaussianNB.html#sklearn.naive_bayes.GaussianNB "sklearn.naive_bayes.GaussianNB") 往往将概率推到 0 或 1(注意直方图中的计数). 这主要是因为它假设特征在给定类别的条件下是独立的, 在该数据集中不包含 2 个冗余特征.
* [`RandomForestClassifier`](https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html#sklearn.ensemble.RandomForestClassifier "sklearn.ensemble.RandomForestClassifier") 解释了相反的行为:直方图在约 0.2 和 0.9 的概率时显示峰值, 而接近 0 或 1 的概率非常罕见. Niculescu-Mizil 和 Caruana [4] 给出了一个解释:”诸如 bagging 和 random forests(随机森林)的方法, 从基本模型的平均预测中可能难以将预测置于 0 和 1 附近, 因为基础模型的变化会偏离预测值, 它们应该接近于零或偏离这些值, 因为预测被限制在 [0,1] 的间隔, 由方差引起的误差往往是靠近 0 和 1 的一边, 例如,如果一个模型应该对于一个案例,预测 p = 0,bagging 可以实现的唯一方法是假设所有的 bagging 树预测为零. 如果我们在 bagging 树上增加噪声, 这种噪声将导致一些树预测大于 0 的值, 因此将 bagging 的平均预测从 0 移开. 我们用随机森林最强烈地观察到这种效应, 因为用随机森林训练的 base-level 树由于特征划分而具有相对较高的方差. 因此,校准曲线也被称为可靠性图 (Wilks 1995 [5] _) 显示了一种典型的 sigmoid 形状, 表明分类器可以更多地信任其 “直觉”, 并通常将接近 0 或 1 的概率返回.
* [`RandomForestClassifier`](https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html#sklearn.ensemble.RandomForestClassifier "sklearn.ensemble.RandomForestClassifier") 解释了相反的行为:直方图在约 0.2 和 0.9 的概率时显示峰值, 而接近 0 或 1 的概率非常罕见. Niculescu-Mizil 和 Caruana [4] 给出了一个解释:”诸如 bagging 和 random forests(随机森林)的方法, 从基本模型的平均预测中可能难以将预测置于 0 和 1 附近, 因为基础模型的变化会偏离预测值, 它们应该接近于零或偏离这些值, 因为预测被限制在 [0,1] 的间隔, 由方差引起的误差往往是靠近 0 和 1 的一边, 例如,如果一个模型应该对于一个案例,预测 p = 0,bagging 可以实现的唯一方法是假设所有的 bagging 树预测为零. 如果我们在 bagging 树上增加噪声, 这种噪声将导致一些树预测大于 0 的值, 因此将 bagging 的平均预测从 0 移开. 我们用随机森林最强烈地观察到这种效应, 因为用随机森林训练的 base-level 树由于特征划分而具有相对较高的方差. 因此,校准曲线也被称为可靠性图 (Wilks 1995 [5] ) 显示了一种典型的 sigmoid 形状, 表明分类器可以更多地信任其 “直觉”, 并通常将接近 0 或 1 的概率返回.
* 线性支持向量分类 ([`LinearSVC`](https://scikit-learn.org/stable/modules/generated/sklearn.svm.LinearSVC.html#sklearn.svm.LinearSVC "sklearn.svm.LinearSVC")) 显示了作为 RandomForestClassifier 更多的 Sigmoid 曲线, 这是经典的最大边距方法 (compare Niculescu-Mizil and Caruana [[4]](#id3)), 其重点是靠近决策边界的 hard samples(支持向量).
......@@ -54,12 +54,9 @@
该校准导致较低的 log-loss(对数损失). 请注意,替代方案是增加基准估计量的数量, 这将导致对数损失类似的减少.
参考:
* Obtaining calibrated probability estimates from decision trees and naive Bayesian classifiers, B. Zadrozny & C. Elkan, ICML 2001
* Transforming Classifier Scores into Accurate Multiclass Probability Estimates, B. Zadrozny & C. Elkan, (KDD 2002)
* Probabilistic Outputs for Support Vector Machines and Comparisons to Regularized Likelihood Methods, J. Platt, (1999)
| [[4]](#id2) | Predicting Good Probabilities with Supervised Learning, A. Niculescu-Mizil & R. Caruana, ICML 2005 |
| [5] | On the combination of forecast probabilities for consecutive precipitation periods. Wea. Forecasting, 5, 640–650., Wilks, D. S., 1990a |
\ No newline at end of file
>参考:
>* Obtaining calibrated probability estimates from decision trees and naive Bayesian classifiers, B. Zadrozny & C. Elkan, ICML 2001
>* Transforming Classifier Scores into Accurate Multiclass Probability Estimates, B. Zadrozny & C. Elkan, (KDD 2002)
>* Probabilistic Outputs for Support Vector Machines and Comparisons to Regularized Likelihood Methods, J. Platt, (1999)
>* [4] Predicting Good Probabilities with Supervised Learning, A. Niculescu-Mizil & R. Caruana, ICML 2005
>* [5] On the combination of forecast probabilities for consecutive precipitation periods. Wea. Forecasting, 5, 640–650., Wilks, D. S., 1990a
......@@ -3,12 +3,13 @@
校验者:
        [@tiantian1412](https://github.com/tiantian1412)
        [@火星](https://github.com/apachecn/scikit-learn-doc-zh)
[@Loopy](https://github.com/loopyme)
翻译者:
        [@A](https://github.com/apachecn/scikit-learn-doc-zh)
Warning
此实现不适用于大规模数据应用。 特别是 scikit-learn 不支持 GPU。如果想要提高运行速度并使用基于 GPU 的实现以及为构建深度学习架构提供更多灵活性的框架,请参阅 [Related Projects](../related_projects.html#related-projects)
>**警告**
>
>此实现不适用于大规模数据应用。 特别是 scikit-learn 不支持 GPU。如果想要提高运行速度并使用基于 GPU 的实现以及为构建深度学习架构提供更多灵活性的框架,请参阅 [Related Projects](https://scikit-learn.org/stable/related_projects.html#related-projects) 。
## 1.17.1\. 多层感知器
......@@ -24,20 +25,20 @@ Warning
多层感知器的优点:
> * 可以学习得到非线性模型。
> * 使用``partial_fit`` 可以学习得到实时模型(在线学习)。
* 可以学习得到非线性模型。
* 使用``partial_fit`` 可以学习得到实时模型(在线学习)。
多层感知器(MLP)的缺点:
> * 具有隐藏层的 MLP 具有非凸的损失函数,它有不止一个的局部最小值。 因此不同的随机权重初始化会导致不同的验证集准确率。
> * MLP 需要调试一些超参数,例如隐藏层神经元的数量、层数和迭代轮数。
> * MLP 对特征归一化很敏感.
* 具有隐藏层的 MLP 具有非凸的损失函数,它有不止一个的局部最小值。 因此不同的随机权重初始化会导致不同的验证集准确率。
* MLP 需要调试一些超参数,例如隐藏层神经元的数量、层数和迭代轮数。
* MLP 对特征归一化很敏感.
解决这些缺点的方法请参阅 [实用使用技巧](#mlp-tips) 部分。
解决这些缺点的方法请参阅 [实用使用技巧](#_1178-实用技巧) 部分。
## 1.17.2\. 分类
> [`MLPClassifier`](https://scikit-learn.org/stable/modules/generated/sklearn.neural_network.MLPClassifier.html#sklearn.neural_network.MLPClassifier "sklearn.neural_network.MLPClassifier") 类实现了通过 [Backpropagation](http://ufldl.stanford.edu/wiki/index.php/Backpropagation_Algorithm) 进行训练的多层感知器(MLP)算法。
[`MLPClassifier`](https://scikit-learn.org/stable/modules/generated/sklearn.neural_network.MLPClassifier.html#sklearn.neural_network.MLPClassifier "sklearn.neural_network.MLPClassifier") 类实现了通过 [Backpropagation](http://ufldl.stanford.edu/wiki/index.php/Backpropagation_Algorithm) 进行训练的多层感知器(MLP)算法。
MLP 在两个 array 上进行训练:大小为 (n_samples, n_features) 的 array X 储存表示训练样本的浮点型特征向量; 大小为 (n_samples,) 的 array y 储存训练样本的目标值(类别标签):
......@@ -50,13 +51,13 @@ MLP 在两个 array 上进行训练:大小为 (n_samples, n_features) 的 array
...
>>> clf.fit(X, y)
MLPClassifier(activation='relu', alpha=1e-05, batch_size='auto',
beta_1=0.9, beta_2=0.999, early_stopping=False,
epsilon=1e-08, hidden_layer_sizes=(5, 2), learning_rate='constant',
learning_rate_init=0.001, max_iter=200, momentum=0.9,
nesterovs_momentum=True, power_t=0.5, random_state=1, shuffle=True,
solver='lbfgs', tol=0.0001, validation_fraction=0.1, verbose=False,
warm_start=False)
beta_1=0.9, beta_2=0.999, early_stopping=False,
epsilon=1e-08, hidden_layer_sizes=(5, 2),
learning_rate='constant', learning_rate_init=0.001,
max_iter=200, momentum=0.9, n_iter_no_change=10,
nesterovs_momentum=True, power_t=0.5, random_state=1,
shuffle=True, solver='lbfgs', tol=0.0001,
validation_fraction=0.1, verbose=False, warm_start=False)
```
拟合(训练)后,该模型可以预测新样本的标签:
......@@ -98,12 +99,13 @@ array([[ 1.967...e-04, 9.998...-01],
...
>>> clf.fit(X, y)
MLPClassifier(activation='relu', alpha=1e-05, batch_size='auto',
beta_1=0.9, beta_2=0.999, early_stopping=False,
epsilon=1e-08, hidden_layer_sizes=(15,), learning_rate='constant',
learning_rate_init=0.001, max_iter=200, momentum=0.9,
nesterovs_momentum=True, power_t=0.5, random_state=1, shuffle=True,
solver='lbfgs', tol=0.0001, validation_fraction=0.1, verbose=False,
warm_start=False)
beta_1=0.9, beta_2=0.999, early_stopping=False,
epsilon=1e-08, hidden_layer_sizes=(15,),
learning_rate='constant', learning_rate_init=0.001,
max_iter=200, momentum=0.9, n_iter_no_change=10,
nesterovs_momentum=True, power_t=0.5, random_state=1,
shuffle=True, solver='lbfgs', tol=0.0001,
validation_fraction=0.1, verbose=False, warm_start=False)
>>> clf.predict([[1., 2.]])
array([[1, 1]])
>>> clf.predict([[0., 0.]])
......@@ -113,10 +115,9 @@ array([[0, 1]])
更多内容请参阅下面的示例和文档 [`MLPClassifier.fit`](https://scikit-learn.org/stable/modules/generated/sklearn.neural_network.MLPClassifier.html#sklearn.neural_network.MLPClassifier.fit "sklearn.neural_network.MLPClassifier.fit")
示例:
* [Compare Stochastic learning strategies for MLPClassifier](https://scikit-learn.org/stable/auto_examples/neural_networks/plot_mlp_training_curves.html#sphx-glr-auto-examples-neural-networks-plot-mlp-training-curves-py)
* [Visualization of MLP weights on MNIST](https://scikit-learn.org/stable/auto_examples/neural_networks/plot_mnist_filters.html#sphx-glr-auto-examples-neural-networks-plot-mnist-filters-py)
>示例:
>* [Compare Stochastic learning strategies for MLPClassifier](https://scikit-learn.org/stable/auto_examples/neural_networks/plot_mlp_training_curves.html#sphx-glr-auto-examples-neural-networks-plot-mlp-training-curves-py)
>* [Visualization of MLP weights on MNIST](https://scikit-learn.org/stable/auto_examples/neural_networks/plot_mnist_filters.html#sphx-glr-auto-examples-neural-networks-plot-mnist-filters-py)
## 1.17.3\. 回归
......@@ -132,22 +133,20 @@ array([[0, 1]])
详细信息,请参阅下面的示例。
示例:
* [Varying regularization in Multi-layer Perceptron](https://scikit-learn.org/stable/auto_examples/neural_networks/plot_mlp_alpha.html#sphx-glr-auto-examples-neural-networks-plot-mlp-alpha-py)
>示例:
>* [Varying regularization in Multi-layer Perceptron](https://scikit-learn.org/stable/auto_examples/neural_networks/plot_mlp_alpha.html#sphx-glr-auto-examples-neural-networks-plot-mlp-alpha-py)
## 1.17.5\. 算法
MLP 使用 [Stochastic Gradient Descent(随机梯度下降)(SGD)](https://en.wikipedia.org/wiki/Stochastic_gradient_descent), [Adam](http://arxiv.org/abs/1412.6980), 或者 [L-BFGS](https://en.wikipedia.org/wiki/Limited-memory_BFGS) 进行训练。 随机梯度下降(SGD) 使用关于需要适应的一个参数的损失函数的梯度来更新参数,即
![w \leftarrow w - \eta (\alpha \frac{\partial R(w)}{\partial w}
+ \frac{\partial Loss}{\partial w})](img/cdc5ef75d769259ef0537940296ab0b4.jpg)
![w \leftarrow w - \eta (\alpha \frac{\partial R(w)}{\partial w}+ \frac{\partial Loss}{\partial w})](img/cdc5ef75d769259ef0537940296ab0b4.jpg)
其中 ![\eta](img/fe1d79339349f9b6263e123094ffce7b.jpg) 是控制训练过程参数更新步长的学习率(learning rate)。 ![Loss](img/16622481c2bbb001363e20660b549ae9.jpg) 是损失函数(loss function)。
更多细节可以在这个文档中找到 [SGD](http://scikit-learn.org/stable/modules/sgd.html)
更多细节可以在这个文档中找到 [SGD](docs/6)
Adam 类似于 SGD,因为它是 stochastic optimizer (随机优化器),但它可以根据低阶矩的自适应估计自动调整参数更新的量。
......@@ -199,27 +198,20 @@ MLP 根据特定问题使用不同的损失函数。 二分类问题的损失函
## 1.17.8\. 实用技巧
> * 多层感知器对特征的缩放是敏感的,所以它强烈建议您归一化你的数据。 例如,将输入向量 X 的每个属性放缩到到 [0, 1] 或 [-1,+1] ,或者将其标准化使它具有 0 均值和方差 1。
>
> 注意,为了得到有意义的结果,您必须对测试集也应用 _相同的_ 尺度缩放。 您可以使用 `StandardScaler` 进行标准化。
>
> > ```py
> > >>> from sklearn.preprocessing import StandardScaler
> > >>> scaler = StandardScaler()
> > >>> # Don't cheat - fit only on training data
> > >>> scaler.fit(X_train)
> > >>> X_train = scaler.transform(X_train)
> > >>> # apply same transformation to test data
> > >>> X_test = scaler.transform(X_test)
> >
> > ```
> >
> > 另一个推荐的方法是在 `Pipeline` 中使用的 `StandardScaler` 。
>
> * 最好使用 `GridSearchCV` 找到一个合理的正则化参数 ![\alpha](img/d8b3d5242d513369a44f8bf0c6112744.jpg) ,通常范围是在 `10.0 ** -np.arange(1, 7)` 。
> * 据经验可知,我们观察到 *L-BFGS* 收敛速度是更快的并且是小数据集上更好的解决方案。对于规模相对比较大的数据集,*Adam* 是非常鲁棒的。 它通常会迅速收敛,并得到相当不错的表现。
>
> 另一方面,如果学习率调整得正确, 使用 momentum 或 nesterov’s momentum 的 *SGD* 可以比这两种算法更好。
* 多层感知器对特征的缩放是敏感的,所以它强烈建议您归一化你的数据。 例如,将输入向量 X 的每个属性放缩到到 [0, 1] 或 [-1,+1] ,或者将其标准化使它具有 0 均值和方差 1。注意,为了得到有意义的结果,您必须对测试集也应用 *相同的* 尺度缩放。 您可以使用 `StandardScaler` 进行标准化。
```py
from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
# Don't cheat - fit only on training data
scaler.fit(X_train)
X_train = scaler.transform(X_train)
# apply same transformation to test data
X_test = scaler.transform(X_test)
```
另一个推荐的方法是在 `Pipeline` 中使用的 `StandardScaler`
* 最好使用 `GridSearchCV` 找到一个合理的正则化参数 ![\alpha](img/d8b3d5242d513369a44f8bf0c6112744.jpg) ,通常范围是在 `10.0 ** -np.arange(1, 7)`
* 据经验可知,我们观察到 *L-BFGS* 收敛速度是更快的并且是小数据集上更好的解决方案。对于规模相对比较大的数据集,*Adam* 是非常鲁棒的。 它通常会迅速收敛,并得到相当不错的表现。另一方面,如果学习率调整得正确, 使用 momentum 或 nesterov’s momentum 的 *SGD* 可以比这两种算法更好。
## 1.17.9\. 使用 warm_start 的更多控制
......@@ -231,15 +223,15 @@ MLP 根据特定问题使用不同的损失函数。 二分类问题的损失函
>>> clf = MLPClassifier(hidden_layer_sizes=(15,), random_state=1, max_iter=1, warm_start=True)
>>> for i in range(10):
... clf.fit(X, y)
... # additional monitoring / inspection
... # additional monitoring / inspection
MLPClassifier(...
```
参考文献:
* [“Learning representations by back-propagating errors.”](http://www.iro.umontreal.ca/~pift6266/A06/refs/backprop_old.pdf) Rumelhart, David E., Geoffrey E. Hinton, and Ronald J. Williams.
* [“Stochastic Gradient Descent”](http://leon.bottou.org/projects/sgd) L. Bottou - Website, 2010.
* [“Backpropagation”](http://ufldl.stanford.edu/wiki/index.php/Backpropagation_Algorithm) Andrew Ng, Jiquan Ngiam, Chuan Yu Foo, Yifan Mai, Caroline Suen - Website, 2011.
* [“Efficient BackProp”](http://yann.lecun.com/exdb/publis/pdf/lecun-98b.pdf) Y. LeCun, L. Bottou, G. Orr, K. Müller - In Neural Networks: Tricks of the Trade 1998.
* [“Adam: A method for stochastic optimization.”](http://arxiv.org/pdf/1412.6980v8.pdf) Kingma, Diederik, and Jimmy Ba. arXiv preprint arXiv:1412.6980 (2014).
\ No newline at end of file
>参考文献:
>
>* [“Learning representations by back-propagating errors.”](http://www.iro.umontreal.ca/~pift6266/A06/refs/backprop_old.pdf) Rumelhart, David E., Geoffrey E. Hinton, and Ronald J. Williams.
>* [“Stochastic Gradient Descent”](http://leon.bottou.org/projects/sgd) L. Bottou - Website, 2010.
>* [“Backpropagation”](http://ufldl.stanford.edu/wiki/index.php/Backpropagation_Algorithm) Andrew Ng, Jiquan Ngiam, Chuan Yu Foo, Yifan Mai, Caroline Suen - Website, 2011.
>* [“Efficient BackProp”](http://yann.lecun.com/exdb/publis/pdf/lecun-98b.pdf) Y. LeCun, L. Bottou, G. Orr, K. Müller - In Neural Networks: Tricks of the Trade 1998.
>* [“Adam: A method for stochastic optimization.”](http://arxiv.org/pdf/1412.6980v8.pdf) Kingma, Diederik, and Jimmy Ba. arXiv preprint arXiv:1412.6980 (2014).
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册