Skip to content

Instantly share code, notes, and snippets.

@oem
Last active July 4, 2018 09:22
Show Gist options
  • Save oem/82631d970c4a955e95775b3cbc1a264f to your computer and use it in GitHub Desktop.
Save oem/82631d970c4a955e95775b3cbc1a264f to your computer and use it in GitHub Desktop.
trains the beer classifier
import turicreate as tc
import os
current_dir = os.path.dirname(__file__)
data = tc.SFrame(os.path.join(current_dir, 'data/processed/beers.sframe'))
train, test = data.random_split(0.8)
model = tc.image_classifier.create(train, target='label', max_iterations=100)
# evaluate on test data
print(model.evaluate(test))
# persist the model
model.export_coreml(os.path.join(
current_dir, 'model/BeerClassifier.mlmodel'))
model.save(os.path.join(current_dir, 'model/v1.model'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment