scikit-learn/scikit-learn — pull request #541 by ogrisel (2012-01-07 15:57:42+00:00)
Title: MRG: Explicitly mark the array returned by the linear svm readonly property coef_ as immutable

This pull-request #539 should be taken into account to understand the context about the debate of readonly properties in the scikit-learn API.

The following is an example session were the unsuspecting user might overlook a bug:

```
>>> from sklearn.svm import SVC
>>> from sklearn.datasets import load_iris
>>> iris = load_iris()
>>> clf = SVC(kernel='linear').fit(iris.data, iris.target)
>>> clf.coef_

array([[-1.0443518 , 0.01195155, -1.91966087, -0.81040704],
[ 1.5863679 , 1.66207276, -1.65274791, -1.95241805]])
>>> clf.coef_[0, 3] = 0
>>> clf.coef_

array([[-1.0443518 , 0.01195155, -1.91966087, -0.81040704],
[ 1.5863679 , 1.66207276, -1.65274791, -1.95241805]])
```