I have 100 two dimensional time series and I also have 1 (benchmark) time series of the same shape. I need to find k nearest neighbors of the benchmark. According to the documentation KNeighborsTimeSeries is unsupervised learning model. But it has fit methods which takes some training data (which is confusing for me, I thought that unsupervised models never have training data). What do I put to fit method to achieve my goal?

I'm not sure about the metric yet, but I believe it can be whatever. I can research and play around with different metrics later


1 Answer 1


Unsupervised Learning is a kind of learning where the model tries to find patterns in data without labels.

Supervised Learning is a kind of machine learning whose goal is to learn the relation between features and labels.

Hence, unsupervised models do have training data, only not labelled as in the supervised ones.

In your particular case the module kNeighborTimeSeries searches for time series neighbours of your training time series. e.g.

knn = KNeighborsTimeSeries(n_neighbors=1).fit(time_series)
  • $\begingroup$ In your example you specify the amount of neighbors needed (1) and the set of training series (time_series). In this case you get 1 neighbor of what exact time series (singular)? $\endgroup$ May 5, 2022 at 8:18
  • $\begingroup$ of the training one =) $\endgroup$
    – Oscar
    May 10, 2022 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.