- Python資料科學自學聖經_碁峰(2022) | Ch8, Ch9
- 跨領域學Python_旗標(2020) | Ch8, Ch10, Ch11, Ch12
from sklearn.linear_model import LinearRegression
lm = LinearRegression()
lm.fit(df_X, df_y)
from sklearn.neighbors import KNeighborsClassifier
k = 1
knn = KNeighborsClassifier(n_neighbors=k)
knn.fit(X_train, y_train)
from sklearn.cluster import KMeans
k = 1
km = KMeans(n_clusters=k)
km.fit(df_X)
pip install six
from six import StringIO
- inputer
# old
from sklearn import preprocessing
imputer = preprocessing.Imputer()
# new
from sklearn.impute import SimpleImputer
imputer = SimpleImputer()