Skip to content

Instantly share code, notes, and snippets.

@wrobstory
Created June 6, 2017 17:11
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wrobstory/68e3660a7e84ebc397ce8c7e3e384e45 to your computer and use it in GitHub Desktop.
Save wrobstory/68e3660a7e84ebc397ce8c7e3e384e45 to your computer and use it in GitHub Desktop.
CoreML Serialization
In [1]: %paste
from sklearn.datasets import load_iris
from sklearn import tree
import coremltools
iris = load_iris()
clf = tree.DecisionTreeClassifier()
clf = clf.fit(iris.data, iris.target)
## -- End pasted text --
In [2]: coremltools.converters.sklearn.convert(clf)
Out[2]:
input {
name: "input"
type {
multiArrayType {
shape: 4
}
}
}
output {
name: "classLabel"
type {
int64Type {
}
}
}
output {
name: "classProbability"
type {
dictionaryType {
int64KeyType {
}
}
}
}
predictedFeatureName: "classLabel"
predictedProbabilitiesName: "classProbability"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment