# sklearn.covariance.oas¶

sklearn.covariance.oas(X, assume_centered=False)[source]

Estimate covariance with the Oracle Approximating Shrinkage algorithm.

Parameters: X : array-like, shape (n_samples, n_features) Data from which to compute the covariance estimate. assume_centered : boolean If True, data are not centered before computation. Useful to work with data whose mean is significantly equal to zero but is not exactly zero. If False, data are centered before computation. shrunk_cov : array-like, shape (n_features, n_features) Shrunk covariance. shrinkage : float Coefficient in the convex combination used for the computation of the shrunk estimate.

Notes

The regularised (shrunk) covariance is:

(1 - shrinkage) * cov + shrinkage * mu * np.identity(n_features)

where mu = trace(cov) / n_features

The formula we used to implement the OAS is slightly modified compared to the one given in the article. See OAS for more details.
{"ft_lang_label":"__label__en","ft_lang_prob":0.7556792,"math_prob":0.90649915,"size":954,"snap":"2023-40-2023-50","text_gpt3_token_len":226,"char_repetition_ratio":0.13368422,"word_repetition_ratio":0.0,"special_character_ratio":0.21593292,"punctuation_ratio":0.17391305,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.97400606,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-10-01T09:37:14Z\",\"WARC-Record-ID\":\"<urn:uuid:824db1af-3e46-45e6-81d9-b5e71598faa6>\",\"Content-Length\":\"13133\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:bbebd28f-a149-46e2-94fe-e2f2692dfd2d>\",\"WARC-Concurrent-To\":\"<urn:uuid:08458fce-c25e-4043-8032-7bfb7abecdb5>\",\"WARC-IP-Address\":\"185.199.111.153\",\"WARC-Target-URI\":\"https://scikit-learn.org/0.20/modules/generated/sklearn.covariance.oas.html\",\"WARC-Payload-Digest\":\"sha1:FM5HLVW4K6SCYY6TZC2SHJM2OVI6AZZL\",\"WARC-Block-Digest\":\"sha1:HWOWS5IAKVR554ICAQBKHHOVGB4JYKZF\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-40/CC-MAIN-2023-40_segments_1695233510810.46_warc_CC-MAIN-20231001073649-20231001103649-00713.warc.gz\"}"}