Skip to main content

export linear models from scikit-learn to diagonal.sh

Project description

diagonalpy

diagonalpy is a Python library for exporting scikit-learn linear models to the inference platform diagonal.sh

Features

  • Export scikit-learn linear models the diagonal.sh inference platform
  • Delete models deployed on the diagonal.sh inference platform

Installation

Currently, diagonalpy is available for Python 3.9, 3.10, 3.11 and 3.12. Support for 3.13 will be added as soon as dependencies allow it.

pip install diagonalpy

torch is a dependency of diagonalpy, so if it isn't installed in the installation environment, you'll also have to run

pip install torch

Quick Start

Export a Model

import numpy as np
from sklearn.linear_model import LinearRegression
from diagonalpy.export import export

# Train a scikit-learn model
model = LinearRegression()
X = np.random.randn(100, 10)
y = np.sum(X, axis=1) + np.random.randn(100)
model.fit(X, y)

# Export the model
export(model, "my-wonderful-model")

Delete a deployed model

from diagonalpy.delete import delete

delete("model-id-from-export")

Supported Models

Regression Models:

  • LinearRegression
  • Ridge
  • RidgeCV
  • Lasso
  • LassoCV
  • ElasticNet
  • ElasticNetCV
  • Lars
  • LarsCV
  • LassoLars
  • LassoLarsCV
  • LassoLarsIC
  • OrthogonalMatchingPursuit
  • OrthogonalMatchingPursuitCV
  • BayesianRidge
  • ARDRegression
  • HuberRegressor
  • QuantileRegressor
  • TheilSenRegressor
  • TweedieRegressor

Classification Models

  • LogisticRegression
  • LogisticRegressionCV
  • SGDClassifier
  • Perceptron
  • PassiveAggressiveClassifier
  • RidgeClassifier
  • RidgeClassifierCV

Environment Variables

DIAGONALSH_API_KEY: Your Diagonal.sh API key (required)

DIAGONALSH_REGION: AWS region for deployment (required) - currently, only "eu-west-3" is valid

Environment Setup

export DIAGONALSH_API_KEY="your_api_key"
export DIAGONALSH_REGION="your_aws_region"

License

This package is distributed under CC BY-ND license, which allows commercial use of the unmodified software and prohibits the distribution of any modifications of this software.

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

diagonalpy-0.1.2.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

diagonalpy-0.1.2-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file diagonalpy-0.1.2.tar.gz.

File metadata

  • Download URL: diagonalpy-0.1.2.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.12.7 Darwin/22.6.0

File hashes

Hashes for diagonalpy-0.1.2.tar.gz
Algorithm Hash digest
SHA256 3f1abff28a31437dbcb86d52d8c561e443bd06a5a6ddec2839200e97687e8c44
MD5 670d18b0bb5d5fea335b8dbaa3bd4e03
BLAKE2b-256 29ef191450f30161c6044e68d51c69758b1562760ce46e62db2b933105921499

See more details on using hashes here.

File details

Details for the file diagonalpy-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: diagonalpy-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.12.7 Darwin/22.6.0

File hashes

Hashes for diagonalpy-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 478c4f99c3b0700a14582a480d3c777a8fea75223aeee6c762a029e423aa9130
MD5 71dfa3446465d2582acb37780bb375a5
BLAKE2b-256 b4c9841a1da3d7d71d655b2fa08ee6657c7c5444cb45c1761ce5787d5583589f

See more details on using hashes here.

Supported by

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