Samples

Documentation to interact with Samples within a Project.

expai.ExpaiProject.create_sample

Create a new model within the project.

expai.ExpaiProject.create_sample(self,sample_path: str = None, sample_name: str = None, sample_separator: str = None, sample_target_col: str = None, sample_encoding: str = 'utf-8', is_display = False, reference_sample_id: str = None, reference_sample_name: str = None, display_sample_id: str = None, display_sample_name: str = None, sample_summary: str = None, protected_columns: list = None, drop_columns: list = None)

Attribute

Description

Required

sample_path

Local path where your CSV file is stored

True

sample_name

Name for the sample

True

sample_summary

Description for the sample

False

sample_separator

Separator for the file

True

sample_target_col

Column used as a target for the prediction (won't be considered as input to the model)

False

sample_encoding

Encoding used to store the sample

True

protected_columns

Columns containing protected attributes subject to fairness metrics

False

drop_columns

Columns that shouldn't be considered as input to the model

False

is_display

Boolean determining if it is a display sample

True

reference_sample_id

Used for display samples. Unique id of the non-display sample that a display sample represents

False

reference_sample_name

Used for display samples. Exact name of the non-display sample that a display sample represents

False

display_sample_id

Used for non-display samples. Unique id of the display sample that represents this sample.

False

display_sample_name

Used for non-display samples. Exact name of the display sample that represents this sample.

False

my_project.create_sample(sample_path=os.path.abspath("../../X_fairness.csv"),
                      sample_name="Dataset", 
                      sample_separator=";", 
                      sample_target_col = "target", 
                      protected_columns=['race', 'sex'],
                      drop_columns=['race', 'sex'],
                      is_display=False)

expai.ExpaiProject.append_sample

Include new rows in an existing sample.

expai.ExpaiProject.append_sample(self, sample_name: str = None, sample_id: str = None, sample_path: str = None, sample_encoding: str = 'utf-8')

Attribute

Description

Required

sample_name

Exact name of the sample where rows will be appended.

Yes, if sample_id is not provided

sample_id

Unique identifier of the sample where rows will be appended.

Yes, if sample_name is not provided

sample_path

Local path where your new CSV file is stored

Yes

sample_encoding

Custom encoding for the new file to be uploaded

No

expai.ExpaiProject.sample_list

List all samples available in the selected project or filter by name.

expai.ExpaiProject.sample_list(self, search_by: str = None, exact_search: str = None)

Attribute

Description

Required

search_by

Return only samples containing this substring in title

False

exact_search

Return only the sample matching exactly this title

False

my_project.sample_list()

expai.ExpaiProject.delete_sample

Delete a sample from the project

You won't be able to revert this action and all users will lose access to the project.

expai.ExpaiProject.delete_sample(self, sample_name: str = None, sample_id: str = None)

Attribute

Description

Required

sample_name

Exact name of the sample to be deleted.

Yes, if sample_id is not provided

sample_id

Unique identifier of the sample to be deleted.

Yes, if sample_name is not provided

expai_account.delete_sample(project_name="Dataset")

expai.ExpaiAccount.update_sample

Update sample metadata. Fields to be updated and their keys can be found here.

expai.ExpaiProject.update_sample(self, sample_name: str = None, sample_id: str = None, update_info: dict = None)

Attribute

Description

Required

sample_name

Exact name of the sample to be updated.

Yes, if sample_id is not provided

sample_id

Unique identifier of the sample to be updated.

Yes, if sample_name is not provided

update_info

Dictionary containing information to be updated in the sample.

Yes

expai_account.update_sample(sample_name="Potential model",
                            update_info={"sample_description_des":"New description"})

expai.ExpaiAccount.get_sample

Load a sample stored in EXPAI to a dataframe in Python.

expai.ExpaiProject.get_sample(self, sample_name: str = None, sample_id: str = None, subset_filters: dict = None, drop_target: bool = None, drop_columns: bool = None)

Attribute

Description

Required

sample_name

Exact name of the sample to be loaded.

Yes, if sample_id is not provided

sample_id

Unique identifier of the sample to be loaded.

Yes, if sample_name is not provided

subset_filters

Dictionary representing filters for the data to be loaded

No

drop_target

Boolean to drop the target column before loading

No

drop_columns

Boolean to drop the columns that were selected as drop_columnswhen creating the sample

No

expai_account.update_sample(sample_name="Potential model",
                            update_info={"sample_description_des":"New description"})

Last updated