1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # # µû¶óÇÏ¸ç ¹è¿ì´Â ÆÄÀ̽ã°ú µ¥ÀÌÅÍ°úÇÐ(»ý´ÉÃâÆÇ»ç 2020) # 14.12 ´ç´¢º´ ¿¹Á¦¸¦ ÇнÀ µ¥ÀÌÅÍ¿Í Å×½ºÆ® µ¥ÀÌÅÍ·Î ±¸ºÐÇÏÀÚ, 381ÂÊ # from sklearn import datasets from sklearn import linear_model import numpy as np from sklearn.model_selection import train_test_split # ´ç´¢º´ µ¥ÀÌÅÍ ¼¼Æ®¸¦ 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) print(y_pred) print(y_test) | cs |