Skip to content

Instantly share code, notes, and snippets.

@gavi
Created July 17, 2017 20:22
Show Gist options
  • Save gavi/0deabaacde665e73626634cefa482ba6 to your computer and use it in GitHub Desktop.
Save gavi/0deabaacde665e73626634cefa482ba6 to your computer and use it in GitHub Desktop.
Convert Scikit-Learn model to CoreML .mlmodel file
#Now lets export to .mlmodel format
import coremltools
coreml_model = coremltools.converters.sklearn.convert(clf,['Sepal.Length','Sepal.Width','Petal.Length','Petal.Width'],'Species')
coreml_model.author = 'Gavi Narra'
coreml_model.license = 'BSD'
coreml_model.short_description = 'Predicts the iris species provided the sepal length, sepal width, petal length and petal width.'
coreml_model.save('iris.mlmodel')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment