A meta-estimator for this (generic to which classifier / clusterer) is coded up at https://github.com/scikit-learn/scikit-learn/issues/4543#issuecomment-91073246
We even have a pull request that made an example of this sort of thing at https://github.com/scikit-learn/scikit-learn/pull/6478, but the original contributor never responded to comments on it. If someone would like to make it more persuasive and complete it, ... On 13 March 2018 at 02:34, prince gosavi <princegosav...@gmail.com> wrote: > Hi, > Thank you for reply. > > I was exploring the possibility that given well formed KMean clusters > using an additional KNN we can simply increase the accuracy that the data > point enters the right cluster. > > Also I would like to know whether if it's possible to do such thing(out of > curiosity)? > > > On Mon, Mar 12, 2018 at 4:16 PM, Sebastian Raschka <se.rasc...@gmail.com> > wrote: > >> [image: Boxbe] <https://www.boxbe.com/overview> This message is eligible >> for Automatic Cleanup! (se.rasc...@gmail.com) Add cleanup rule >> <https://www.boxbe.com/popup?url=https%3A%2F%2Fwww.boxbe.com%2Fcleanup%3Fkey%3DUhIxNYq%252BiOO5xmIRDqLAN9uT8i2SvdGQD6ZmBAiV5Qw%253D%26token%3DwAP97NQM%252B2lQ3Y0OhtK0lH%252B9rcytbnIoOPwzoro3VRgCKwYCbmroH9dj%252FRj2KUu51cave7h8uL1DVdrHbDGKqrBg2crT4j1Zor03huy4A%252BrV5JVLofIOzldsuIvWL8BNAJt2H%252FOrHGc%253D&tc_serial=37421443999&tc_rand=1385488240&utm_source=stf&utm_medium=email&utm_campaign=ANNO_CLEANUP_ADD&utm_content=001> >> | More info >> <http://blog.boxbe.com/general/boxbe-automatic-cleanup?tc_serial=37421443999&tc_rand=1385488240&utm_source=stf&utm_medium=email&utm_campaign=ANNO_CLEANUP_ADD&utm_content=001> >> >> Hi, >> If you want to predict the Kmeans cluster membership, you can use Kmeans' >> predict method instead of training a KNN model on the cluster assignments. >> This will be computationally more efficient and give you the correct >> assignment at the borders between clusters. >> >> Best, >> Sebastian >> >> > On Mar 12, 2018, at 2:55 AM, prince gosavi <princegosav...@gmail.com> >> wrote: >> > >> > Hi, >> > I have generated clusters using the KMeans algorithm and would like to >> use the labels of the model in the KNN. >> > >> > I don't have the implementation idea but I can visualize it as >> > >> > KNNmodel = KNN.fit(X, KMeansModel.labels_) >> > >> > Such that the KNN will predict the cluster the new point belong to. >> > >> > -- >> > Regards >> > _______________________________________________ >> > scikit-learn mailing list >> > scikit-learn@python.org >> > https://mail.python.org/mailman/listinfo/scikit-learn >> >> _______________________________________________ >> scikit-learn mailing list >> scikit-learn@python.org >> https://mail.python.org/mailman/listinfo/scikit-learn >> >> > > > -- > Regards > > _______________________________________________ > scikit-learn mailing list > scikit-learn@python.org > https://mail.python.org/mailman/listinfo/scikit-learn > >
_______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn