code: def oas(X, assume_centered=False):
      """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.
  
      Returns
      -------
      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
      does not correspond to the one given in the article. It has been taken
      from the MATLAB program available from the author's webpage
      (http://tbayes.eecs.umich.edu/yilun/covestimation).
  
      """
      X = np.asarray(X)
      # for only one feature, the result is the same whatever the shrinkage
      if len(X.shape) == 2 and X.shape[1] == 1:
          if not assume_centered:
              X = X - X.mean()
          return np.atleast_2d((X**2).mean()), 0.0
      if X.ndim == 1:
          X = np.reshape(X, (1, -1))
          warnings.warn(
              "Only one sample available. "
              "You may want to reshape your data array"
          )
          n_samples = 1
          n_features = X.size
      else:
          n_samples, n_features = X.shape
  
      emp_cov = empirical_covariance(X, assume_centered=assume_centered)
      mu = np.trace(emp_cov) / n_features
  
      # formula from Chen et al.'s **implementation**
      alpha = np.mean(emp_cov**2)
      num = alpha + mu**2
      den = (n_samples + 1.0) * (alpha - (mu**2) / n_features)
  
      shrinkage = 1.0 if den == 0 else min(num / den, 1.0)
      shrunk_cov = (1.0 - shrinkage) * emp_cov
      shrunk_cov.flat[:: n_features + 1] += shrinkage * mu
  
      return shrunk_cov, shrinkage
  
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 4 for calling a global function with example usage: oas(X, assume_centered) and returns: shrunk_cov,  shrinkage, np,  int