Skip to content

[MRG+2] DOC examples added to the rest of sklearn/covariance classes #11732

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 85 commits into from
Mar 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
874e0a6
added graphicallasso and graphicallassocv examples
Aug 1, 2018
0623e66
don't double invert
Aug 2, 2018
5c20a28
reported log_likelihood ...
Aug 3, 2018
4a78ba6
fir real negative log likelihood
Aug 4, 2018
37e77c7
fix graphlasso rand issue
adrinjalali Sep 25, 2018
d0b7631
add elliptic_envelope example
adrinjalali Sep 25, 2018
adb9248
make the test numerically more stable [I guess]
adrinjalali Sep 25, 2018
9c127ce
show outlier detection for EllipticEnvelope
adrinjalali Oct 4, 2018
d362e5e
change the graphicallasso examples and make them like the others
adrinjalali Oct 4, 2018
a60ea6e
remove np.set_printoptions
adrinjalali Oct 4, 2018
d1aadb9
DOC regenerate authors.rst after Adrin has joined (#12719)
jnothman Dec 4, 2018
1aacd8f
EXA change normed to density in matplotlib calls in examples (#12718)
adrinjalali Dec 6, 2018
73eb4e6
DOC Use defined notation for precision and recall (#12726)
Dec 6, 2018
653a235
ENH Replacing np.where lookup by an inverted index (#9907)
wdevazelhes Dec 7, 2018
55ec997
FIX warns when invalid n_components in LinearDiscriminantAnalysis (#1…
wdevazelhes Dec 7, 2018
72410fb
MNT cleaning whats_new
TomDLT Dec 8, 2018
233bb76
MNT Remove unnecessary custom nested fused types by builtin floating …
jeremiedbb Dec 9, 2018
d662e2f
DOC Revert "DOC Use defined notation for precision and recall (#12726…
jnothman Dec 9, 2018
9aa6e12
MAINT Use unicode in feature_extraction tests (#12709)
rth Dec 9, 2018
78caf1f
DOC Fix math typo in model_evaluation's explained_variance (#12747)
adrinjalali Dec 10, 2018
5e81da4
DOC Clarify what the decision function in SVM calculates (#12708)
JanSellner Dec 10, 2018
1ef184c
Revert "DOC Fix math typo in model_evaluation's explained_variance (#…
qinhanmin2014 Dec 10, 2018
ea087fd
DOC change "cumulative density" to "cumulative distribution" (#12754)
albertcthomas Dec 11, 2018
9ef9b67
DOC Added roadmap.rst (#12761)
NicolasHug Dec 13, 2018
5d1d493
ENH Use accuracy instead of micro-average in classification_report (#…
eamanu Dec 13, 2018
c8836c1
Update linear_model.rst (#12735)
hassaanseeker Dec 13, 2018
d7923b1
MNT Deprecate assert_true and assert_false (#12717)
amourav Dec 13, 2018
c3dd44f
DOC Explain solver choices for LogisticRegression (#12768)
amueller Dec 14, 2018
481666e
Remove python < 3.5 from CI (#12746)
adrinjalali Dec 14, 2018
41b6c1c
MNT flake8 in r2_score examples (#12773)
qinhanmin2014 Dec 14, 2018
befc8c8
MNT hotfix circle-ci job dependency (#12780)
adrinjalali Dec 14, 2018
7e8deb5
DOC update min required versions in some remaining docs (#12778)
adrinjalali Dec 14, 2018
5aeda63
DOC remove python2.7 from badge list in README (#12781)
adrinjalali Dec 14, 2018
a15e4cd
MNT Don't persist doc in doc-min-dependencies job (#12782)
qinhanmin2014 Dec 14, 2018
442c777
EXA Avoiding TypeError when using --all_categories in plot_document_c…
dafeda Dec 14, 2018
961c395
DOC Remove what's new entry for unreleased feature
qinhanmin2014 Dec 15, 2018
5558fbd
DOC Hyperlink DOIs to preferred resolver (#12792)
katrinleinweber Dec 15, 2018
f8a0673
API (0.21) Handling parameter labels removal from hamming_loss (#12656)
Dec 15, 2018
eb704e7
DOC (0.21) update Circle CI doc
qinhanmin2014 Dec 15, 2018
b4b9c97
DOC Fix LaTeX text{} block escaping of underscores in doc-modules-mod…
adanhawth Dec 16, 2018
54252ce
DOC Added description for classes_ in LogisticRegression/LogisticRegr…
Dec 17, 2018
046f89c
FIX pairwise distances with 'seuclidean' or 'mahalanobis' metrics (#1…
jeremiedbb Dec 17, 2018
e9de4cf
DOC typo simple present singular for SGDClassifier in linear model do…
amueller Dec 18, 2018
679b983
DOC reorder what's new 0.20.2
jnothman Dec 18, 2018
34b812a
TST np.vstack won't support generator in the future (#12816)
qinhanmin2014 Dec 18, 2018
9c71547
DOC Update changed models for 0.20.2 (#12810)
qinhanmin2014 Dec 18, 2018
f6288bc
DOC Added example to decomposition.DictionaryLearning (#12799)
Dec 18, 2018
b1ed421
Reduce precision requirements for float32 PCA (#12825)
jnothman Dec 19, 2018
afcd08e
Revert "DOC Added example to decomposition.DictionaryLearning (#12799)"
qinhanmin2014 Dec 19, 2018
8965935
DOC Shorten and improve CONTRIBUTING.md (#12801)
Dec 19, 2018
e9dceaf
DOC bad link in ParameterGrid documentation (#12828)
bertrandhaut Dec 19, 2018
f04a0e0
FIX Add more validation for size parameters in train_test_split (#12733)
drorata Dec 19, 2018
b6f3d2a
DOC Update what's new according to 0.20.X
amueller Dec 17, 2018
20d1759
DOC add |Feature| tag in what's new
qinhanmin2014 Dec 19, 2018
5cf3307
FIX Fixed gradient computation in gradient boosting for multiclass cl…
NicolasHug Dec 19, 2018
aeb70c0
[MRG+1] Deprecated logistic_regression_path (#12821)
NicolasHug Dec 19, 2018
7d4a0fc
TST Adds multilabels permutation tests to metrics/test_common (#12803)
thomasjpfan Dec 20, 2018
ee861c8
[MRG] Add pprint for estimators - continued (#11705)
NicolasHug Dec 20, 2018
35db48d
CI move to the latest cython in ci (#12829)
adrinjalali Dec 20, 2018
68d3568
BLD add a mac run on Travis (#12824)
jnothman Dec 20, 2018
eadb577
MAINT Remove minor duplication in metrics.__init__ (#12851)
thomasjpfan Dec 21, 2018
67a3b11
DOC improving import convenience in class examples (#12846)
akahard2dj Dec 23, 2018
097129f
DOC Document that fetch_20newsgroups also returns target_names (#12783)
eamanu Dec 23, 2018
c95eb2d
BENCH Make benchmarks/bench_text_vectorizers.py run faster (#12842)
rth Dec 23, 2018
6bfd365
DOC Resolve a missing link on the home page (#12847)
akahard2dj Dec 27, 2018
dc29f5b
DOC Fixed typo in contributors guide (#12868)
NicolasHug Dec 27, 2018
1efc2bb
DOC better explain bootstrap option in forests and bagging (#12875)
amueller Dec 28, 2018
5b74898
BLD circle-ci should only run/build plot_* files (#12797)
adrinjalali Dec 28, 2018
22956f8
DOC add sentence about line length of rst files (#12883)
albertcthomas Dec 28, 2018
370fd03
DOC link to dev docs instead of contributing docs in the menu (#12885)
amueller Dec 29, 2018
c010069
DOC Added tips for reading the code base (#12874)
NicolasHug Dec 31, 2018
3463b4d
TST Manually scramble the indices in svm tests (#12890)
qinhanmin2014 Jan 2, 2019
e7f6d4f
FIX predict method for multiclass multioutput ensemble models (#12834)
elsander Jan 2, 2019
0f277f2
DOC Fix typo in glossary.rst (#12913)
pakallis Jan 3, 2019
14621e8
MRG Drop legacy python / remove six dependencies (#12639)
amueller Jan 3, 2019
3e10ea7
MNT Use scipy.special.xlogy to avoid indefinite limit in 0 for x*log(…
rth Jan 3, 2019
2b7ca5f
FIX Use scipy.special.expit in calibration (#12909)
ZaydH Jan 3, 2019
4fe3d1b
FIX learning_rate default value in update_terminal_regions (#12925)
qinhanmin2014 Jan 5, 2019
8d1ac41
EXA Fix several DeprecationWarning: invalid escape sequence in exampl…
BoboTiG Jan 5, 2019
f13605d
DOC How to deal with stalled PR (#12894)
GaelVaroquaux Jan 5, 2019
1264247
MAINT Use set litterals when possible (#12667)
rth Jan 6, 2019
6ccdd03
(review reminder) Merge remote-tracking branch 'upstream/master' into…
adrinjalali Jan 7, 2019
c1f445b
Merge remote-tracking branch 'upstream/master' into examples/graphlasso
adrinjalali Feb 28, 2019
b520fbd
address comments
adrinjalali Feb 28, 2019
24dd101
real_conv -> true_conv
adrinjalali Feb 28, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions sklearn/covariance/elliptic_envelope.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,26 @@ class EllipticEnvelope(MinCovDet, OutlierMixin):
such a way we obtain the expected number of outliers (samples with
decision function < 0) in training.

Examples
--------
>>> import numpy as np
>>> from sklearn.covariance import EllipticEnvelope
>>> true_cov = np.array([[.8, .3],
... [.3, .4]])
>>> X = np.random.RandomState(0).multivariate_normal(mean=[0, 0],
... cov=true_cov,
... size=500)
>>> cov = EllipticEnvelope(random_state=0).fit(X)
>>> # predict returns 1 for an inlier and -1 for an outlier
>>> cov.predict([[0, 0],
... [3, 3]])
array([ 1, -1])
>>> cov.covariance_ # doctest: +ELLIPSIS
array([[0.7411..., 0.2535...],
[0.2535..., 0.3053...]])
>>> cov.location_
array([0.0813... , 0.0427...])

See Also
--------
EmpiricalCovariance, MinCovDet
Expand Down
48 changes: 48 additions & 0 deletions sklearn/covariance/graph_lasso_.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,9 @@ class GraphicalLasso(EmpiricalCovariance):

Attributes
----------
location_ : array-like, shape (n_features,)
Estimated location, i.e. the estimated mean.

covariance_ : array-like, shape (n_features, n_features)
Estimated covariance matrix

Expand All @@ -330,6 +333,27 @@ class GraphicalLasso(EmpiricalCovariance):
n_iter_ : int
Number of iterations run.

Examples
--------
>>> import numpy as np
>>> from sklearn.covariance import GraphicalLasso
>>> true_cov = np.array([[.8, 0., .2, 0.],
... [0., .4, 0., 0.],
... [.2, 0., .3, .1],
... [0., 0., .1, .7]])
>>> np.random.seed(0)
>>> X = np.random.multivariate_normal(mean=[0, 0, 0, 0],
... cov=true_cov,
... size=200)
>>> cov = GraphicalLasso().fit(X)
>>> np.around(cov.covariance_, decimals=3)
array([[0.816, 0.049, 0.218, 0.019],
[0.049, 0.364, 0.017, 0.034],
[0.218, 0.017, 0.322, 0.093],
[0.019, 0.034, 0.093, 0.69 ]])
>>> np.around(cov.location_, decimals=3)
array([0.073, 0.04 , 0.038, 0.143])

See Also
--------
graphical_lasso, GraphicalLassoCV
Expand Down Expand Up @@ -543,6 +567,9 @@ class GraphicalLassoCV(GraphicalLasso):

Attributes
----------
location_ : array-like, shape (n_features,)
Estimated location, i.e. the estimated mean.

covariance_ : numpy.ndarray, shape (n_features, n_features)
Estimated covariance matrix.

Expand All @@ -561,6 +588,27 @@ class GraphicalLassoCV(GraphicalLasso):
n_iter_ : int
Number of iterations run for the optimal alpha.

Examples
--------
>>> import numpy as np
>>> from sklearn.covariance import GraphicalLassoCV
>>> true_cov = np.array([[.8, 0., .2, 0.],
... [0., .4, 0., 0.],
... [.2, 0., .3, .1],
... [0., 0., .1, .7]])
>>> np.random.seed(0)
>>> X = np.random.multivariate_normal(mean=[0, 0, 0, 0],
... cov=true_cov,
... size=200)
>>> cov = GraphicalLassoCV(cv=5).fit(X)
>>> np.around(cov.covariance_, decimals=3)
array([[0.816, 0.051, 0.22 , 0.017],
[0.051, 0.364, 0.018, 0.036],
[0.22 , 0.018, 0.322, 0.094],
[0.017, 0.036, 0.094, 0.69 ]])
>>> np.around(cov.location_, decimals=3)
array([0.073, 0.04 , 0.038, 0.143])

See Also
--------
graphical_lasso, GraphicalLasso
Expand Down