Á¤¼ºÈÆ
    code_14_13.py (±³Àç)
  http://itsys.hansung.ac.kr/cgi-bin/onlineTest/viewpy4AI/onlinePy4AI.cgi?source=src/py/Ch14/code_14_13.py



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#
# µû¶óÇϸ砹è¿ì´Â ÆÄÀ̽ã°ú µ¥ÀÌÅÍ°úÇÐ(»ý´ÉÃâÆÇ»ç 2020)
# 14.13 ¾Ë°í¸®ÁòÀÌ °¡Áö´Â ¿ÀÂ÷, 383ÂÊ
#
from sklearn import datasets 
from sklearn import linear_model 
import numpy as np 
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
from sklearn.metrics import mean_squared_error
 
# ´ç´¢º´ µ¥ÀÌÅÍ ¼¼Æ®¸¦ sklearnÀÇ µ¥ÀÌÅÍÁýÇÕÀ¸·ÎºÎÅÍ ÀоîµéÀδÙ. 
diabetes = datasets.load_diabetes()
regr = linear_model.LinearRegression() 
 
X_train, X_test, y_train, y_test = train_test_split(diabetes.data, diabetes.target,
                                                    test_size = 0.2
regr.fit(X_train, y_train)
y_pred = regr.predict(X_test)
plt.scatter(y_pred, y_test)
# Æò±Õ Á¦°ö ¿ÀÂ÷¸¦ ±¸Çϴ ÇÔ¼ö
print('Mean squared error:', mean_squared_error(y_test, y_pred))
 
#plt.scatter(y_pred, y_test,  color='black')
 
= np.linspace(0330100)  # Æ¯Á¤ ±¸°£ÀÇ Á¡ 
plt.plot(x, x, linewidth=3, color='blue')
plt.show()
cs

  µî·ÏÀÏ : 2022-12-06 [02:08] Á¶È¸ : 177 ´Ù¿î : 0   
 
¡â ÀÌÀü±Ûcode_14_16.py (±³Àç)
¡ä ´ÙÀ½±Ûlab_14_2.py (±³Àç)
Python for AI ½Ç½À°Ô½ÃÆÇ
¹øÈ£ ¨Ï Á¦ ¸ñ Á¶È¸ µî·ÏÀÏ
lAnaconda3 ¼³Ä¡
lColabTurtlePlus
l½Ç½À ¸ñ·Ï
lColab ½Ç½À
l½Ç½À ½Ã ÇлýµéÀÌ ÀÚÁÖÇÏ´Â ½Ç¼ö ¿¹µé
360    ¦¦❷ lcode_14_22_1.py (±³Àç) 234 12-06
359 ¦¦❶ lcode_14_20.py (±³Àç) 208 12-06
358 ¦¦❶ lcode_14_19.py (±³Àç) 167 12-06
357 ¦¦❶ lcode_14_18.py (±³Àç) 184 12-06
356 ¦¦❶ lcode_14_17.py (±³Àç) 190 12-06
355 ¦¦❶ lcode_14_16.py (±³Àç) 178 12-06
354 ¦¦❶ lcode_14_13.py (±³Àç) 177 12-06
353 ¦¦❶ llab_14_2.py (±³Àç) 220 12-06
352 ¦¦❶ lcode_14_12.py (±³Àç) 209 12-06
351 ¦¦❶ lcode_14_10_2.py (±³Àç) 174 12-06
350 ¦¦❶ lcode_14_10_1.py (±³Àç) 185 12-06
349 ¦¦❶ lcode_14_9.py (±³Àç) 191 12-06
348 ¦¦❶ llab_14_1.py (±³Àç) 188 12-06
347 ¦¦❶ lcode_14_8.py (±³Àç) 204 12-06
346 ¦¦❶ lcode_14_7.py (±³Àç) 217 12-06
345 (13Àå) ½Ã°¢ Á¤º¸¸¦ ´Ù·ç¾îº¸ÀÚ 360 02-19
344 ¦¦❶ lch13.ipynb (¿¹Á¦ Àüü) 437 03-01
343 (12Àå) ÆÇ´Ù½º·Î µ¥ÀÌÅ͸¦ ºÐ¼®Çغ¸ÀÚ 557 02-19
342 ¦¦❶ lch12.ipynb (¿¹Á¦ Àüü) 504 03-01
341 ¦¦❶ lcode_12_23.py (±³Àç) 387 02-21

[1][2][3][4][5][6][7][8][9][10]-[Next][19]