Skip to main content

An easy-to-use library for training personalized AI models

Project description

Personal Trainer

Personal Trainer is a Python library for easily training models on your own data using open source models.

Personal Trainer is still under development.

Usage

Each type of model is represented by a class in Personal Trainer. For example, one of the simplest models to use is a TextClassifier.

from personal_trainer import TextClassifier

classifier = TextClassifier()

A text classifier takes some text and returns whether it's thing A or thing B. To train the model you first construct a series of examples of text and how it should be classified. You can then pass those examples to the train method of the classifier.

examples = [
        ('oscar meyer', 'hot dog'),
        ('choripan', 'hot dog'),
        ('bratwurst', 'hot dog'),
        ('vienna sausage', 'hot dog'),
        ('sandwich', 'not'),
        ('burger', 'not'),
        ('dumpling', 'not'),
        ('bun', 'not'),
]

classifier.train(examples)

Once you've trained your model you can then use it. For a classifier that means calling the classify method.

res = classifier.classify('taco')
print('res:', res)

If training was successful res should be not. A classifier output can be any string, integer, or Boolean.

To save your model for later use using the save method. This writes the model out to the path that you provide.

classifier.save('hot-dog-or-not.model')

To load the model later, provide the same path when constructing the classifier.

classifier = TextClassifier('hot-dog-or-not.model')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

model_personal_trainer-0.1.0.tar.gz (4.9 kB view hashes)

Uploaded Source

Built Distribution

model_personal_trainer-0.1.0-py3-none-any.whl (6.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page