Hi, As it has been indicated by other members, methods such as ``LocalOutlierFactor`` do not expose a ``predict`` method by design.
However, if you nevertheless would still like to keep experimenting in the direction of attempting to make predictions on "unseen" data, you could simply create a sub-class with a ``predict()`` wrapper, as in: https://gist.github.com/hristog/b6151d21aa38a6c80d80d160b7771ce9 Hristo > On 10/06/2017 12:53 AM, Lifan Xu wrote: > >> Hi, >> >> I was trying to train a model for anomaly detection. I only have the >> normal data which are all labeled as 1. Here is my code: >> >> >> clf = sklearn.model_selection.GridSearchCV(sklearn.neighbors. >> LocalOutlierFactor(), >> parameters, >> scoring="accuracy", >> cv=kfold, >> n_jobs=10) >> clf.fit(vectors, labels) >> >> >> But it complains "AttributeError: 'LocalOutlierFactor' object has no >> attribute 'predict'". >> >> It looks like LocalOutlierFactor only has fit_predict(), but no >> predict(). >> >> My question is will predict() be implemented? >> >> >> Thanks! >> >> _______________________________________________ >> 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 >
_______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn