Skip to main content

About

Deployment, Prediction, and Management API interactions of TeachableHub Machine-Learning Deployment Platform via Python.

Usage

Deploy a model

You can integrate this SDK in your training logic, Jupyter notebook during experimentation, or your CI/CD system during the production environment. This SDK is also applicable for deploying existing models from your model registry or storage.

from teachablehub.deployments.sklearn import TeachableDeployment

# ... training logic here ...

deployment = TeachableDeployment(
    teachable="user/teachable",
    environment="production",
    deploy_key="your-deploy-key-here",
)

deployment.model(clf)
deployment.deploy(
    summary="Automatic deployment from our CI via sklearn-deploy.py",
    activate=True
)

Other deployment examples

We have prepared a couple of simple and advanced examples to show you some standard ways to integrate the TeachableHub platform very easily inside your training process. Also, there are ideas on how you can deploy your already trained and stored models to TeachableHub.

In the advanced examples, you will find some excellent tips and tricks on sharing knowledge between the training environment and the deployments via the Context API or creating and enforcing Features Schema with Validation to make your Model Serving API more understandable and secure.

Take a look at the examples here:

Make predictions

Simple ndarray predictions

from teachablehub.clients import TeachableHubPredictAPI

teachable = TeachableHubPredictAPI(
    teachable="user/teachable",
    environment="production",
    serving_key="your-serving-key-here"
)

predictions = teachable.predict([[0.03, 0.05, -0.002, -0.01, 0.04, 0.01, 0.08, -0.04, 0.005, -0.1]])
print(predictions)

Advanced predictions with Features Validation

from teachablehub.clients import TeachableHubPredictAPI

teachable = TeachableHubPredictAPI(
    teachable="user/teachable",
    environment="production",
    serving_key="your-serving-key-here"
)

features = {
    "age": 0.03,
    "sex": 0.05,
    "bmi": -0.002,
    "bp": -0.01,
    "s1": 0.04,
    "s2": 0.01,
    "s3": 0.08,
    "s4": -0.04,
    "s5": 0.005,
    "s6": -0.1
}

predictions = teachable.predict(features, order='desc', limit=10, threshold=0.5)
print(predictions)

Supported Tools & Frameworks

Requirements

  • Python 3.7.7+ (probably could work with Python 3.4+ as well.)
  • Create a teachable here: https://app.teachablehub.com/create
  • Create a deploy key here: https://app.teachablehub.com/<user>/<teachable>/settings/deploy-keys
  • Create a Serving key here: https://app.teachablehub.com/<user>/<teachable>/settings/serving-keys

Installation

from source

git clone https://github.com/teachablehub/python-sdk.git
cd python-sdk
python setup.py install

with pip

pip install teachablehub

Contributing

Thanks for looking at this section. We're open to any cool ideas, so if you have one and are willing to share - fork the repo, apply changes and open a pull request. :)

Copyright

Copyright (c) 2021 CloudStrap AD. See LICENSE for further details.

Release files for teachablehub 1.0.40

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for teachablehub 1.0.40
File Size Uploaded
teachablehub-1.0.40.tar.gz 10.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for teachablehub 1.0.40
File Interpreter ABI Platform
teachablehub-1.0.40-py3-none-any.whl Python 3 none any Details

Total release size: 22.6 kB

Release files / teachablehub-1.0.40.tar.gz

Download URL teachablehub-1.0.40.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0f555297e2fd73b8ec8466cae8cc055288a54c332dce782605636c687cf0827b
BLAKE2b-256 checksum
How to use checksums
c693e411b3b981a46d835f312b1ad4e2d6a2ba14a2ef2727afb68d2820ddb566
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.7

Release files / teachablehub-1.0.40-py3-none-any.whl

Download URL teachablehub-1.0.40-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8005e909d25a1cf98108cb1b6de9cd01edc4d298900966ade6b4425a202464b9
BLAKE2b-256 checksum
How to use checksums
1abe973c0276b9e5918d6dd69c2680f4dfb2adbc91f0470ab4425cde64343a3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.7

Release history Release notifications | RSS feed

This release

1.0.40 This release

2 release files

1.0.39

2 release files

1.0.38

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page