質問編集履歴
1
エラーを修正しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -37,10 +37,10 @@
|
|
37
37
|
描画のコードは下記ですが、このコードでなくても、上記の結果が画像のようなグラフで表示したいと思っています。
|
38
38
|
|
39
39
|
# 描画
|
40
|
-
y_train_predict_std = model.predict((train_query_x)
|
40
|
+
y_train_predict_std = model.predict((train_query_x))
|
41
|
-
y_train_predict = pd.DataFrame(
|
41
|
+
y_train_predict = pd.DataFrame(scaler_y.inverse_transform(y_train_predict_std))
|
42
42
|
y_train_predict.columns = ["SALES_PREDICT"]
|
43
|
-
plotMin =
|
43
|
+
plotMin = train_query_y.min() - ( y_train.max() - y_train.min() ) * 0.1
|
44
44
|
plotMax = y_train.max() + ( y_train.max() - y_train.min() ) * 0.1
|
45
45
|
tmp = pd.merge( y_train.reset_index(), y_train_predict, left_index=True ,right_index=True )[["num_orders","SALES_PREDICT"]]
|
46
46
|
sns.scatterplot( x="num_orders", y="SALES_PREDICT", data=tmp )
|
@@ -51,8 +51,18 @@
|
|
51
51
|
|
52
52
|
エラーコードは下記のとおりです。
|
53
53
|
```python
|
54
|
+
-------------------------------------------------------
|
55
|
+
LinearRegression(copy_X=True, fit_intercept=True, n_jobs=None, normalize=False)
|
56
|
+
R2 SCORE: TRAIN:0.5284165822957549
|
57
|
+
-------------------------------------------------------
|
58
|
+
---------------------------------------------------------------------------
|
59
|
+
NameError Traceback (most recent call last)
|
54
|
-
|
60
|
+
<ipython-input-417-7134a9c14592> in <module>()
|
61
|
+
14 # 描画
|
62
|
+
15 y_train_predict_std = model.predict((train_query_x))
|
55
|
-
|
63
|
+
---> 16 y_train_predict = pd.DataFrame(scaler_y.inverse_transform(y_train_predict_std))
|
56
|
-
|
64
|
+
17 y_train_predict.columns = ["SALES_PREDICT"]
|
65
|
+
18 plotMin = train_query_y.min() - ( y_train.max() - y_train.min() ) * 0.1
|
66
|
+
|
57
|
-
|
67
|
+
NameError: name 'scaler_y' is not defined
|
58
68
|
```
|