Changed from deprecated scipy.stats.mean() to numpy.mean().
This commit is contained in:
parent
f2afcbc3fc
commit
c50d34effc
|
@ -10,7 +10,7 @@ import gtk
|
|||
import laydi
|
||||
from laydi import plots, main,logger
|
||||
import scipy
|
||||
from scipy import dot,sum,diag,arange,log,mean,newaxis,sqrt,apply_along_axis,empty
|
||||
from scipy import dot,sum,diag,arange,log,newaxis,sqrt,apply_along_axis,empty
|
||||
from scipy.stats import corrcoef
|
||||
|
||||
def correlation_loadings(data, T, test=True):
|
||||
|
@ -418,7 +418,7 @@ class TRBiplot(plots.ScatterPlot):
|
|||
# normalize B
|
||||
Bnorm = scipy.apply_along_axis(scipy.linalg.norm, 1, B)
|
||||
x = model._dataset['X'].copy()
|
||||
Xc = x._array - mean(x._array,0)[newaxis]
|
||||
Xc = x._array - x._array.mean(0)[newaxis]
|
||||
w_rot = B/Bnorm
|
||||
t_rot = dot(Xc, w_rot)
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ from scipy import zeros,zeros_like,sqrt,dot,trace,sign,round_,argmax,\
|
|||
sort,ravel,newaxis,asarray,diag,sum,outer,argsort,arange,ones_like,\
|
||||
all,apply_along_axis,eye,atleast_2d,empty
|
||||
from scipy.linalg import svd,inv,norm,det,sqrtm
|
||||
from scipy.stats import mean,median
|
||||
from scipy.stats import median
|
||||
|
||||
#import plots_lpls
|
||||
|
||||
|
@ -46,7 +46,7 @@ def hotelling(Pcv, P, p_center='med', cov_center='med',
|
|||
P_ctr = median(Pcv, 0)
|
||||
elif p_center=='mean':
|
||||
# fixme: mean is unstable
|
||||
P_ctr = mean(Pcv, 0)
|
||||
P_ctr = Pcv.mean(0)
|
||||
else: #use full
|
||||
P_ctr = P
|
||||
|
||||
|
@ -59,7 +59,7 @@ def hotelling(Pcv, P, p_center='med', cov_center='med',
|
|||
if cov_center == 'med':
|
||||
Cov = median(Cov_i, 0)
|
||||
else:
|
||||
Cov = mean(Cov_i, 0)
|
||||
Cov = Cov_i.mean(0)
|
||||
|
||||
reg_cov = (1. - alpha)*Cov_i + alpha*Cov
|
||||
for i in xrange(n):
|
||||
|
@ -428,7 +428,7 @@ def fdr(tsq, tsqp, loc_method='mean'):
|
|||
n_false[j,i] = (tsqp[:,i]>tsq[j]).sum()
|
||||
#cPickle.dump(n_false, open("/tmp/nfalse.dat_"+str(n), "w"))
|
||||
if loc_method=='mean':
|
||||
fp = mean(n_false,1)
|
||||
fp = n_false.mean(1)
|
||||
elif loc_method == 'median':
|
||||
fp = median(n_false.T)
|
||||
else:
|
||||
|
|
|
@ -3,7 +3,7 @@ from scipy import apply_along_axis,newaxis,zeros,\
|
|||
trace,zeros_like,sign,sort,real,argsort,rand,array,\
|
||||
matrix,nan
|
||||
from scipy.linalg import norm,svd,inv,eig
|
||||
from scipy.stats import median,mean
|
||||
from scipy.stats import median
|
||||
|
||||
def normalise(a, axis=0, return_scales=False):
|
||||
s = apply_along_axis(norm, axis, a)
|
||||
|
@ -99,11 +99,11 @@ def mat_center(X,axis=0,ret_mn=False):
|
|||
print "The X data needs to be two-dimensional"
|
||||
|
||||
if axis==0:
|
||||
mnX = mean(X,axis)[newaxis]
|
||||
mnX = X.mean(axis)[newaxis]
|
||||
Xs = X - mnX
|
||||
|
||||
elif axis==1:
|
||||
mnX = mean(X,axis)[newaxis]
|
||||
mnX = X.mean(axis)[newaxis]
|
||||
Xs = (X.T - mnX).T
|
||||
if ret_mn:
|
||||
return Xs,mnX
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""Matrix cross validation selection generators
|
||||
"""
|
||||
from scipy import take,arange,ceil,repeat,newaxis,mean,asarray,dot,ones,\
|
||||
from scipy import take,arange,ceil,repeat,newaxis,asarray,dot,ones,\
|
||||
random,array_split,floor,vstack,asarray,minimum
|
||||
from cx_utils import randperm
|
||||
|
||||
|
@ -188,7 +188,7 @@ def diag_pert(a, n_sets=10, center=True, index_out=False):
|
|||
nm=n*m
|
||||
start_inds = array_split(randperm(m),n_sets) # we use random start diags
|
||||
if center:
|
||||
a = a - mean(a, 0)[newaxis]
|
||||
a = a - a.mean(0)[newaxis]
|
||||
for v in range(n_sets):
|
||||
a_out = a.copy()
|
||||
out = []
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""This module implements some common validation schemes from pca and pls.
|
||||
"""
|
||||
from scipy import ones,mean,sqrt,dot,newaxis,zeros,sum,empty,\
|
||||
from scipy import ones,sqrt,dot,newaxis,zeros,sum,empty,\
|
||||
apply_along_axis,eye,kron,array,sort,zeros_like,argmax,atleast_2d
|
||||
from scipy.stats import median
|
||||
from scipy.linalg import triu,inv,svd,norm
|
||||
|
|
Reference in New Issue