1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # # µû¶óÇÏ¸ç ¹è¿ì´Â ÆÄÀ̽ã°ú µ¥ÀÌÅÍ°úÇÐ(»ý´ÉÃâÆÇ»ç 2020) # LAB 14-1 Å°°¡ ºñ½ÁÇصµ ³²,³àÀÇ ¸ö¹«°Ô´Â ´Ù¸¦ °Í : ´ÙÂ÷¿ø ¼±Çüȸ±Í, 376ÂÊ # import numpy as np from sklearn import linear_model regr = linear_model.LinearRegression() # ³²ÀÚ´Â 0, ¿©ÀÚ´Â 1À» ³Ö¾î Â÷¿øÀ» Ãß°¡ÇÏ¿´À½ # ÀԷµ¥ÀÌÅ͸¦ 2Â÷¿øÀ¸·Î ¸¸µé¾î¾ß ÇÔ X = [[164, 1],[167, 1],[165, 0],[170, 0],[179, 0],[163, 1],[159, 0],[166, 1]] y = [43, 48, 47, 66, 67, 50, 52, 44] # y °ªÀº 1Â÷¿ø µ¥ÀÌÅÍ regr.fit(X, y) # ÇнÀ print('°è¼ö :', regr.coef_ ) print('ÀýÆí :', regr.intercept_) print('Á¡¼ö :', regr.score(X, y)) print('ÀºÁö¿Í µ¿¹ÎÀÌÀÇ ÃßÁ¤ ¸ö¹«°Ô :', regr.predict([[166, 1], [166, 0]])) | cs |