python關(guān)于矩陣重復(fù)賦值覆蓋問題的解決方法-創(chuàng)新互聯(lián)

本文實(shí)例講述了python關(guān)于矩陣重復(fù)賦值覆蓋問題的解決方法。分享給大家供大家參考,具體如下:

創(chuàng)新互聯(lián)主營團(tuán)風(fēng)網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營網(wǎng)站建設(shè)方案,APP應(yīng)用開發(fā),團(tuán)風(fēng)h5小程序開發(fā)搭建,團(tuán)風(fēng)網(wǎng)站營銷推廣歡迎團(tuán)風(fēng)等地區(qū)企業(yè)咨詢
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]))

分享標(biāo)題:python關(guān)于矩陣重復(fù)賦值覆蓋問題的解決方法-創(chuàng)新互聯(lián)
網(wǎng)頁URL:http://muchs.cn/article4/phjoe.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站內(nèi)鏈標(biāo)簽優(yōu)化、服務(wù)器托管企業(yè)網(wǎng)站制作、ChatGPT、定制開發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)