回答編集履歴
1
追加
test
CHANGED
@@ -19,3 +19,17 @@
|
|
19
19
|
plt.show()
|
20
20
|
```
|
21
21
|

|
22
|
+
|
23
|
+
---
|
24
|
+
追加の情報を受けての結果です。
|
25
|
+
```Python
|
26
|
+
x = np.array([0.2, 0.3, 0.3, 0.4, 0.6])
|
27
|
+
y = np.array([2.171863648476775, 2.171863648476775, 2.171863648476775, 2.171863648476775, 3.7928153875935355])
|
28
|
+
lr = linear_model.LinearRegression(fit_intercept=False)
|
29
|
+
lr.fit(x.reshape(-1, 1), y)
|
30
|
+
plt.plot(np.append(0,x), np.append(0,lr.predict(x.reshape(-1, 1))))
|
31
|
+
plt.scatter(x, y)
|
32
|
+
plt.grid()
|
33
|
+
plt.show()
|
34
|
+
```
|
35
|
+

|