Skip to main content

TeachableHub Machine Learning Platform SDK. Deployments, Predictions, and Management.

Project description

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.

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

teachablehub-1.0.37.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

teachablehub-1.0.37-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file teachablehub-1.0.37.tar.gz.

File metadata

  • Download URL: teachablehub-1.0.37.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for teachablehub-1.0.37.tar.gz
Algorithm Hash digest
SHA256 e3e31e6eb7cf25d8df011e0f30f55268af530d380cc76bc9af56dbf0948adb66
MD5 9c8f8e3eff4a0071e17e4e42144fea19
BLAKE2b-256 c79d0e02179a39d2f72fe8526c3d4fd2c3074e1f176991b18cd596e0097345b9

See more details on using hashes here.

File details

Details for the file teachablehub-1.0.37-py3-none-any.whl.

File metadata

  • Download URL: teachablehub-1.0.37-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for teachablehub-1.0.37-py3-none-any.whl
Algorithm Hash digest
SHA256 cf0606fd98701e4d63e94694a6c096175c3b888180d0a1a3f7b46c01db455106
MD5 c66fb2f287f9290ffa46dce3b0488a2d
BLAKE2b-256 fb6b6fe45434459e0969de745c1900feedcf66850931cc89a7a6bb8c70ae8617

See more details on using hashes here.

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