Project Logo

Augmented Intelligence

Installation

To install Augmented Intelligence package:

$ pip install eazyml-insight

Available APIs

EazyML Augmented Intelligence extract insights from Dataset with certain insights score which is calculated using coverage of that insights.

ez_init(access_key=None, usage_share_consent=None, usage_delete=False)

Initialize EazyML package by passing access_key

Args:
  • access_key (str): The access key to be set as an environment variable for EazyML.

  • usage_share_consent (bool): User’s agreement to allow their usage information to be shared. If consent is given, only OS information, Python version, and EazyML packages API call counts are collected.

Returns:

A dictionary containing the results of the initialization process with the following fields:

  • success (bool): Indicates whether the operation was successful.

  • message (str): A message describing the success or failure of the operation.

Example:
from eazyml_insight import ez_init

# Initialize the EazyML library with the access key.
# This sets the `EAZYML_ACCESS_KEY` environment variable
access_key = "your_access_key_here"  # Replace with your actual access key
_ = ez_init(access_key)
Notes:
  • Make sure to call this function before using other functionalities of the EazyML library that require a valid access key.

  • The access key will be stored in the environment, and other functions in EazyML will automatically use it when required.

ez_insight(train_data, outcome, options={})

Fetch insights from the input training data based on the outcome, and options. Supports classification and regression tasks.

Args:
  • train_data (str/DataFrame): A pandas DataFrame containing the training dataset. Alternatively, you can provide the file path of training dataset (as a string).

  • outcome (str): The target variable for the insight.

  • options (dict/optional): A dictionary of options to configure the insight process. If not provided, the function will use default settings. Supported keys include:

    • data_source (str, optional): Specifies the data source type (e.g., “parquet” or “system”).

Returns:

A dictionary containing the results of the insight process with the following fields:

  • success (bool): Indicates whether the operation was successful.

  • message (str): A message describing the success or failure of the operation.

On Success:
  • insights (dict): Contains model performance data such as insights and insight-score if the operation was successful.

Note:
  • Please save the response obtained after getting the insights and provide the insights to the ez_validate function for getting validation metrics on test data.

Example:
from eazyml_insight import ez_insight

# Define training data path (make sure the file path is correct).
train_file_path = "path_to_your_training_data.csv"  # Replace with the correct file path

# Define the outcome (target variable)
outcome = "target"  # Replace with your actual target variable name

# Set the options for fetching the insights
insight_options = {"data_source": "parquet"}

# Call the EazyML function to fetch the insights
insight_response = ez_insight(train_file_path, outcome, options=insight_options)

# insight_response is a dictionary object with following keys.
# print (insight_response.keys())
# dict_keys(['success', 'message', 'insights'])

# Save the response for later use (e.g., for validation with ez_validate)
insights = insight_response['insights']
ez_validate(train_data, outcome, insights, test_data, options={})

Validate Augmented Intelligence insights on test data, based on mode, outcome, and options. Supports classification and regression tasks.

Args:
  • train_data (DataFrame or str): A pandas DataFrame containing the training dataset. Alternatively, you can provide the file path of training dataset (as a string).

  • outcome (str): The target variable for the insight.

  • insights (dict): Augmented Intelligence insights provided by ez_insight.

  • test_data (DataFrame or str): A pandas DataFrame containing the test dataset. Alternatively, you can provide the file path of test dataset (as a string).

  • options (dict, optional): A dictionary of options to configure the validate process. If not provided, the function will use default settings. Supported keys include:

    • record_number (list, optional): The record from the insight list whose validation needs to be explained.

Returns:

A dictionary containing the results of the validate process with the following fields:

  • success (bool): Indicates whether the operation was successful.

  • message (str): A message describing the success or failure of the operation.

On Success:
  • validations (dict): Contains model performance data such as accuracy, coverage, population if the operation was successful.

  • validation_filter (dict): Filtered test data for given record numbers.

Example:
from eazyml_insight import ez_validate

# Define training data path (make sure the file path is correct).
train_file_path = "path_to_your_training_data.csv"  # Replace with the correct file path

# Define test data path (make sure the file path is correct).
test_file_path = "path_to_your_test_data.csv"  # Replace with the correct file path

# Define the outcome (target variable)
outcome = "target"  # Replace with your actual target variable name

# Define the insights (response from ez_insight)
insights = insight_response['insights']

# Set the options for validating the insights
validate_options = {"record_number": [1, 2, 3]}

# Call the EazyML function to get the validation metrics
validate_response = ez_validate(train_file_path, outcome, insights, test_file_path, options=validate_options)

# validate_response is a dictionary object with following keys.
# print (validate_response.keys())
# dict_keys(['success', 'message', 'validations', 'validation_filter'])