Skip to main content

Coverage Status tests PyPI version Code style: black

Mobagel decanter ai sdk

Decanter AI is a powerful AutoML tool which enables everyone to build ML models and make predictions without data science background. With Decanter AI SDK, you can integrate Decanter AI into your application more easily with Python.

It supports actions such as data uploading, model training, and prediction to run in a more efficient way and access results more easily.

To know more about Decanter AI and how you can be benefited with AutoML, visit MoBagel website and contact us to try it out!

How it works

  • Upload train and test files in both csv and pandas dataframe.
  • Setup different standards and conduct customized experiments on uploaded data.
  • Use different models to run predictions
  • Get predict data in pandas dataframe form.

Requirements

Usage

Installation

pip install decanter-ai-sdk

Constructor

To use this sdk, you must first construct a client object.

from decanter_ai_sdk.client import Client
    client = Client(
        auth_key="auth_API_key",
        project_id="project_id",
        host="host_url",
    )

Upload

After the client is constructed, now you can use it to upload your training and testing files in both csv and pandas dataframe. This function will return uploaded data id in Decanter server.

import os
sys.path.append("..")

current_path = os.path.dirname(os.path.abspath(__file__))
train_file_path = os.path.join(current_path, "ts_train.csv")
train_file = open(train_file_path, "rb")
train_id = client.upload(train_file, "train_file")

upload your pandas dataframe

import io
import pandas as pd

df_train = pd.read_csv("./yourpath/train.csv")

csv_file = io.BytesIO()
df_train.to_csv(csv_file, index=False)
csv_file.seek(0)  
train_table_id = client.upload(csv_file, 'train_file')

Experiment

To conduct an experiment, you need to first specify which type of data you are going to use , i.e., iid or ts, then you can input parameters by following our pyhint to customize your experiment. After the experiment, the function will return an object which you can get experiment attributes from it.

# Training iid data
experiment = client.train_iid(
    experiment_name=exp_name,
    experiment_table_id=train_id,
    target="Survived",
    evaluator=ClassificationMetric.AUC,
    custom_column_types={
        "Pclass": DataType.categorical,
        "Parch": DataType.categorical,
    },
)
# Training ts data
experiment = client.train_ts(
    experiment_name=exp_name,
    experiment_table_id=train_id,
    target="Passengers",
    datetime="Month",
    time_groups=[],
    timeunit=TimeUnit.month,
    groupby_method="sum",
    evaluator=RegressionMetric.MAPE,
    custom_column_types={"Pclass": DataType.numerical},
)

To get its attributes, you can either extract them by simply using dot or its functions.

# Experiment object usage
best_model = experiment.get_best_model()
model_list = experiment.get_model_list()
best_auc_model = experiment.get_best_model_by_metric(ClassificationMetric.AUC)

Prediction

Now you can use model data to run prediction.

# Predicting iid data
predict = client.predict_iid(
    keep_columns=[],
    non_negative=False,
    test_table_id=test_id,
    model=best_model
)
# Predicting ts data
predict = client.predict_ts(
    keep_columns=[],
    non_negative=False,
    test_table_id=test_id,
    model=best_model
)

To get prediction result, do

predict_data = predict.get_predict_df()

Development

Installing poetry

  1. Install poetry from the official install
  2. poetry install #Project setup.
  3. poetry shell #Start your project in poetry env. (Optional if you use Conda to manage virtual environment)

Now you can create your own branch to start developing new feature.

Testing

To run test, do:

poe test

To run integration test, do:

  1. Rename .env.example as .env

  2. Modify .env file with correct configurations

  3. run

    poe test-e2e
    

Lint and format

To lint, do:

poe lint

To reformat, do:

poe format

Releasing

  1. poetry version [new_version]
  2. git commit -m"Bump version"
  3. git push origin main
  4. create new release on github.
  5. Create release off main branch, auto generate notes, and review release note.
  6. Publish release

Enums

#TODO

License

#TODO

TODO

#TODO

Metadata

Release files for decanter-ai-sdk 0.1.21

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

Source distribution (sdist)

Source distribution for decanter-ai-sdk 0.1.21
File Size Uploaded
decanter_ai_sdk-0.1.21.tar.gz 36.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for decanter-ai-sdk 0.1.21
File Interpreter ABI Platform
decanter_ai_sdk-0.1.21-py3-none-any.whl Python 3 none any Details

Total release size: 82.4 kB

Release files / decanter_ai_sdk-0.1.21.tar.gz

Download URL decanter_ai_sdk-0.1.21.tar.gz
Size 36.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ad98f8980d8e7d972659ae9f23e09114085dcb87f9558990e30ac45141cdaefe
BLAKE2b-256 checksum
How to use checksums
479b6bff1119fec2560787c2d7bc4b37deee78a165b7851e6d767eb1a9909967
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.8.18 Linux/6.11.0-1018-azure

Release files / decanter_ai_sdk-0.1.21-py3-none-any.whl

Download URL decanter_ai_sdk-0.1.21-py3-none-any.whl
Size 46.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a5a1456120eda07654b896f28467110869b69772d378db9d50b9a708a82ef0a9
BLAKE2b-256 checksum
How to use checksums
6e38b5b107e53337529f8a3434f3f25450813f8a005a693dbb95507eebe08743
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.8.18 Linux/6.11.0-1018-azure

Release history Release notifications | RSS feed

This release

0.1.21 This release

2 release files

0.1.20

2 release files

0.1.19

2 release files

0.1.17

2 release files

0.1.16

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.12

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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