plaid.utils.init_with_tabular

Utility functions to initialize a Dataset with tabular data.

Functions

initialize_dataset_with_tabular_data(→ plaid.Dataset)

Initialize a Dataset with tabular data.

Module Contents

initialize_dataset_with_tabular_data(tabular_data: dict[str, numpy.ndarray]) plaid.Dataset[source]

Initialize a Dataset with tabular data.

This function takes a dictionary of tabular data where keys represent scalar names, and values are numpy arrays of the same length. It creates a Dataset and adds samples to it based on the provided tabular data.

Parameters:

tabular_data (dict[str,np.ndarray]) – A dictionary of scalar names and corresponding numpy arrays.

Returns:

A Dataset initialized with the tabular data.

Return type:

Dataset

Raises:

AssertionError – If the lengths of the numpy arrays in tabular data are not identical.

Example

import numpy as np
from plaid.utils.init import initialize_dataset_with_tabular_data
tabular_data = {'feature1': np.array([1, 2, 3]), 'feature2': np.array([4, 5, 6])}
dataset = initialize_dataset_with_tabular_data(tabular_data)