第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

預(yù)期的二維數(shù)組,得到一維數(shù)組

預(yù)期的二維數(shù)組,得到一維數(shù)組

白衣非少年 2021-12-17 14:35:11
我正在從 github 運(yùn)行以下代碼,但出現(xiàn)錯(cuò)誤。怎么了?https://github.com/susanli2016/Machine-Learning-with-Python/blob/master/Time%20Series%20ANN%20%26%20LSTM%20VIX.ipynb細(xì)胞:# scale train and test data to [-1, 1]scaler = MinMaxScaler(feature_range=(-1, 1))train_sc = scaler.fit_transform(train)test_sc = scaler.transform(test)錯(cuò)誤:ValueError: Expected 2D array, got 1D array instead:array=[17.24     18.190001 19.219999 ... 10.47     10.18     11.04    ].Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.
查看完整描述

2 回答

?
月關(guān)寶盒

TA貢獻(xiàn)1772條經(jīng)驗(yàn) 獲得超5個(gè)贊

制作那個(gè)筆記本的人使用的是一個(gè)非常舊版本的sklearn. 簡(jiǎn)而言之,您的特征具有形式[row_1, row_2...row_n],而它們本應(yīng)具有形式[[row_1], [row_2]...[row_n]]。


因此,使用這個(gè):


new_shape = (len(train), 1)


train_sc = scaler.fit_transform(np.reshape(train, new_shape))

test_sc = scaler.transform(np.reshape(test, new_shape))


查看完整回答
反對(duì) 回復(fù) 2021-12-17
?
泛舟湖上清波郎朗

TA貢獻(xiàn)1818條經(jīng)驗(yàn) 獲得超3個(gè)贊

解決了添加以下方法的問題,這些方法顯然將訓(xùn)練和測(cè)試對(duì)象轉(zhuǎn)換為 numpy 數(shù)組。那是對(duì)的嗎?


scaler = MinMaxScaler(feature_range=(-1, 1))

train_sc = scaler.fit_transform(train.values.reshape(-1, 1))

test_sc = scaler.transform(test.values.reshape(-1,1))


查看完整回答
反對(duì) 回復(fù) 2021-12-17
  • 2 回答
  • 0 關(guān)注
  • 189 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)