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

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

多元線性回歸和選擇列誤差

多元線性回歸和選擇列誤差

白板的微信 2021-06-30 17:51:38
我的問題是,當(dāng)我嘗試擬合模型時,出現(xiàn)此錯誤。我不知道是什么導(dǎo)致了這個錯誤,但可能自變量的選擇不正確。這是錯誤ValueError: Found input variables with inconsistent numbers of samples: [104, 26]這是我到目前為止構(gòu)建的代碼import pandas as pdimport numpy as npimport matplotlib.pyplot as pltfrom scipy import stats# Import Excel Filedata = pd.read_excel("C:\\Users\\AchourAh\\Desktop\\Multiple_Linear_Regression\\SP Level Reasons Excels\\SP00105485_PL22_AAB_05_09_2018_Reasons.xlsx",'Sheet1') #Import Excel file# Replace null values of the whole dataset with 0data1 = data.fillna(0)print(data1)# Extraction of the independent and dependent variableX = data1.iloc[0:len(data1),[0,1,2,3]].values.reshape(-1, 1) #Extract the column of the COPCOR SP we are going to check its impactY = data1.iloc[0:len(data1),4].values.reshape(-1, 1) #Extract the column of the PAUS SPprint(X)print(Y)# Importingfrom sklearn.linear_model import LinearRegressionfrom sklearn import model_selection# Fitting a Linear Modellm = LinearRegression() #create an lm object of LinearRegression Classlm.fit(X, Y)plt.scatter(X, Y, color = 'red')#plots scatter graph of COP COR against PAUS for values in X_train and y_trainplt.plot(X, lm.predict(X), color = 'blue')#plots the graph of predicted PAUS against COP COR.plt.title('SP000905974')plt.xlabel('COP COR Quantity')plt.ylabel('PAUS Quantity')plt.show()#Show the graph我的 excel 文件的第一列包含自變量,第四列包含因變量。我有另一個簡單線性回歸的代碼,它工作正常,但是當(dāng)我嘗試應(yīng)用多元線性回歸時,我只是改變了這條線,但我沒有做錯什么。  X = data1.iloc[0:len(data1),[0,1,2,3]].values.reshape(-1, 1)注意,我是這個的初學(xué)者。
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 179 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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