iT邦幫忙

0

#Python Unable to coerce to Series, length must be : given 問題

我程式遇到的問題是:
我有兩種選擇,一種是重新計算新的權重,一種是導入以計算過(訓練後的)權重
白話一點就是 兩種資料是同一型態,只是取得的方式是(1)計算or(2)導入
我遇到的問題目前就在導入資料時發生的錯誤

我試過了這兩個網站
1:https://stackoverflow.com/questions/29954263/what-does-the-term-broadcasting-mean-in-pandas-documentation?lq=1
這個以降pandas為解決方法,但會延伸出更多問題 而且感覺解決的方式不夠好 所以試過一次不行後就沒再繼續研究
2:https://stackoverflow.com/questions/29954263/what-does-the-term-broadcasting-mean-in-pandas-documentation?lq=1
上面這個,可以直接移至update那邊看 他的解決方式是加個.values

關鍵程式碼

def startTrainModel(self,trainX,trainY,alreadyTrainTheta):
        self.features_Number=trainX.shape[1]
        if(not alreadyTrainTheta):
            self.theta=self.initinitializedWeigth(self.features_Number)
        else:
            temptheta=loadData('theta.xlsx').values
            self.theta=np.asarray(temptheta,dtype='float64')

第一個if是從新訓練,第二個則是導入,且兩個都是同種的資料型態<numpy.ndarray>

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友回答

立即登入回答