Goodmorning everyone, I'm stuck on a ml code, that's asking to apply linear regression on the clusters obtained on a certain dataset (including vectors of features). After datas pre-processing I proceeded with the following for clustering:
from sklearn import metrics
from sklearn.cluster import KMeans
kmeans = KMeans(n_clusters=5, n_init=10, random_state=numero_di_matricola)
kmeans.fit(Xtrain_and_val_scaled)
Since it was required 5 clusters. Now I have to apply linear regression to each one of these and then compute the error (1 - R^2) on the data not used to learn the models (or better, the test set). I can't find any help around, any suggestion?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…