2
私はScikitのLinearRegressionアルゴリズムに関するいくつかの問題を抱えています。私はフォーラムを巡り歩き、グーグルでたくさん出かけましたが、何らかの理由でエラーを回避できませんでした。私は、Python 3.5に以下Sklearn | LinearRegression |フィット
を使用しています、私がしようとしましたが、値のエラーを取得維持した内容です。「サンプルの一貫性のない数字で見つかり入力変数を:[403、174]」
X = df[["Impressions", "Clicks", "Eligible_Impressions", "Measureable_Impressions", "Viewable_Impressions"]].values
y = df["Total_Conversions"].values.reshape(-1,1)
print ("The shape of X is {}".format(X.shape))
print ("The shape of y is {}".format(y.shape))
The shape of X is (577, 5)
The shape of y is (577, 1)
X_train, y_train, X_test, y_test = train_test_split(X, y, test_size=0.3, random_state = 42)
linreg = LinearRegression()
linreg.fit(X_train, y_train)
y_pred = linreg.predict(X_test)
print (y_pred)
print ("The shape of X_train is {}".format(X_train.shape))
print ("The shape of y_train is {}".format(y_train.shape))
print ("The shape of X_test is {}".format(X_test.shape))
print ("The shape of y_test is {}".format(y_test.shape))
The shape of X_train is (403, 5)
The shape of y_train is (174, 5)
The shape of X_test is (403, 1)
The shape of y_test is (174, 1)
私が足りません何か明白な明白な何か?
ご協力いただければ幸いです。あなたの列車とテストはXとYのために異なる数の行が含まれているよう
種類よろしく、 エイドリアン
これが働いていました。それは愚かなものだと分かっていた。ありがとうBob – AdrianC