sklearn.model_selection.validation_curve to determine $k$ for my $k$-means clustering. For inputs, the
y parameter is optional, which makes sense for unsupervised learning.
y : array-like, optional, default: None
The target variable to try to predict in the case of supervised learning.
So, I just pass
train_scores, test_scores = validation_curve(KMeans(), X=X, y=None, param_name='n_clusters', param_range=k_range, cv=10, n_jobs=3, verbose=2)
The function still returns
test_scores. I'm having trouble wrapping my mind around this in an unsupervised learning context - my 10 fold CV for each value of $k$ will produce training vs. test folds, but what are the use of these folds if there is no "correct" answer? I get something like below if I plot both train & test, and arguably they're both indicating different $k$ at the elbow.
- If there's no "correct" answer on which to validate in unsupervised learning, what is the use of test scores?
- If there is a use to test scores, which would be more appropriate to use for choosing optimal $k$ via the elbow method - the train or test scores, and why?