apple / turicreate

Turi Create simplifies the development of custom machine learning models.
BSD 3-Clause "New" or "Revised" License
11.19k stars 1.14k forks source link

'NearestNeighborClassifier' object has no attribute 'export_coreml' #32

Open johnlev opened 6 years ago

johnlev commented 6 years ago

I created a KNN model which works well, but the export_coreml function seems missing! Am I misunderstanding? Are KNN models not exportable?

gustavla commented 6 years ago

Thanks for trying out the KNN and letting us know that you're interested in exporting it to Core ML! Unfortunately, the KNN model is currently not supported in Core ML. I think that's currently the only classifier that is not supported, so hopefully you can find another model that suits your needs.

If you let us know what kind of model you are building, we might be able to give you a suggestion for another classifier that does support Core ML deployment.

srikris commented 6 years ago

Thanks for trying out Turi Create. We will be working hard to make sure everything can be deployed. Currently, the list of deployable models are: https://apple.github.io/turicreate/docs/userguide/deployment/introduction.html

Could share with us what the distance function you are using? Is it the default one? That would really help us.

johnlev commented 6 years ago

I was using the default one, yes

rringham commented 5 years ago

Is there any plan to make this exportable? Disappointed that it's not currently - would be extremely interested in having this exportable to CoreML - would also be good if the documentation clearly indicated this type of model isn't exportable.

johnlev commented 5 years ago

I understand why it is currently not supported. KNN is a method of classification that requires packing ALL (or most) of the training data into the model so inputs can be compared to the stored information. This makes it possibly the most heavy weight ML models out there, and it’s results can still be matched using Gaussian Bayesian classifiers, SVMs, and more. I would understand if Apple was not interested in exporting a model that might be larger than the destination app itself when a smaller model can be achieved using another method with just as accurate results (in most cases).

Thanks for all the help, but unless it is an intended upgrade for the future we can close this.

triztian commented 3 years ago

I just ran into this issue, from looking at the documentation I thought it'd be possible to use turicreate to train and export the model, considering that it is listed in the docs:

I think it should be added as it'd make the ML toolset much more complete. I initially chose KNN because I have a relative small dataset. I tried first training KNN using SKLearn and using coremltools 4.0 to convert it to CoreML but the *.mlmodel was invalid. Failing that I tried to use turicreate directly to create the KNN model but seems like that might not be an option either.