From bc5155f080cf928a4a669ad189afdb1e5aec3068 Mon Sep 17 00:00:00 2001 From: edson duarte <edsonduarte1990@gmail.com> Date: Tue, 14 Jul 2015 22:37:08 -0300 Subject: [PATCH] Fixed small typos in SVM examples. --- examples/svm/plot_iris.py | 2 +- examples/svm/plot_rbf_parameters.py | 18 +++++++++--------- examples/svm/plot_separating_hyperplane.py | 2 +- examples/svm/plot_svm_nonlinear.py | 2 +- examples/svm/plot_weighted_samples.py | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/svm/plot_iris.py b/examples/svm/plot_iris.py index 2fe6d64dac..33a906dbff 100644 --- a/examples/svm/plot_iris.py +++ b/examples/svm/plot_iris.py @@ -30,7 +30,7 @@ kernel and its parameters. .. NOTE:: while plotting the decision function of classifiers for toy 2D datasets can help get an intuitive understanding of their respective expressive power, be aware that those intuitions don't always generalize to - more realistic high-dimensional problem. + more realistic high-dimensional problems. """ print(__doc__) diff --git a/examples/svm/plot_rbf_parameters.py b/examples/svm/plot_rbf_parameters.py index 0d8c1eab85..ead630e293 100644 --- a/examples/svm/plot_rbf_parameters.py +++ b/examples/svm/plot_rbf_parameters.py @@ -14,10 +14,10 @@ influence of samples selected by the model as support vectors. The ``C`` parameter trades off misclassification of training examples against simplicity of the decision surface. A low ``C`` makes the decision surface smooth, while a high ``C`` aims at classifying all training examples correctly -by give the model freedom to select more samples as support vectors. +by giving the model freedom to select more samples as support vectors. The first plot is a visualization of the decision function for a variety of -parameter values on simplified classification problem involving only 2 input +parameter values on a simplified classification problem involving only 2 input features and 2 possible target classes (binary classification). Note that this kind of plot is not possible to do for problems with more features or target classes. @@ -35,8 +35,8 @@ them appart in the blink of an eye. The behavior of the model is very sensitive to the ``gamma`` parameter. If ``gamma`` is too large, the radius of the area of influence of the support -vectors only includes the support vector it-self and no amount of -regularization with ``C`` will be able to prevent of overfitting. +vectors only includes the support vector itself and no amount of +regularization with ``C`` will be able to prevent overfitting. When ``gamma`` is very small, the model is too constrained and cannot capture the complexity or "shape" of the data. The region of influence of any selected @@ -44,21 +44,21 @@ support vector would include the whole training set. The resulting model will behave similarly to a linear model with a set of hyperplanes that separate the centers of high density of any pair of two classes. -For intermediate values, we can see on a the second plot that good models can +For intermediate values, we can see on the second plot that good models can be found on a diagonal of ``C`` and ``gamma``. Smooth models (lower ``gamma`` values) can be made more complex by selecting a larger number of support vectors (larger ``C`` values) hence the diagonal of good performing models. Finally one can also observe that for some intermediate values of ``gamma`` we get equally performing models when ``C`` becomes very large: it is not -necessary to regularize by limiting the number support vectors. The radius of +necessary to regularize by limiting the number of support vectors. The radius of the RBF kernel alone acts as a good structural regularizer. In practice though it might still be interesting to limit the number of support vectors with a lower value of ``C`` so as to favor models that use less memory and that are faster to predict. We should also note that small differences in scores results from the random -splits of the cross-validation procedure. Those spurious variations can +splits of the cross-validation procedure. Those spurious variations can be smoothed out by increasing the number of CV iterations ``n_iter`` at the expense of compute time. Increasing the value number of ``C_range`` and ``gamma_range`` steps will increase the resolution of the hyper-parameter heat @@ -101,8 +101,8 @@ X = iris.data y = iris.target # Dataset for decision function visualization: we only keep the first two -# features in X and sub-sample the dataset to keep only 2 class to has -# to make it a binary classification problem. +# features in X and sub-sample the dataset to keep only 2 classes and +# make it a binary classification problem. X_2d = X[:, :2] X_2d = X_2d[y > 0] diff --git a/examples/svm/plot_separating_hyperplane.py b/examples/svm/plot_separating_hyperplane.py index 254368fb42..ff6f3fc8f3 100644 --- a/examples/svm/plot_separating_hyperplane.py +++ b/examples/svm/plot_separating_hyperplane.py @@ -4,7 +4,7 @@ SVM: Maximum margin separating hyperplane ========================================= Plot the maximum margin separating hyperplane within a two-class -separable dataset using a Support Vector Machines classifier with +separable dataset using a Support Vector Machine classifier with linear kernel. """ print(__doc__) diff --git a/examples/svm/plot_svm_nonlinear.py b/examples/svm/plot_svm_nonlinear.py index 672a19d307..142c42ad12 100644 --- a/examples/svm/plot_svm_nonlinear.py +++ b/examples/svm/plot_svm_nonlinear.py @@ -7,7 +7,7 @@ Perform binary classification using non-linear SVC with RBF kernel. The target to predict is a XOR of the inputs. -The color map illustrates the decision function learn by the SVC. +The color map illustrates the decision function learned by the SVC. """ print(__doc__) diff --git a/examples/svm/plot_weighted_samples.py b/examples/svm/plot_weighted_samples.py index ac9207838b..4bcf267261 100644 --- a/examples/svm/plot_weighted_samples.py +++ b/examples/svm/plot_weighted_samples.py @@ -9,7 +9,7 @@ is proportional to its weight. The sample weighting rescales the C parameter, which means that the classifier puts more emphasis on getting these points right. The effect might often be subtle. -To emphasis the effect here, we particularly weight outliers, making the +To emphasize the effect here, we particularly weight outliers, making the deformation of the decision boundary very visible. """ print(__doc__) -- GitLab