WebModel Library User Manual
The WebModel library is a tool for building, tuning, and inference of models that are built with the Aitomatic system. The target users of this library are AI Engineers who use the Aitomatic system.
Requirements
- Python 3.9 or higher
requestslibrarypandaslibrarynumpylibrarytqdmlibrary
Installation
The WebModel library can be installed using pip:
pip install 'aitomatic>=1.2.0' --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple
Quick Start
To get started, you can create a WebModel object by passing in the model name and API token:
from aitomatic.api.web_model import WebModel
# load model
API_ACCESS_TOKEN = '<API_ACCESS_TOKEN>'
project_name="<project name>"
model_name = "<model name>"
model = WebModel(api_token=API_ACCESS_TOKEN, project_name=project_name, model_name=model_name)
model.load()
# view model training statistics and info
print(model.stats)
# run model inference
data = {'X': my_dataframe}
response = model.predict({'X': data})
print(response['predictions'])
Methods
The WebModel class provides several methods for working with the model:
-
Constructor
model_names = WebModel.get_model_names(api_token="YOUR_API_TOKEN", project_name="MyProject")
-
Load model
loadset up the model ready by loading all parameter from Aitomatic model repo.model.load()
- Return the model with loaded params
-
Predict The
predictmethod takes a dictionary as input with the data you want to make predictions on. The input data should be a pandas DataFrame, Series, or numpy array with the key "X". The method returns a dictionary with the predictions, with the key "predictions".response = model.predict(input_data={'X': df})
input_data: input data for prediction, dictionary with data under key 'X'- Return: result of the prediction call in a dictionary where the actual result is under
predictionkey
-
Tuning
tune_modelis a statis method to generate multiple versions of a given model with the set of input paramstune_model( project_name=PROJECT_NAME, base_model=BASE_MODEL_NAME, conclusion_tuning_range=conclusion_threshold_ranges, ml_tuning_params=ML_MODELS_PARAMS, output_model_df_path='tuning.parquet', wait_for_tuning_to_complete=True, prefix="[HUNG7]", )
project_name: A string containing the name of the Aitomatic project to use.base_model:A string containing the name of the base model to use.conclusion_tuning_range: A dictionary specifying the range of values to use for the final layer of the tuned model.ml_tuning_params: A dictionary specifying the AutoML tuning parameters to use.output_model_df_path: A string specifying the path to save the resulting DataFrame containing the tuned model's hyperparameters and performance.wait_for_tuning_to_complete: A boolean specifying whether to wait for the tuning process to complete before returning. Default is True.prefix: A string containing a prefix to add to the name of the new model. Default is "finetune".- Return A Pandas DataFrame containing the hyperparameters and performance of the tuned model.
-
Log model metrics
log_metricsis to save the model metric after evaluationmodel.log_metrics("accuracy", 0.95)
-
Get models in project
staticmodel_names = WebModel.get_model_names(api_token="YOUR_API_TOKEN", project_name="MyProject")
- The
api_tokenA string containing the access token for the Aitomatic API. If not provided, the AITOMATIC_API_TOKEN environment variable will be used. - The
project_nameA string containing the name of the Aitomatic project to use. If not provided, the AITOMATIC_PROJECT_ID environment variable will be used. - Return a list of the names of all models in the specified project.
- The
Metadata
Release files for aitomatic 1.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aitomatic-1.3.1.tar.gz | 23.5 kB | Without provenance | Details for aitomatic-1.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aitomatic-1.3.1-py3-none-any.whl | Python 3 | none | any | Details for aitomatic-1.3.1-py3-none-any.whl |
Total release size: 50.8 kB
Release files / aitomatic-1.3.1.tar.gz
| Download URL | aitomatic-1.3.1.tar.gz |
|---|---|
| Size | 23.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d8db24ba9b7e4d6ca5f571152756c044c7bd23e717b889723daa32334dbb3184
|
|
BLAKE2b-256 checksum How to use checksums |
8c81d0517299cf6cde4e192783dfbab596514d26562a5138e652d1a4ffca2ee7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.7
|
Release files / aitomatic-1.3.1-py3-none-any.whl
| Download URL | aitomatic-1.3.1-py3-none-any.whl |
|---|---|
| Size | 27.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
85c82fa3a27012ea884ad647aa3635d2dc7f7aef0743b49dc8a42ce33b47d77b
|
|
BLAKE2b-256 checksum How to use checksums |
00c1ca0a3ca17a1053b34154a3d740fc47fd070388a93b2ed7e7fec1d4213b03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.7
|
Security for aitomatic 1.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.