Skip to main content

Use microclassifiers in the cloud for spam detection, sentiment analysis and more.

Project description

Classr SDK for Python

Use microclassifiers in the cloud for spam detection, sentiment analysis and more.

Classr logo

Requirements

  • Python 3.6 or newer

Installation

The Classr SDK for Python can be installed using pip:

pip install classr

Usage

Initiaize your microclassifier by passing its UUID to the Classr constructor like so:

from classr import Classr

# Initialize cloud microclassifier.
classifier = Classr('acd78708-850b-4cea-aeaa-23cec50d13b6')

Now, call the classify or get_info functions of classifier to make use of it:

# Classify unseen input.
document = input('Enter your input: ')
print(f'Predicted class: {classifier.classify(document)}')

# Print macro F1 score of classifier.
info = classifier.get_info()
print(f'Classifier macro F1 score is: {info.f1_score}')

If you'd like to use a self-hosted deployment of the Classr application (i.e. not the default official API), you can pass a different base URL when constructing your Classr object:

from classr import Classr

# Initialize cloud microclassifier.
classifier = Classr('acd78708-850b-4cea-aeaa-23cec50d13b6', 'https://self-hosted-classr.example.com/')

Related Projects

This SDK is for the official Classr application (but will work with a self-hosted deployment too, of course).

License

MIT © lambdacasserole.

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

classr-2.0.0.tar.gz (4.0 kB view hashes)

Uploaded Source

Built Distribution

classr-2.0.0-py3-none-any.whl (4.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