[scikit-learn] question for using GridSearchCV on LocalOutlierFactor

Andreas Mueller t3kcit at gmail.com
Mon Oct 9 03:58:39 EDT 2017


What are you trying to achieve with this code?
If you label everything as 1, the highest accuracy will be obtained if 
everything is labeled as 1.
So even if the interface was implemented, the result would not be helpful.


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 at python.org
> https://mail.python.org/mailman/listinfo/scikit-learn



More information about the scikit-learn mailing list