Skip to main content

AlchemyML API package

Project description

AlchemyML API Documentation

Version Date: 2020-03-17


Table of Contents

[TOC]

Prerequisites

Sys, json, OS, requests.adapters.HTTPAdapter, urllib3.util.retry.Retry, pickle

Dependencies

Module Overview

Description

AlchemyML API

Flowchart

List of scripts and their functions

  • _CRUD_classes
    • authentication()
      • get_api_token
    • dataset()
      • upload
      • view
      • update
      • delete
      • statistical_descriptors
    • experiment()
      • create
      • view
      • update
      • delete
      • statistical_descriptors
      • results
      • add_to_project
      • extract_from_project
      • send
    • project()
      • create
      • view
      • update
      • delete
  • _manual_ops
    • actions()
      • list_preprocessed_dataframes
      • download_dataframe
      • prepare_dataframe
      • encode_dataframe
      • drop_highly_correlated_components
      • impute_inconsistencies
      • drop_invalid_columns
      • target_column_analysis
      • balancing_dataframe
      • initial_exp_info
      • impute_missing_values
      • merge_cols_into_dt_index
      • detect_experiment_type
      • build_model
      • operational_info
      • detect_outliers
      • impute_outliers
      • download_properties_df

CRUD_classes.py - Code explanations

Intro

Prerequisites - Imports

  • Python packages:
    • JSON: import json
    • OS: import os
    • Sys: import sys
  • Functions from request_handler:
    • from request_handler import retry_session, general_call

class authentication

The class to be used to authenticate, through the get_api_token method.

method get_api_token

def get_api_token(self, username, password):
    url = url_base + '/token/'
    data = json.dumps({'username':username, 'password':password})
    session = retry_session(retries = 10)
    r = session.post(url, data, verify = False)

    if r.status_code == 200:
        tokenJSON = json.loads(r.text)
        return r.status_code, tokenJSON['access']
    else:
        msgJSON = json.loads(r.text)
        msg = msgJSON['message']
        return r.status_code, msg
Description

This method returns the necessary token to be used from now on for the API requests. To be able to make use of the API before all it is necessary to sign-up.

I/O
  • Parameters:

    • username (str): Username
    • password (str): Password
  • Returns:

    • Status code (int)
    • Message (str) with the result

class dataset

This class unifies and condenses all the operations related to datasets in their most general sense: uploading them to the workspace, listing them, removing them...

Each and every operation (request) needs the token that is obtained through the class authentication.

method upload

    def upload(self, *args, **kwargs):  
        str_meth_name = self.class_name + '.' + sys._getframe().f_code.co_name
        input_args = locals()['args']
        input_kwargs = locals()['kwargs']

        return general_call(str_meth_name, input_args, input_kwargs)
Description
I/O
  • Parameters:
    • token (str): API Token
    • file_path (str): The path where the dataset file is located
    • dataset_name (str): Custom name for the dataset file
    • description (str, optional): Optional parameter to specify description if needed for the dataset. If no description is inputted, no description is added to the dataset.

method upload

    def upload(self, *args, **kwargs):  
        str_meth_name = self.class_name + '.' + sys._getframe().f_code.co_name
        input_args = locals()['args']
        input_kwargs = locals()['kwargs']

        return general_call(str_meth_name, input_args, input_kwargs)
Description
I/O
  • Parameters:
    • token (str): API Token
    • file_path (str): The path where the dataset file is located
    • dataset_name (str): Custom name for the dataset file
    • description (str, optional): Optional parameter to specify description if needed for the dataset. If no description is inputted, no description is added to the dataset.

method upload

    def upload(self, *args, **kwargs):  
        str_meth_name = self.class_name + '.' + sys._getframe().f_code.co_name
        input_args = locals()['args']
        input_kwargs = locals()['kwargs']

        return general_call(str_meth_name, input_args, input_kwargs)
Description
I/O
  • Parameters:
    • token (str): API Token
    • file_path (str): The path where the dataset file is located
    • dataset_name (str): Custom name for the dataset file
    • description (str, optional): Optional parameter to specify description if needed for the dataset. If no description is inputted, no description is added to the dataset.

method upload

    def upload(self, *args, **kwargs):  
        str_meth_name = self.class_name + '.' + sys._getframe().f_code.co_name
        input_args = locals()['args']
        input_kwargs = locals()['kwargs']

        return general_call(str_meth_name, input_args, input_kwargs)
Description
I/O
  • Parameters:
    • token (str): API Token
    • file_path (str): The path where the dataset file is located
    • dataset_name (str): Custom name for the dataset file
    • description (str, optional): Optional parameter to specify description if needed for the dataset. If no description is inputted, no description is added to the dataset.

method upload

    def upload(self, *args, **kwargs):  
        str_meth_name = self.class_name + '.' + sys._getframe().f_code.co_name
        input_args = locals()['args']
        input_kwargs = locals()['kwargs']

        return general_call(str_meth_name, input_args, input_kwargs)
Description
I/O
  • Parameters:
    • token (str): API Token
    • file_path (str): The path where the dataset file is located
    • dataset_name (str): Custom name for the dataset file
    • description (str, optional): Optional parameter to specify description if needed for the dataset. If no description is inputted, no description is added to the dataset.

class experiment

The class to be used to authenticate, through the get_api_token method.

method get_api_token

def get_api_token(self, username, password):
    url = url_base + '/token/'
    data = json.dumps({'username':username, 'password':password})
    session = retry_session(retries = 10)
    r = session.post(url, data, verify = False)

    if r.status_code == 200:
        tokenJSON = json.loads(r.text)
        return r.status_code, tokenJSON['access']
    else:
        msgJSON = json.loads(r.text)
        msg = msgJSON['message']
        return r.status_code, msg
Description

This method returns the necessary token to be used from now on for the API requests. To be able to make use of the API before all it is necessary to sign-up.

I/O
  • Parameters:

    • username (str): Username
    • password (str): Password
  • Returns:

    • Status code (int)
    • Message (str) with the result

class project

The class to be used to authenticate, through the get_api_token method.

method get_api_token

def get_api_token(self, username, password):
    url = url_base + '/token/'
    data = json.dumps({'username':username, 'password':password})
    session = retry_session(retries = 10)
    r = session.post(url, data, verify = False)

    if r.status_code == 200:
        tokenJSON = json.loads(r.text)
        return r.status_code, tokenJSON['access']
    else:
        msgJSON = json.loads(r.text)
        msg = msgJSON['message']
        return r.status_code, msg
Description

This method returns the necessary token to be used from now on for the API requests. To be able to make use of the API before all it is necessary to sign-up.

I/O
  • Parameters:

    • username (str): Username
    • password (str): Password
  • Returns:

    • Status code (int)
    • Message (str) with the result

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

alchemyml-0.1.21.tar.gz (6.9 kB view hashes)

Uploaded Source

Built Distribution

alchemyml-0.1.21-py3-none-any.whl (13.2 kB view hashes)

Uploaded Python 3

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