python关于矩阵重复赋值覆盖问题的解决方法-创新互联-成都快上网建站

python关于矩阵重复赋值覆盖问题的解决方法-创新互联

本文实例讲述了python关于矩阵重复赋值覆盖问题的解决方法。分享给大家供大家参考,具体如下:

创新互联主营团风网站建设的网络公司,主营网站建设方案,APP应用开发,团风h5小程序开发搭建,团风网站营销推广欢迎团风等地区企业咨询
import itertools
import numpy as np
comb = list(itertools.combinations(list(range(regions)), 2))
bands_info = []
coeff = np.zeros([bands, len(comb)])
for cla in range(classes):
  class_info = data[:,cla*bands*regions:(cla+1)*bands*regions]
  for bs in range(bands):
    n = bs*regions
    for i in range(len(comb)):
      index1 = comb[i][0]+n
      index2 = comb[i][1]+n
      part1 = class_info[:, index1]
      part2 = class_info[:, index2]
      coeff[bs, i] = (np.corrcoef(part1, part2))[0, 1]
  bands_info.append(coeff.reshape([1,-1]))
coeff_info = np.vstack((bands_info[0], bands_info[1], bands_info[2],bands_info[3]))


网页名称:python关于矩阵重复赋值覆盖问题的解决方法-创新互联
URL标题:http://kswjz.com/article/phjoe.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流