def incr_mean_variance_axis(X, axis, last_mean, last_var, last_n):
 _raise_error_wrong_axis(axis)
 if isinstance(X, sp.csr_matrix):
  if (axis == 0):
   return _incr_mean_var_axis0(X, last_mean=last_mean, last_var=last_var, last_n=last_n)
  else:
   return _incr_mean_var_axis0(X.T, last_mean=last_mean, last_var=last_var, last_n=last_n)
 elif isinstance(X, sp.csc_matrix):
  if (axis == 0):
   return _incr_mean_var_axis0(X, last_mean=last_mean, last_var=last_var, last_n=last_n)
  else:
   return _incr_mean_var_axis0(X.T, last_mean=last_mean, last_var=last_var, last_n=last_n)
 else:
  _raise_typeerror(X)

def incr_mean_variance_axis ( X , axis , last_mean , last_var , last_n ) : _raise_error_wrong_axis ( axis ) if isinstance ( X , sp . csr_matrix ) : if ( axis == 0 ) : return _incr_mean_var_axis0 ( X , last_mean = last_mean , last_var = last_var , last_n = last_n ) else : return _incr_mean_var_axis0 ( X . T , last_mean = last_mean , last_var = last_var , last_n = last_n ) elif isinstance ( X , sp . csc_matrix ) : if ( axis == 0 ) : return _incr_mean_var_axis0 ( X , last_mean = last_mean , last_var = last_var , last_n = last_n ) else : return _incr_mean_var_axis0 ( X . T , last_mean = last_mean , last_var = last_var , last_n = last_n ) else : _raise_typeerror ( X )
compute incremental mean and variance along an axix on a csr or csc matrix .