class_docstr: Oracle Approximating Shrinkage Estimator
  
  Read more in the :ref:`User Guide <shrunk_covariance>`.
  
  OAS is a particular form of shrinkage described in
  "Shrinkage Algorithms for MMSE Covariance Estimation"
  Chen et al., IEEE Trans. on Sign. Proc., Volume 58, Issue 10, October 2010.
  
  The formula used here does not correspond to the one given in the
  article. It has been taken from the Matlab program available from the
  authors' webpage (http://tbayes.eecs.umich.edu/yilun/covestimation).
  In the original article, formula (23) states that 2/p is multiplied by 
  Trace(cov*cov) in both the numerator and denominator, this operation is omitted
  in the author's MATLAB program because for a large p, the value of 2/p is so 
  small that it doesn't affect the value of the estimator. 
  
  Parameters
  ----------
  store_precision : bool, default=True
      Specify if the estimated precision is stored.
  
  assume_centered: bool, default=False
      If True, data are not centered before computation.
      Useful when working with data whose mean is almost, but not exactly
      zero.
      If False (default), data are centered before computation.
  
  Attributes
  ----------
  covariance_ : array-like, shape (n_features, n_features)
      Estimated covariance matrix.
  
  precision_ : array-like, shape (n_features, n_features)
      Estimated pseudo inverse matrix.
      (stored only if store_precision is True)
  
  shrinkage_ : float, 0 <= shrinkage <= 1
    coefficient in the convex combination used for the computation
    of the shrunk estimate.
  
  Notes
  -----
  The regularised covariance is::
  
      (1 - shrinkage)*cov
              + shrinkage*mu*np.identity(n_features)
  
  where mu = trace(cov) / n_features
  and shrinkage is given by the OAS formula (see References)
  
  References
  ----------
  "Shrinkage Algorithms for MMSE Covariance Estimation"
  Chen et al., IEEE Trans. on Sign. Proc., Volume 58, Issue 10, October 2010.
class_docstr_tok: ["Oracle","Approximating","Shrinkage","Estimator","Read","more","in","the",":","ref",":","`","User","Guide","<","shrunk_covariance",">","`",".","OAS","is","a","particular","form","of","shrinkage","described","in","''","Shrinkage","Algorithms","for","MMSE","Covariance","Estimation","''","Chen","et","al.",",","IEEE","Trans",".","on","Sign",".","Proc.",",","Volume","58",",","Issue","10",",","October","2010",".","The","formula","used","here","does","not","correspond","to","the","one","given","in","the","article",".","It","has","been","taken","from","the","Matlab","program","available","from","the","authors","'","webpage","(","http",":","\/\/tbayes.eecs.umich.edu\/yilun\/covestimation",")",".","In","the","original","article",",","formula","(","23",")","states","that","2\/p","is","multiplied","by","Trace","(","cov","*","cov",")","in","both","the","numerator","and","denominator",",","this","operation","is","omitted","in","the","author","'s","MATLAB","program","because","for","a","large","p",",","the","value","of","2\/p","is","so","small","that","it","does","n't","affect","the","value","of","the","estimator",".","Parameters","--","--","--","--","--","store_precision",":","bool",",","default=True","Specify","if","the","estimated","precision","is","stored",".","assume_centered",":","bool",",","default=False","If","True",",","data","are","not","centered","before","computation",".","Useful","when","working","with","data","whose","mean","is","almost",",","but","not","exactly","zero",".","If","False","(","default",")",",","data","are","centered","before","computation",".","Attributes","--","--","--","--","--","covariance_",":","array-like",",","shape","(","n_features",",","n_features",")","Estimated","covariance","matrix",".","precision_",":","array-like",",","shape","(","n_features",",","n_features",")","Estimated","pseudo","inverse","matrix",".","(","stored","only","if","store_precision","is","True",")","shrinkage_",":","float",",","0","<","=","shrinkage","<","=","1","coefficient","in","the","convex","combination","used","for","the","computation","of","the","shrunk","estimate",".","Notes","--","--","-","The","regularised","covariance","is",":",":","(","1","-","shrinkage",")","*","cov","+","shrinkage","*","mu","*","np.identity","(","n_features",")","where","mu","=","trace","(","cov",")","\/","n_features","and","shrinkage","is","given","by","the","OAS","formula","(","see","References",")","References","--","--","--","--","--","''","Shrinkage","Algorithms","for","MMSE","Covariance","Estimation","''","Chen","et","al.",",","IEEE","Trans",".","on","Sign",".","Proc.",",","Volume","58",",","Issue","10",",","October","2010","."]
docstr: Fits the Oracle Approximating Shrinkage covariance model
  according to the given training data and parameters.
  
  Parameters
  ----------
  X : array-like, shape = [n_samples, n_features]
      Training data, where n_samples is the number of samples
      and n_features is the number of features.
  y : not used, present for API consistence purpose.
  
  Returns
  -------
  self: object
      Returns self.
docstr_tok: ["Fits","the","Oracle","Approximating","Shrinkage","covariance","model","according","to","the","given","training","data","and","parameters",".","Parameters","--","--","--","--","--","X",":","array-like",",","shape","=","[","n_samples",",","n_features","]","Training","data",",","where","n_samples","is","the","number","of","samples","and","n_features","is","the","number","of","features",".","y",":","not","used",",","present","for","API","consistence","purpose",".","Returns","--","--","--","-","self",":","object","Returns","self","."]
code: def fit(self, X, y=None):
      """Fits the Oracle Approximating Shrinkage covariance model
      according to the given training data and parameters.
  
      Parameters
      ----------
      X : array-like, shape = [n_samples, n_features]
          Training data, where n_samples is the number of samples
          and n_features is the number of features.
      y : not used, present for API consistence purpose.
  
      Returns
      -------
      self: object
          Returns self.
  
      """
      X = check_array(X)
      # Not calling the parent object to fit, to avoid computing the
      # covariance matrix (and potentially the precision)
      if self.assume_centered:
          self.location_ = np.zeros(X.shape[1])
      else:
          self.location_ = X.mean(0)
  
      covariance, shrinkage = oas(
          X - self.location_, assume_centered=True
      )
      self.shrinkage_ = shrinkage
      self._set_covariance(covariance)
  
      return self
  
imports: from __future__ import division
  import warnings
  import numpy
  from .empirical_covariance_ import empirical_covariance, EmpiricalCovariance
  from ..externals.six.moves import xrange
  from ..utils import check_array
label_desc: Use image node_id 1 for calling the OAS obj's underlying member method code with example usage: obj.fit(X, y) and returns: self