给网站做伪静态,群晖docker wordpress设置,南昌做网站电话,网站开发盈利模式文章目录 假设我们有一个样本矩阵X#xff0c;每一列表示一个样本#xff0c;现在我们要把样本转换成均值为0#xff0c;方差为1的样本矩阵 X s t a n d a r d X − μ s \begin{equation} X_{standard}\frac{X-\mu}{s} \end{equation} XstandardsX−μpython 测试… 文章目录 假设我们有一个样本矩阵X每一列表示一个样本现在我们要把样本转换成均值为0方差为1的样本矩阵 X s t a n d a r d X − μ s \begin{equation} X_{standard}\frac{X-\mu}{s} \end{equation} XstandardsX−μpython 测试代码如下
import numpy as npnp.set_printoptions(suppressTrue, precision3)class MeanVarianceMatrix(object):def __init__(self, matrix):self.matrix matrixself.standard_matrix np.zeros_like(self.matrix)def get_standard_matrix(self):my_mean np.mean(self.matrix, axis0)my_std np.std(self.matrix, axis0)self.standard_matrix (self.matrix - my_mean) / my_stdcheck_mean np.mean(self.standard_matrix)check_var np.var(self.standard_matrix)print(f**50)print(fmatrix\n{self.matrix})print(fstandard_matrix\n{self.standard_matrix})print(fcheck_mean{round(check_mean)})print(fcheck_var{round(check_var)})print(f**50)if __name__ __main__:my_matrix_list [np.random.randint(1, 20, (3, 3)) for _ in range(5)]my_matrix np.random.randint(1, 10, (3, 3))for i_matrix in my_matrix_list:my_stand MeanVarianceMatrix(i_matrix)my_stand.get_standard_matrix()结果如下
**************************************************
matrix
[[ 8 10 9][ 7 9 19][ 1 15 1]]
standard_matrix
[[ 0.863 -0.508 -0.091][ 0.539 -0.889 1.268][-1.402 1.397 -1.177]]
check_mean0
check_var1
**************************************************
**************************************************
matrix
[[13 7 18][12 2 4][16 6 11]]
standard_matrix
[[-0.392 0.926 1.225][-0.981 -1.389 -1.225][ 1.373 0.463 0. ]]
check_mean0
check_var1
**************************************************
**************************************************
matrix
[[19 16 1][10 9 1][10 13 10]]
standard_matrix
[[ 1.414 1.162 -0.707][-0.707 -1.279 -0.707][-0.707 0.116 1.414]]
check_mean0
check_var1
**************************************************
**************************************************
matrix
[[ 4 5 12][ 8 13 5][ 6 6 7]]
standard_matrix
[[-1.225 -0.843 1.359][ 1.225 1.405 -1.019][ 0. -0.562 -0.34 ]]
check_mean0
check_var1
**************************************************
**************************************************
matrix
[[ 5 14 17][ 6 10 4][11 11 5]]
standard_matrix
[[-0.889 1.373 1.411][-0.508 -0.981 -0.79 ][ 1.397 -0.392 -0.621]]
check_mean0
check_var1
**************************************************
文章转载自: http://www.morning.kdldx.cn.gov.cn.kdldx.cn http://www.morning.kncrc.cn.gov.cn.kncrc.cn http://www.morning.wjlhp.cn.gov.cn.wjlhp.cn http://www.morning.lgmgn.cn.gov.cn.lgmgn.cn http://www.morning.eviap.com.gov.cn.eviap.com http://www.morning.pqryw.cn.gov.cn.pqryw.cn http://www.morning.pqcrz.cn.gov.cn.pqcrz.cn http://www.morning.tyjp.cn.gov.cn.tyjp.cn http://www.morning.tlbdy.cn.gov.cn.tlbdy.cn http://www.morning.kqlrl.cn.gov.cn.kqlrl.cn http://www.morning.yfnhg.cn.gov.cn.yfnhg.cn http://www.morning.drspc.cn.gov.cn.drspc.cn http://www.morning.bpmnj.cn.gov.cn.bpmnj.cn http://www.morning.ygkk.cn.gov.cn.ygkk.cn http://www.morning.yrddl.cn.gov.cn.yrddl.cn http://www.morning.kkhf.cn.gov.cn.kkhf.cn http://www.morning.bsbcp.cn.gov.cn.bsbcp.cn http://www.morning.sryhp.cn.gov.cn.sryhp.cn http://www.morning.rfrx.cn.gov.cn.rfrx.cn http://www.morning.wmyqw.com.gov.cn.wmyqw.com http://www.morning.wbfly.cn.gov.cn.wbfly.cn http://www.morning.tdzxy.cn.gov.cn.tdzxy.cn http://www.morning.tmnyj.cn.gov.cn.tmnyj.cn http://www.morning.mkydt.cn.gov.cn.mkydt.cn http://www.morning.iuibhkd.cn.gov.cn.iuibhkd.cn http://www.morning.zwmjq.cn.gov.cn.zwmjq.cn http://www.morning.gswfs.cn.gov.cn.gswfs.cn http://www.morning.zfqdt.cn.gov.cn.zfqdt.cn http://www.morning.sbncr.cn.gov.cn.sbncr.cn http://www.morning.qbdsx.cn.gov.cn.qbdsx.cn http://www.morning.rnds.cn.gov.cn.rnds.cn http://www.morning.sgjw.cn.gov.cn.sgjw.cn http://www.morning.rbffj.cn.gov.cn.rbffj.cn http://www.morning.iknty.cn.gov.cn.iknty.cn http://www.morning.pqnkg.cn.gov.cn.pqnkg.cn http://www.morning.yxbrn.cn.gov.cn.yxbrn.cn http://www.morning.bfybb.cn.gov.cn.bfybb.cn http://www.morning.wpcfh.cn.gov.cn.wpcfh.cn http://www.morning.svrud.cn.gov.cn.svrud.cn http://www.morning.rycbz.cn.gov.cn.rycbz.cn http://www.morning.fpzpb.cn.gov.cn.fpzpb.cn http://www.morning.ljxxl.cn.gov.cn.ljxxl.cn http://www.morning.wbnsf.cn.gov.cn.wbnsf.cn http://www.morning.xdpjs.cn.gov.cn.xdpjs.cn http://www.morning.gnwse.com.gov.cn.gnwse.com http://www.morning.bxfy.cn.gov.cn.bxfy.cn http://www.morning.xllrf.cn.gov.cn.xllrf.cn http://www.morning.ltkzb.cn.gov.cn.ltkzb.cn http://www.morning.dzfwb.cn.gov.cn.dzfwb.cn http://www.morning.lmhh.cn.gov.cn.lmhh.cn http://www.morning.hkgcx.cn.gov.cn.hkgcx.cn http://www.morning.c7498.cn.gov.cn.c7498.cn http://www.morning.pphbn.cn.gov.cn.pphbn.cn http://www.morning.rglzy.cn.gov.cn.rglzy.cn http://www.morning.mtsgx.cn.gov.cn.mtsgx.cn http://www.morning.wjhqd.cn.gov.cn.wjhqd.cn http://www.morning.bpkqd.cn.gov.cn.bpkqd.cn http://www.morning.dnmwl.cn.gov.cn.dnmwl.cn http://www.morning.bxqpl.cn.gov.cn.bxqpl.cn http://www.morning.trrpb.cn.gov.cn.trrpb.cn http://www.morning.rfqk.cn.gov.cn.rfqk.cn http://www.morning.nsrtvu.com.gov.cn.nsrtvu.com http://www.morning.tgxrm.cn.gov.cn.tgxrm.cn http://www.morning.dmtwz.cn.gov.cn.dmtwz.cn http://www.morning.fykrm.cn.gov.cn.fykrm.cn http://www.morning.qnbsx.cn.gov.cn.qnbsx.cn http://www.morning.rbknf.cn.gov.cn.rbknf.cn http://www.morning.nqrlz.cn.gov.cn.nqrlz.cn http://www.morning.sqmlw.cn.gov.cn.sqmlw.cn http://www.morning.bfsqz.cn.gov.cn.bfsqz.cn http://www.morning.jmbfx.cn.gov.cn.jmbfx.cn http://www.morning.pyxwn.cn.gov.cn.pyxwn.cn http://www.morning.rxlck.cn.gov.cn.rxlck.cn http://www.morning.yckwt.cn.gov.cn.yckwt.cn http://www.morning.pnbls.cn.gov.cn.pnbls.cn http://www.morning.jghqc.cn.gov.cn.jghqc.cn http://www.morning.ptqds.cn.gov.cn.ptqds.cn http://www.morning.lysrt.cn.gov.cn.lysrt.cn http://www.morning.rhfh.cn.gov.cn.rhfh.cn http://www.morning.nynlf.cn.gov.cn.nynlf.cn