From d1647c8936ce9d356cd4baea8125d02c399c4877 Mon Sep 17 00:00:00 2001 From: rabea-al Date: Sun, 6 Oct 2024 11:58:06 +0800 Subject: [PATCH 1/5] Lock package version in requirements.txt --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 7f5da7f..699f328 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -scikit-learn -pandas \ No newline at end of file +scikit-learn==1.5.2 +pandas==2.2.3 From 35e97060de4a423105bfb1052944c37ec488b011 Mon Sep 17 00:00:00 2001 From: rabea-al Date: Sun, 6 Oct 2024 12:01:35 +0800 Subject: [PATCH 2/5] Update README.md --- README.md | 155 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 123 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 2071f73..8ee9b53 100644 --- a/README.md +++ b/README.md @@ -1,66 +1,157 @@ -# SKLearn XAI Components Library -This library provides a collection of components for working with scikit-learn models, datasets, and evaluation tools within the XAI framework. It includes components for loading datasets, data preprocessing, model training, evaluation, and various machine learning algorithms. + + + +

+ Component Libraries • + Project Templates +
+ Docs • + Install • + Tutorials • + Developer Guides • + Contribute • + Blog • + Discord +

+ +< + +

Xircuits Component Library for integrating scikit-learn models, datasets, and evaluation tools.

+ +--- + +## Welcome to the SKLearn XAI Components Library + +The **SKLearn XAI Components Library** provides a simple and intuitive way to integrate **scikit-learn** machine learning models, datasets, and evaluation tools within the **XAI** framework. With this library, you can easily manage the end-to-end workflow for data handling, model training, and evaluation using scikit-learn's extensive set of algorithms and features. + +In this guide, you will find the steps to install the library, set up a workflow, and get started with training and evaluating machine learning models. + +## Table of Contents + +- [Prerequisites](#prerequisites) +- [Installation](#installation) +- [Getting Started with SKLearn XAI Components](#getting-started-with-sklearn-xai-components) + - [Example Workflow: RandomForestClassifier](#example-workflow-randomforestclassifier) +- [Components Overview](#components-overview) + - [Dataset Handling](#dataset-handling) + - [Data Preprocessing](#data-preprocessing) + - [Model Training](#model-training) + - [Model Evaluation](#model-evaluation) +- [Contributing](#contributing) ## Prerequisites -- Python 3.8 or higher -- scikit-learn -- pandas (for CSV data handling) +Before using this library, you’ll need the following: + +1. **Python 3.8** or higher +2. **scikit-learn**: Core machine learning algorithms +3. **pandas**: For handling CSV and tabular data +4. **Xircuits**: To integrate the components into your workflows ## Installation -You can install the required libraries using pip: +To install the SKLearn XAI Components Library, follow these steps: + +### 1. Install the required dependencies + +Ensure that the required libraries are installed by running: ```bash pip install -r requirements.txt ``` -To use this component library, simply copy the directory / clone or submodule the repository to your working Xircuits project directory. +### 2. Add the components to your Xircuits project + +You can either pull the repository as a submodule or manually clone it into your **Xircuits** project directory: + +```bash +# To clone the repository into your Xircuits project directory +git clone https://github.com/XpressAI/xai-sklearn.git xai_components/xai_sklearn + +# Install required dependencies +pip install -r xai_components/xai_sklearn/requirements.txt +``` + +## Getting Started with SKLearn XAI Components + +Once you have installed the required libraries and components, you can start building machine learning workflows in **Xircuits** using the **SKLearn XAI Components Library**. + +Below is a sample workflow for training and evaluating a **RandomForestClassifier**. + +### Example Workflow: RandomForestClassifier + +1. **Load a Dataset** + Use `SKLearnLoadDataset` to load built-in datasets such as **Iris**: + ```python + dataset = SKLearnLoadDataset('iris') + ``` + +2. **Split the Dataset** + Split the data into training and testing sets using `SKLearnTrainTestSplit`: + ```python + X_train, X_test, y_train, y_test = SKLearnTrainTestSplit(dataset) + ``` + +3. **Initialize and Train the Model** + Initialize and train a **RandomForestClassifier**: + ```python + model = SKLearnRandomForestClassifier() + trained_model = SKLearnModelTraining(model, X_train, y_train) + ``` + +4. **Evaluate the Model** + Evaluate the model's performance using `SKLearnClassificationEvaluation`: + ```python + SKLearnClassificationEvaluation(trained_model, X_test, y_test) + ``` + +For more detailed examples and component usage, refer to the **Component Documentation**. ## Components Overview -The library includes a variety of components categorized into dataset handling, data preprocessing, model training, and model evaluation. +The **SKLearn XAI Components Library** is structured into several categories to cover the entire workflow of dataset handling, model training, and evaluation. ### Dataset Handling -- **`SKLearnLoadDataset`**: Fetches datasets from scikit-learn's dataset collection. +- **`SKLearnLoadDataset`**: Fetches built-in datasets from scikit-learn. - **`CSVToSKLearnDataset`**: Converts a CSV file into a format compatible with scikit-learn datasets. ### Data Preprocessing -- **`SKLearnTrainTestSplit`**: Splits datasets into training and testing sets. +- **`SKLearnTrainTestSplit`**: Splits datasets into training and testing sets with configurable options like shuffle and random state. ### Model Training -- **`SKLearnModelTraining`**: Trains a specified scikit-learn model using provided training data. -- **`SKLearnRandomForestClassifier`**: Initializes a RandomForestClassifier model. -- **`SKLearnLogisticRegression`**: Initializes a LogisticRegression model. -- **`SKLearnSVC`**: Initializes a Support Vector Classifier (SVC) model. -- **`SKLearnKNeighborsClassifier`**: Initializes a KNeighborsClassifier model. -- **`SKLearnDecisionTreeClassifier`**: Initializes a DecisionTreeClassifier model. -- **`SKLearnGradientBoostingClassifier`**: Initializes a GradientBoostingClassifier model. -- **`SKLearnSVR`**: Initializes a Support Vector Regression (SVR) model. -- **`SKLearnMultinomialNB`**: Initializes a Multinomial Naive Bayes (MultinomialNB) model. -- **`SKLearnRidgeRegression`**: Initializes a Ridge Regression model. -- **`SKLearnKMeans`**: Initializes a KMeans clustering model. +- **`SKLearnModelTraining`**: Trains a scikit-learn model with the provided training data. +- **`SKLearnRandomForestClassifier`**: Initializes a **RandomForestClassifier**. +- **`SKLearnLogisticRegression`**: Initializes a **LogisticRegression** model. +- **`SKLearnSVC`**: Initializes a **Support Vector Classifier (SVC)**. +- **`SKLearnKNeighborsClassifier`**: Initializes a **KNeighborsClassifier**. +- **`SKLearnDecisionTreeClassifier`**: Initializes a **DecisionTreeClassifier**. +- **`SKLearnGradientBoostingClassifier`**: Initializes a **GradientBoostingClassifier**. +- **`SKLearnSVR`**: Initializes a **Support Vector Regression (SVR)** model. +- **`SKLearnMultinomialNB`**: Initializes a **Multinomial Naive Bayes** model. +- **`SKLearnRidgeRegression`**: Initializes a **Ridge Regression** model. +- **`SKLearnKMeans`**: Initializes a **KMeans** clustering model. ### Model Evaluation -- **`SKLearnClassificationEvaluation`**: Evaluates a trained scikit-learn classification model using testing data. +- **`SKLearnClassificationEvaluation`**: Evaluates a trained classification model using metrics such as accuracy, precision, recall, and F1-score. -## Usage +## Contributing -Each component can be integrated into your XAI workflows as needed. For instance, to train a RandomForestClassifier model: +We welcome contributions to the **SKLearn XAI Components Library**! If you would like to contribute: -1. Load your dataset using `SKLearnLoadDataset` or `CSVToSKLearnDataset`. -2. Split the dataset into training and testing sets with `SKLearnTrainTestSplit`. -3. Initialize the RandomForestClassifier model using `SKLearnRandomForestClassifier`. -4. Train the model with `SKLearnModelTraining` using the training data. -5. Evaluate the model's performance on the test set using `SKLearnClassificationEvaluation`. +1. Fork the repository. +2. Create a new branch for your feature or bug fix. +3. Open a pull request with a detailed description of your changes. -Refer to the component documentation for detailed usage instructions and parameter explanations. +Please feel free to suggest new components, improvements, or optimizations. If you encounter any issues or have ideas for enhancements, you can open an issue in the repository. -## Contributing +--- + +### License + +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information. -We welcome contributions to this library. If you have suggestions for new components or improvements to existing ones, please open an issue or submit a pull request. From 7669312eb378dbe764ac8abed99c8ea4a6c571b5 Mon Sep 17 00:00:00 2001 From: rabea-al Date: Sun, 6 Oct 2024 12:01:57 +0800 Subject: [PATCH 3/5] Update canvad --- examples/TrainEvaluate.xircuits | 739 ++++++++++++++++---------------- 1 file changed, 380 insertions(+), 359 deletions(-) diff --git a/examples/TrainEvaluate.xircuits b/examples/TrainEvaluate.xircuits index 673835b..bebad1b 100644 --- a/examples/TrainEvaluate.xircuits +++ b/examples/TrainEvaluate.xircuits @@ -6,7 +6,7 @@ "gridSize": 0, "layers": [ { - "id": "b2212374-5360-4c90-bb54-3141c241497b", + "id": "ee3d8bec-d133-4998-81fe-6a3f11265942", "type": "diagram-links", "isSvg": true, "transformed": true, @@ -17,20 +17,20 @@ "selected": false, "source": "a1a0b222-a864-4579-acfa-813f5e48e2aa", "sourcePort": "ec1bc346-056b-4d8c-898e-39651bf86927", - "target": "9df9ec16-f297-4146-b801-6c3f712dd938", - "targetPort": "ae9fd8e3-d946-492f-98ba-3d53a0802d4e", + "target": "e37c402e-f224-43ea-a4ad-dbff52a22550", + "targetPort": "51a56cee-f744-46cc-a753-58ee6786ebe0", "points": [ { "id": "5f567005-e352-44bf-aa8e-1ee9de186fa9", "type": "point", - "x": 29.959, - "y": 60.33 + "x": 59.587460723171475, + "y": 63.35001202858551 }, { "id": "af866399-8eb0-4c5c-bcb5-8ef20b42c835", "type": "point", - "x": 109.867, - "y": 108.304 + "x": 111.99999410812106, + "y": 111.32498809676764 } ], "labels": [], @@ -45,20 +45,20 @@ "selected": false, "source": "1db68704-2e7f-4167-9550-5c09efa1f9ed", "sourcePort": "e8f8fd94-f1e1-47c1-a0c3-24777d5d0a83", - "target": "9df9ec16-f297-4146-b801-6c3f712dd938", - "targetPort": "d21689d6-c4b6-47e1-8572-870a050d8b54", + "target": "e37c402e-f224-43ea-a4ad-dbff52a22550", + "targetPort": "208d8dcd-5651-468b-8984-77938da06ba2", "points": [ { "id": "c95fc900-a1e0-4ed2-9634-57b7c6080011", "type": "point", - "x": 46.453, - "y": 215.006 + "x": 48.63747653495993, + "y": 215.02503013570504 }, { "id": "2977f3b2-e96b-4404-a575-458a60cca419", "type": "point", - "x": 109.867, - "y": 124.288 + "x": 111.99999410812106, + "y": 132.92502004485883 } ], "labels": [], @@ -71,22 +71,22 @@ "id": "4301781b-5b7b-4388-8a2e-5ef1327615e3", "type": "triangle-link", "selected": false, - "source": "9df9ec16-f297-4146-b801-6c3f712dd938", - "sourcePort": "7ddc2d7d-3137-44ca-a3b9-c0aacfd52bc6", - "target": "71854345-7655-4591-9e68-5a91efdbba2a", - "targetPort": "ead9d083-f94a-453a-b391-caf2e1d0a9f0", + "source": "e37c402e-f224-43ea-a4ad-dbff52a22550", + "sourcePort": "580dc741-4cfa-4615-97f9-d70d84b0bbc8", + "target": "953860c1-860e-4be6-bcc0-60f868963b40", + "targetPort": "ea4ebf71-dc4f-4d52-88b6-2907253ae70e", "points": [ { "id": "5200ad7a-c0da-4a75-bf00-dffa636a321d", "type": "point", - "x": 303.675, - "y": 108.304 + "x": 277.2125246386704, + "y": 111.32498809676764 }, { "id": "b2bee9bc-b5f9-4288-ada9-b13e8a8fd772", "type": "point", - "x": 373.038, - "y": 108.802 + "x": 375.1625110852359, + "y": 111.82500713493363 } ], "labels": [], @@ -99,22 +99,22 @@ "id": "688aca5f-0d2f-47f8-8a1e-cbbfefca1fe2", "type": "parameter-link", "selected": false, - "source": "9df9ec16-f297-4146-b801-6c3f712dd938", - "sourcePort": "3691cd8d-a88a-414e-ae6d-babe294df0a4", - "target": "71854345-7655-4591-9e68-5a91efdbba2a", - "targetPort": "8190ed32-ef4f-4553-8170-cfd4e27966e8", + "source": "e37c402e-f224-43ea-a4ad-dbff52a22550", + "sourcePort": "798193f0-84d0-41ac-82a5-d43b72e4424a", + "target": "953860c1-860e-4be6-bcc0-60f868963b40", + "targetPort": "44448dca-59e7-4b52-8052-0aaf6b857a3e", "points": [ { "id": "532692a0-0c70-4821-8d9a-8a58a025037b", "type": "point", - "x": 303.675, - "y": 124.288 + "x": 277.2125246386704, + "y": 132.92502004485883 }, { "id": "fbc8f666-f15b-415d-981c-fafa75b630e3", "type": "point", - "x": 373.038, - "y": 124.786 + "x": 375.1625110852359, + "y": 133.42498758460923 } ], "labels": [], @@ -127,22 +127,22 @@ "id": "f3d06f07-4d3f-41f2-a83b-10204a68de8d", "type": "parameter-link", "selected": false, - "source": "71854345-7655-4591-9e68-5a91efdbba2a", - "sourcePort": "2b4753cd-f203-4522-802c-700c94cd6258", - "target": "e5dde8dc-e732-4c73-8021-e545dbfeb64c", - "targetPort": "c241e77e-4b79-438c-8148-e8401e5b349f", + "source": "953860c1-860e-4be6-bcc0-60f868963b40", + "sourcePort": "128ee397-e17f-4ce8-bece-0c293d396e70", + "target": "3e888ac7-6482-4088-a023-a291b03824f7", + "targetPort": "76748a69-d36d-4921-bab8-204764b11c00", "points": [ { "id": "edcd781d-7d01-43f2-ad20-db5dd420d44c", "type": "point", - "x": 554.01, - "y": 124.786 + "x": 541.0124375055063, + "y": 133.42498758460923 }, { "id": "608fa951-4c9f-4676-b141-d255cf0925f8", "type": "point", - "x": 902.043, - "y": 132.772 + "x": 904.1624757418883, + "y": 141.4125254161758 } ], "labels": [], @@ -155,22 +155,22 @@ "id": "d11ef17a-f25b-4bd4-a118-b0bba7fe4143", "type": "parameter-link", "selected": false, - "source": "71854345-7655-4591-9e68-5a91efdbba2a", - "sourcePort": "00265499-0fa5-444f-867f-eb6f2a3a2907", - "target": "e5dde8dc-e732-4c73-8021-e545dbfeb64c", - "targetPort": "35a9daa2-3062-4d50-bf9c-0f6a4316b5dd", + "source": "953860c1-860e-4be6-bcc0-60f868963b40", + "sourcePort": "c9cc386f-03fb-4040-905d-cecac8ca009a", + "target": "3e888ac7-6482-4088-a023-a291b03824f7", + "targetPort": "2425a5e6-e74b-4763-b683-b7720d5cff72", "points": [ { "id": "5e73aef4-1286-4242-9a2a-3e617e4a306e", "type": "point", - "x": 554.01, - "y": 156.753 + "x": 541.0124375055063, + "y": 176.62499998237598 }, { "id": "86588b76-8029-412a-aa9e-8f17c3dec8fe", "type": "point", - "x": 902.043, - "y": 148.756 + "x": 904.1624757418883, + "y": 163.01250586585144 } ], "labels": [], @@ -183,22 +183,22 @@ "id": "059ba555-0a5b-4a85-a6c4-fa25500e60cb", "type": "triangle-link", "selected": false, - "source": "71854345-7655-4591-9e68-5a91efdbba2a", - "sourcePort": "6efda694-d1fb-4bc2-a2ec-b179e8262b0d", - "target": "038a8325-01ef-4b7c-9e60-27ad3eb44e96", - "targetPort": "92a878e6-f87b-4ffd-8497-0239a21caf1b", + "source": "953860c1-860e-4be6-bcc0-60f868963b40", + "sourcePort": "4cd381fc-f15e-4914-a8fc-61495e54dee1", + "target": "d59d9f14-ccc5-4d55-a568-c6ae810d73a4", + "targetPort": "cb795633-8b5b-438f-bbfe-dcb54199c47b", "points": [ { "id": "3345561a-9773-4e48-862c-1a98493dc3ba", "type": "point", - "x": 554.01, - "y": 108.802 + "x": 541.0124375055063, + "y": 111.82500713493363 }, { "id": "1bf12c6f-0794-4f81-aa00-65119a09afb6", "type": "point", - "x": 609.925, - "y": 50.098 + "x": 612.0499699472675, + "y": 53.11249232676592 } ], "labels": [], @@ -211,22 +211,22 @@ "id": "3c2c4812-2310-4eec-952c-2976334cd2fe", "type": "triangle-link", "selected": false, - "source": "038a8325-01ef-4b7c-9e60-27ad3eb44e96", - "sourcePort": "cad9a30b-9c1e-4137-a42e-cb54ba51dc55", - "target": "e5dde8dc-e732-4c73-8021-e545dbfeb64c", - "targetPort": "c09b83c1-697b-406d-9356-7009748edda3", + "source": "d59d9f14-ccc5-4d55-a568-c6ae810d73a4", + "sourcePort": "79cb9ae4-9bbf-4834-981c-fc5520a94fd8", + "target": "3e888ac7-6482-4088-a023-a291b03824f7", + "targetPort": "71980a0f-3a11-4db6-b46f-3255408b1d39", "points": [ { "id": "ea5b1e3f-e545-4e9b-a79b-543bf6fa0bcb", "type": "point", - "x": 799.566, - "y": 50.098 + "x": 832.8500037199233, + "y": 53.11249232676592 }, { "id": "6058ff44-7191-47f3-be7f-a8d2c795fb03", "type": "point", - "x": 902.043, - "y": 116.788 + "x": 904.1624757418883, + "y": 119.81249346808464 } ], "labels": [], @@ -239,22 +239,22 @@ "id": "3e540202-7bba-4fca-a741-ebb626d46f37", "type": "parameter-link", "selected": false, - "source": "038a8325-01ef-4b7c-9e60-27ad3eb44e96", - "sourcePort": "07fce528-8663-4510-899a-3c7904472dd1", - "target": "e5dde8dc-e732-4c73-8021-e545dbfeb64c", - "targetPort": "8d749cba-f19a-4fd7-a87e-d904f05fd0b1", + "source": "d59d9f14-ccc5-4d55-a568-c6ae810d73a4", + "sourcePort": "30312b14-3507-4b31-b048-2e2bb7ffbb01", + "target": "3e888ac7-6482-4088-a023-a291b03824f7", + "targetPort": "314675e0-8731-4b01-8f2e-f97de8d8e343", "points": [ { "id": "92e741d1-6664-4940-b27f-2a1259285452", "type": "point", - "x": 799.566, - "y": 66.082 + "x": 832.8500037199233, + "y": 74.71249852564931 }, { "id": "a056e79d-fdbe-4ab0-95f1-37f6d4532f3b", "type": "point", - "x": 902.043, - "y": 164.74 + "x": 904.1624757418883, + "y": 184.6125378139426 } ], "labels": [], @@ -267,22 +267,22 @@ "id": "fc7b5d75-4649-4e06-80e2-921852db8865", "type": "triangle-link", "selected": false, - "source": "e5dde8dc-e732-4c73-8021-e545dbfeb64c", - "sourcePort": "146e48aa-1f5f-4b53-aa3b-0ba40d8b951e", - "target": "865e60e5-9806-45eb-b1b9-aa08ac31f640", - "targetPort": "7f846f02-a464-499b-8c7f-291869d2def0", + "source": "3e888ac7-6482-4088-a023-a291b03824f7", + "sourcePort": "94b4382a-dca5-4e76-8323-9aab536ac031", + "target": "7d51db12-7711-4956-b937-73d04c15505c", + "targetPort": "feb679b5-29da-4f09-ae25-058731c8d800", "points": [ { "id": "fb8c948d-0970-48bc-9cbe-c4b7252704f3", "type": "point", - "x": 1094.624, - "y": 116.788 + "x": 1072.6875388582434, + "y": 119.81249346808464 }, { "id": "e18fe5fd-3095-43df-81aa-fcba2c1b164b", "type": "point", - "x": 1182.552, - "y": 180.596 + "x": 1184.6749634255266, + "y": 183.6124900816577 } ], "labels": [], @@ -295,22 +295,22 @@ "id": "c6914c62-3370-4346-a896-3e4ae21a6302", "type": "parameter-link", "selected": false, - "source": "e5dde8dc-e732-4c73-8021-e545dbfeb64c", - "sourcePort": "580668e1-daad-4970-b598-272cb23cd38d", - "target": "865e60e5-9806-45eb-b1b9-aa08ac31f640", - "targetPort": "27dec33c-d828-44db-9582-0e0cf1daf15a", + "source": "3e888ac7-6482-4088-a023-a291b03824f7", + "sourcePort": "07d322d8-a128-4f7d-bb97-754518768327", + "target": "7d51db12-7711-4956-b937-73d04c15505c", + "targetPort": "b2165601-2583-4011-9123-3f0c8803a804", "points": [ { "id": "2265f161-f7ec-4cc3-990a-8c66e71ef06f", "type": "point", - "x": 1094.624, - "y": 132.772 + "x": 1072.6875388582434, + "y": 141.4125254161758 }, { "id": "00027233-786d-4c17-924f-6134c5a6fa0a", "type": "point", - "x": 1182.552, - "y": 228.547 + "x": 1184.6749634255266, + "y": 248.4125038503314 } ], "labels": [], @@ -323,22 +323,22 @@ "id": "88936993-3566-4da8-9623-6e35ec89a7f5", "type": "parameter-link", "selected": false, - "source": "71854345-7655-4591-9e68-5a91efdbba2a", - "sourcePort": "f7dbb90c-52c8-4bb9-b334-96da0cafbbe1", - "target": "865e60e5-9806-45eb-b1b9-aa08ac31f640", - "targetPort": "5746d965-a062-439e-9e8f-75e2949ca754", + "source": "953860c1-860e-4be6-bcc0-60f868963b40", + "sourcePort": "886ab971-918f-4ddb-b6d4-47bcd27d25e5", + "target": "7d51db12-7711-4956-b937-73d04c15505c", + "targetPort": "8111c534-2884-49a5-8f7a-71ca76bf9c97", "points": [ { "id": "7cc6b226-0296-4050-9e57-d9b4e2c51ea4", "type": "point", - "x": 554.01, - "y": 140.77 + "x": 541.0124375055063, + "y": 155.0250195327004 }, { "id": "da15dfd1-28da-4afb-a0fa-f35fd8469a2a", "type": "point", - "x": 1182.552, - "y": 196.58 + "x": 1184.6749634255266, + "y": 205.21252202974887 } ], "labels": [], @@ -351,22 +351,22 @@ "id": "e7e7d6fc-8d73-4234-94c4-50f3e9da2dd2", "type": "parameter-link", "selected": false, - "source": "71854345-7655-4591-9e68-5a91efdbba2a", - "sourcePort": "70239bd3-ddfa-478c-ab4a-f933eeed533e", - "target": "865e60e5-9806-45eb-b1b9-aa08ac31f640", - "targetPort": "0b2e36a9-5e48-441f-844a-06a74efe19e9", + "source": "953860c1-860e-4be6-bcc0-60f868963b40", + "sourcePort": "98bbff76-899b-41f1-aaf9-7a507f975c08", + "target": "7d51db12-7711-4956-b937-73d04c15505c", + "targetPort": "1d1c33c1-16eb-4c24-bbac-3206e12ff348", "points": [ { "id": "a26d2633-660a-4c89-b115-730861c74991", "type": "point", - "x": 554.01, - "y": 172.737 + "x": 541.0124375055063, + "y": 198.22503193046717 }, { "id": "16274db7-b61f-4b34-b293-5f22f6f3395f", "type": "point", - "x": 1182.552, - "y": 212.564 + "x": 1184.6749634255266, + "y": 226.81247190224022 } ], "labels": [], @@ -379,22 +379,22 @@ "id": "49517243-aed1-429a-8027-f1259ac91281", "type": "triangle-link", "selected": false, - "source": "865e60e5-9806-45eb-b1b9-aa08ac31f640", - "sourcePort": "9d46f601-ebc1-49e0-83f2-0be558965de4", - "target": "1a52ebfe-1054-4293-a7e4-0f2e8f1837ab", - "targetPort": "10ca7e92-079e-4553-8733-62875afc9cb8", + "source": "7d51db12-7711-4956-b937-73d04c15505c", + "sourcePort": "46f954df-6f57-43bb-8295-c4c6cb4aa997", + "target": "a82aa010-42f2-4139-9162-21a1841cb1b7", + "targetPort": "2227f45e-841b-41d3-9291-7e099c58f9db", "points": [ { "id": "86ff07e8-3bc0-43f9-930e-8b827424bbc6", "type": "point", - "x": 1435.631, - "y": 180.596 + "x": 1409.5498189874606, + "y": 183.6124900816577 }, { "id": "5f15fab1-7fb9-444e-ae50-49a3c44ffa22", "type": "point", - "x": 1528.964, - "y": 140.828 + "x": 1531.087398615131, + "y": 143.83750373057006 } ], "labels": [], @@ -407,22 +407,22 @@ "id": "f1543d05-ca15-4123-9ea7-bbc4cba71106", "type": "parameter-link", "selected": true, - "source": "e5dde8dc-e732-4c73-8021-e545dbfeb64c", - "sourcePort": "580668e1-daad-4970-b598-272cb23cd38d", - "target": "865e60e5-9806-45eb-b1b9-aa08ac31f640", - "targetPort": "27dec33c-d828-44db-9582-0e0cf1daf15a", + "source": "3e888ac7-6482-4088-a023-a291b03824f7", + "sourcePort": "07d322d8-a128-4f7d-bb97-754518768327", + "target": "7d51db12-7711-4956-b937-73d04c15505c", + "targetPort": "b2165601-2583-4011-9123-3f0c8803a804", "points": [ { "id": "faf4e816-45ca-404f-9deb-d62219168dc7", "type": "point", - "x": 1094.624, - "y": 132.772 + "x": 1072.6875388582434, + "y": 141.4125254161758 }, { "id": "7ce4ec77-0847-4aeb-a1b2-3c0e7f37f2e0", "type": "point", - "x": 1182.552, - "y": 228.547 + "x": 1184.6749634255266, + "y": 248.4125038503314 } ], "labels": [], @@ -434,7 +434,7 @@ } }, { - "id": "3a23f674-e973-4e40-88bf-8b48291d0dee", + "id": "c600afef-826c-4f3b-acb3-d427cd77c84e", "type": "diagram-nodes", "isSvg": false, "transformed": true, @@ -454,8 +454,8 @@ "id": "ec1bc346-056b-4d8c-898e-39651bf86927", "type": "default", "extras": {}, - "x": 22.465, - "y": 52.836, + "x": 49.287468615268324, + "y": 53.04999899945103, "name": "out-0", "alignment": "right", "parentNode": "a1a0b222-a864-4579-acfa-813f5e48e2aa", @@ -476,43 +476,6 @@ "ec1bc346-056b-4d8c-898e-39651bf86927" ] }, - "1a52ebfe-1054-4293-a7e4-0f2e8f1837ab": { - "id": "1a52ebfe-1054-4293-a7e4-0f2e8f1837ab", - "type": "custom-node", - "selected": false, - "extras": { - "type": "Finish", - "borderColor": "rgb(0,192,255)" - }, - "x": 1519.994, - "y": 106.749, - "ports": [ - { - "id": "10ca7e92-079e-4553-8733-62875afc9cb8", - "type": "default", - "extras": {}, - "x": 1521.47, - "y": 133.333, - "name": "in-0", - "alignment": "left", - "parentNode": "1a52ebfe-1054-4293-a7e4-0f2e8f1837ab", - "links": [ - "49517243-aed1-429a-8027-f1259ac91281" - ], - "in": true, - "label": "▶", - "varName": "▶", - "portType": "", - "dataType": "" - } - ], - "name": "Finish", - "color": "rgb(255,102,102)", - "portsInOrder": [ - "10ca7e92-079e-4553-8733-62875afc9cb8" - ], - "portsOutOrder": [] - }, "1db68704-2e7f-4167-9550-5c09efa1f9ed": { "id": "1db68704-2e7f-4167-9550-5c09efa1f9ed", "type": "custom-node", @@ -527,8 +490,8 @@ "id": "e8f8fd94-f1e1-47c1-a0c3-24777d5d0a83", "type": "default", "extras": {}, - "x": 38.958, - "y": 207.512, + "x": 38.337463505825454, + "y": 204.7250380278019, "name": "out-0", "alignment": "right", "parentNode": "1db68704-2e7f-4167-9550-5c09efa1f9ed", @@ -549,18 +512,76 @@ "e8f8fd94-f1e1-47c1-a0c3-24777d5d0a83" ] }, - "9df9ec16-f297-4146-b801-6c3f712dd938": { - "id": "9df9ec16-f297-4146-b801-6c3f712dd938", + "a82aa010-42f2-4139-9162-21a1841cb1b7": { + "id": "a82aa010-42f2-4139-9162-21a1841cb1b7", "type": "custom-node", - "selected": false, + "selected": true, "extras": { - "type": "debug", + "type": "Finish" + }, + "x": 1519.994, + "y": 106.749, + "ports": [ + { + "id": "2227f45e-841b-41d3-9291-7e099c58f9db", + "type": "default", + "extras": {}, + "x": 1520.7873855859964, + "y": 133.5374907014356, + "name": "in-0", + "alignment": "left", + "parentNode": "a82aa010-42f2-4139-9162-21a1841cb1b7", + "links": [ + "49517243-aed1-429a-8027-f1259ac91281" + ], + "in": true, + "label": "▶", + "varName": "▶", + "portType": "", + "dataType": "" + }, + { + "id": "704553a1-74c5-4ae6-8cf5-6c9fe4f6def5", + "type": "default", + "extras": {}, + "x": 1520.7873855859964, + "y": 155.13747115111119, + "name": "parameter-dynalist-outputs", + "alignment": "left", + "parentNode": "a82aa010-42f2-4139-9162-21a1841cb1b7", + "links": [], + "in": true, + "label": "outputs", + "varName": "outputs", + "portType": "", + "dataType": "dynalist", + "dynaPortOrder": 0, + "dynaPortRef": { + "previous": null, + "next": null + } + } + ], + "name": "Finish", + "color": "rgb(255,102,102)", + "portsInOrder": [ + "2227f45e-841b-41d3-9291-7e099c58f9db", + "704553a1-74c5-4ae6-8cf5-6c9fe4f6def5" + ], + "portsOutOrder": [] + }, + "e37c402e-f224-43ea-a4ad-dbff52a22550": { + "id": "e37c402e-f224-43ea-a4ad-dbff52a22550", + "type": "custom-node", + "selected": true, + "extras": { + "type": "library_component", "path": "xai_components/xai_sklearn/sklearn_utils.py", - "description": "Fetches a specified dataset from sklearn's dataset module.\n\n#### Reference:\n- [sklearn datasets](https://scikit-learn.org/stable/datasets/toy_dataset.html)\n\n##### inPorts:\n- dataset_name: The name of the dataset to be loaded.\n\n##### outPorts:\n- dataset: The loaded sklearn dataset.", + "description": "Fetches a specified dataset from sklearn's dataset module.\n\n#### Reference:\n- [sklearn datasets](https://scikit-learn.org/stable/datasets/toy_dataset.html)\n\n##### inPorts:\n- dataset_name: The name of the dataset to be loaded. Provide the name without the 'load_' prefix (e.g., 'iris', 'digits').\n\n##### outPorts:\n- dataset: The loaded sklearn dataset, which includes data and target.", "lineNo": [ { "lineno": 4, - "end_lineno": 33 + "end_lineno": 35 } ] }, @@ -568,14 +589,14 @@ "y": 74.231, "ports": [ { - "id": "ae9fd8e3-d946-492f-98ba-3d53a0802d4e", + "id": "51a56cee-f744-46cc-a753-58ee6786ebe0", "type": "default", "extras": {}, - "x": 102.373, - "y": 100.81, + "x": 101.69998107898657, + "y": 101.02499598886449, "name": "in-0", "alignment": "left", - "parentNode": "9df9ec16-f297-4146-b801-6c3f712dd938", + "parentNode": "e37c402e-f224-43ea-a4ad-dbff52a22550", "links": [ "b198d930-d58f-47a8-a403-5a3b07111ed2" ], @@ -586,14 +607,14 @@ "dataType": "" }, { - "id": "d21689d6-c4b6-47e1-8572-870a050d8b54", + "id": "208d8dcd-5651-468b-8984-77938da06ba2", "type": "default", "extras": {}, - "x": 102.373, - "y": 116.794, + "x": 101.69998107898657, + "y": 122.62502793695568, "name": "parameter-string-dataset_name", "alignment": "left", - "parentNode": "9df9ec16-f297-4146-b801-6c3f712dd938", + "parentNode": "e37c402e-f224-43ea-a4ad-dbff52a22550", "links": [ "610e888f-d315-42c3-bdb3-a43eaa23e646" ], @@ -604,14 +625,14 @@ "dataType": "string" }, { - "id": "7ddc2d7d-3137-44ca-a3b9-c0aacfd52bc6", + "id": "580dc741-4cfa-4615-97f9-d70d84b0bbc8", "type": "default", "extras": {}, - "x": 296.181, - "y": 100.81, + "x": 266.9125116095359, + "y": 101.02499598886449, "name": "out-0", "alignment": "right", - "parentNode": "9df9ec16-f297-4146-b801-6c3f712dd938", + "parentNode": "e37c402e-f224-43ea-a4ad-dbff52a22550", "links": [ "4301781b-5b7b-4388-8a2e-5ef1327615e3" ], @@ -622,14 +643,14 @@ "dataType": "" }, { - "id": "3691cd8d-a88a-414e-ae6d-babe294df0a4", + "id": "798193f0-84d0-41ac-82a5-d43b72e4424a", "type": "default", "extras": {}, - "x": 296.181, - "y": 116.794, + "x": 266.9125116095359, + "y": 122.62502793695568, "name": "parameter-out-any-dataset", "alignment": "right", - "parentNode": "9df9ec16-f297-4146-b801-6c3f712dd938", + "parentNode": "e37c402e-f224-43ea-a4ad-dbff52a22550", "links": [ "688aca5f-0d2f-47f8-8a1e-cbbfefca1fe2" ], @@ -637,32 +658,32 @@ "label": "dataset", "varName": "dataset", "portType": "", - "dataType": "" + "dataType": "any" } ], "name": "SKLearnLoadDataset", - "color": "rgb(153,204,51)", + "color": "rgb(15,255,255)", "portsInOrder": [ - "ae9fd8e3-d946-492f-98ba-3d53a0802d4e", - "d21689d6-c4b6-47e1-8572-870a050d8b54" + "51a56cee-f744-46cc-a753-58ee6786ebe0", + "208d8dcd-5651-468b-8984-77938da06ba2" ], "portsOutOrder": [ - "7ddc2d7d-3137-44ca-a3b9-c0aacfd52bc6", - "3691cd8d-a88a-414e-ae6d-babe294df0a4" + "580dc741-4cfa-4615-97f9-d70d84b0bbc8", + "798193f0-84d0-41ac-82a5-d43b72e4424a" ] }, - "71854345-7655-4591-9e68-5a91efdbba2a": { - "id": "71854345-7655-4591-9e68-5a91efdbba2a", + "953860c1-860e-4be6-bcc0-60f868963b40": { + "id": "953860c1-860e-4be6-bcc0-60f868963b40", "type": "custom-node", - "selected": false, + "selected": true, "extras": { - "type": "debug", + "type": "library_component", "path": "xai_components/xai_sklearn/sklearn_utils.py", "description": "\"\nTakes a sklearn dataset into train and test splits.\n\n#### Reference:\n- [sklearn.model_selection.train_test_split](https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.train_test_split.html)\n\n##### inPorts:\n- dataset: The input sklearn dataset to be split.\n- train_split: The proportion of the dataset to include in the train split (default is 0.75).\n- random_state: The seed used by the random number generator (default is None).\n- shuffle: Whether or not to shuffle the data before splitting (default is True).\n- stratify: If not None, data is split in a stratified fashion, using this as the class labels (default is None).\n\n##### outPorts:\n- X_train: The training data.\n- X_test: The testing data.\n- y_train: The target variable for the training data.\n- y_test: The target variable for the testing data.", "lineNo": [ { - "lineno": 37, - "end_lineno": 83 + "lineno": 38, + "end_lineno": 84 } ] }, @@ -670,14 +691,14 @@ "y": 74.726, "ports": [ { - "id": "ead9d083-f94a-453a-b391-caf2e1d0a9f0", + "id": "ea4ebf71-dc4f-4d52-88b6-2907253ae70e", "type": "default", "extras": {}, - "x": 365.544, - "y": 101.308, + "x": 364.86249805610146, + "y": 101.52499410579915, "name": "in-0", "alignment": "left", - "parentNode": "71854345-7655-4591-9e68-5a91efdbba2a", + "parentNode": "953860c1-860e-4be6-bcc0-60f868963b40", "links": [ "4301781b-5b7b-4388-8a2e-5ef1327615e3" ], @@ -688,14 +709,14 @@ "dataType": "" }, { - "id": "8190ed32-ef4f-4553-8170-cfd4e27966e8", + "id": "44448dca-59e7-4b52-8052-0aaf6b857a3e", "type": "default", "extras": {}, - "x": 365.544, - "y": 117.292, + "x": 364.86249805610146, + "y": 123.12497455547474, "name": "parameter-any-dataset", "alignment": "left", - "parentNode": "71854345-7655-4591-9e68-5a91efdbba2a", + "parentNode": "953860c1-860e-4be6-bcc0-60f868963b40", "links": [ "688aca5f-0d2f-47f8-8a1e-cbbfefca1fe2" ], @@ -706,14 +727,14 @@ "dataType": "any" }, { - "id": "1f28df08-6f98-4f0b-b72c-f930e21a33bd", + "id": "c6bcb05a-821a-4a64-a5a7-e0a51a55ff8d", "type": "default", "extras": {}, - "x": 365.544, - "y": 133.275, + "x": 364.86249805610146, + "y": 144.72500650356594, "name": "parameter-float-train_split", "alignment": "left", - "parentNode": "71854345-7655-4591-9e68-5a91efdbba2a", + "parentNode": "953860c1-860e-4be6-bcc0-60f868963b40", "links": [], "in": true, "label": "train_split", @@ -722,14 +743,14 @@ "dataType": "float" }, { - "id": "b6d0743f-b7ba-4d9b-80e4-58698c085088", + "id": "0d9fa833-41be-44d2-87a5-8ffec764b166", "type": "default", "extras": {}, - "x": 365.544, - "y": 149.259, + "x": 364.86249805610146, + "y": 166.3249869532415, "name": "parameter-int-random_state", "alignment": "left", - "parentNode": "71854345-7655-4591-9e68-5a91efdbba2a", + "parentNode": "953860c1-860e-4be6-bcc0-60f868963b40", "links": [], "in": true, "label": "random_state", @@ -738,14 +759,14 @@ "dataType": "int" }, { - "id": "6c41a38b-b73f-47c7-8d16-bab878189133", + "id": "09c27384-0747-43ef-b4b8-9947ba3921f0", "type": "default", "extras": {}, - "x": 365.544, - "y": 165.243, + "x": 364.86249805610146, + "y": 187.9250189013327, "name": "parameter-boolean-shuffle", "alignment": "left", - "parentNode": "71854345-7655-4591-9e68-5a91efdbba2a", + "parentNode": "953860c1-860e-4be6-bcc0-60f868963b40", "links": [], "in": true, "label": "shuffle", @@ -754,14 +775,14 @@ "dataType": "boolean" }, { - "id": "d860983d-223b-4b74-b629-1f53aa4d92be", + "id": "93133018-3d3f-483c-8bd8-353f1257d516", "type": "default", "extras": {}, - "x": 365.544, - "y": 181.227, + "x": 364.86249805610146, + "y": 209.5249993510083, "name": "parameter-any-stratify", "alignment": "left", - "parentNode": "71854345-7655-4591-9e68-5a91efdbba2a", + "parentNode": "953860c1-860e-4be6-bcc0-60f868963b40", "links": [], "in": true, "label": "stratify", @@ -770,14 +791,14 @@ "dataType": "any" }, { - "id": "6efda694-d1fb-4bc2-a2ec-b179e8262b0d", + "id": "4cd381fc-f15e-4914-a8fc-61495e54dee1", "type": "default", "extras": {}, - "x": 546.516, - "y": 101.308, + "x": 530.7124244763718, + "y": 101.52499410579915, "name": "out-0", "alignment": "right", - "parentNode": "71854345-7655-4591-9e68-5a91efdbba2a", + "parentNode": "953860c1-860e-4be6-bcc0-60f868963b40", "links": [ "059ba555-0a5b-4a85-a6c4-fa25500e60cb" ], @@ -788,14 +809,14 @@ "dataType": "" }, { - "id": "2b4753cd-f203-4522-802c-700c94cd6258", + "id": "128ee397-e17f-4ce8-bece-0c293d396e70", "type": "default", "extras": {}, - "x": 546.516, - "y": 117.292, + "x": 530.7124244763718, + "y": 123.12497455547474, "name": "parameter-out-any-X_train", "alignment": "right", - "parentNode": "71854345-7655-4591-9e68-5a91efdbba2a", + "parentNode": "953860c1-860e-4be6-bcc0-60f868963b40", "links": [ "f3d06f07-4d3f-41f2-a83b-10204a68de8d" ], @@ -803,17 +824,17 @@ "label": "X_train", "varName": "X_train", "portType": "", - "dataType": "" + "dataType": "any" }, { - "id": "f7dbb90c-52c8-4bb9-b334-96da0cafbbe1", + "id": "886ab971-918f-4ddb-b6d4-47bcd27d25e5", "type": "default", "extras": {}, - "x": 546.516, - "y": 133.275, + "x": 530.7124244763718, + "y": 144.72500650356594, "name": "parameter-out-any-X_test", "alignment": "right", - "parentNode": "71854345-7655-4591-9e68-5a91efdbba2a", + "parentNode": "953860c1-860e-4be6-bcc0-60f868963b40", "links": [ "88936993-3566-4da8-9623-6e35ec89a7f5" ], @@ -821,17 +842,17 @@ "label": "X_test", "varName": "X_test", "portType": "", - "dataType": "" + "dataType": "any" }, { - "id": "00265499-0fa5-444f-867f-eb6f2a3a2907", + "id": "c9cc386f-03fb-4040-905d-cecac8ca009a", "type": "default", "extras": {}, - "x": 546.516, - "y": 149.259, + "x": 530.7124244763718, + "y": 166.3249869532415, "name": "parameter-out-any-y_train", "alignment": "right", - "parentNode": "71854345-7655-4591-9e68-5a91efdbba2a", + "parentNode": "953860c1-860e-4be6-bcc0-60f868963b40", "links": [ "d11ef17a-f25b-4bd4-a118-b0bba7fe4143" ], @@ -839,17 +860,17 @@ "label": "y_train", "varName": "y_train", "portType": "", - "dataType": "" + "dataType": "any" }, { - "id": "70239bd3-ddfa-478c-ab4a-f933eeed533e", + "id": "98bbff76-899b-41f1-aaf9-7a507f975c08", "type": "default", "extras": {}, - "x": 546.516, - "y": 165.243, + "x": 530.7124244763718, + "y": 187.9250189013327, "name": "parameter-out-any-y_test", "alignment": "right", - "parentNode": "71854345-7655-4591-9e68-5a91efdbba2a", + "parentNode": "953860c1-860e-4be6-bcc0-60f868963b40", "links": [ "e7e7d6fc-8d73-4234-94c4-50f3e9da2dd2" ], @@ -857,39 +878,39 @@ "label": "y_test", "varName": "y_test", "portType": "", - "dataType": "" + "dataType": "any" } ], "name": "SKLearnTrainTestSplit", - "color": "rgb(255,153,0)", + "color": "rgb(255,204,204)", "portsInOrder": [ - "ead9d083-f94a-453a-b391-caf2e1d0a9f0", - "8190ed32-ef4f-4553-8170-cfd4e27966e8", - "1f28df08-6f98-4f0b-b72c-f930e21a33bd", - "b6d0743f-b7ba-4d9b-80e4-58698c085088", - "6c41a38b-b73f-47c7-8d16-bab878189133", - "d860983d-223b-4b74-b629-1f53aa4d92be" + "ea4ebf71-dc4f-4d52-88b6-2907253ae70e", + "44448dca-59e7-4b52-8052-0aaf6b857a3e", + "c6bcb05a-821a-4a64-a5a7-e0a51a55ff8d", + "0d9fa833-41be-44d2-87a5-8ffec764b166", + "09c27384-0747-43ef-b4b8-9947ba3921f0", + "93133018-3d3f-483c-8bd8-353f1257d516" ], "portsOutOrder": [ - "6efda694-d1fb-4bc2-a2ec-b179e8262b0d", - "2b4753cd-f203-4522-802c-700c94cd6258", - "f7dbb90c-52c8-4bb9-b334-96da0cafbbe1", - "00265499-0fa5-444f-867f-eb6f2a3a2907", - "70239bd3-ddfa-478c-ab4a-f933eeed533e" + "4cd381fc-f15e-4914-a8fc-61495e54dee1", + "128ee397-e17f-4ce8-bece-0c293d396e70", + "886ab971-918f-4ddb-b6d4-47bcd27d25e5", + "c9cc386f-03fb-4040-905d-cecac8ca009a", + "98bbff76-899b-41f1-aaf9-7a507f975c08" ] }, - "e5dde8dc-e732-4c73-8021-e545dbfeb64c": { - "id": "e5dde8dc-e732-4c73-8021-e545dbfeb64c", + "3e888ac7-6482-4088-a023-a291b03824f7": { + "id": "3e888ac7-6482-4088-a023-a291b03824f7", "type": "custom-node", - "selected": false, + "selected": true, "extras": { - "type": "debug", + "type": "library_component", "path": "xai_components/xai_sklearn/sklearn_utils.py", "description": "Trains a specified scikit-learn model using the provided training data.\n\n#### Reference:\n- [sklearn estimators](https://scikit-learn.org/stable/user_guide.html)\n\n##### inPorts:\n- X_train: Training data features.\n- y_train: Training data targets.\n- model: The scikit-learn model to train.\n\n##### outPorts:\n- trained_model: The trained scikit-learn model.", "lineNo": [ { - "lineno": 152, - "end_lineno": 176 + "lineno": 153, + "end_lineno": 177 } ] }, @@ -897,14 +918,14 @@ "y": 82.714, "ports": [ { - "id": "c09b83c1-697b-406d-9356-7009748edda3", + "id": "71980a0f-3a11-4db6-b46f-3255408b1d39", "type": "default", "extras": {}, - "x": 894.549, - "y": 109.294, + "x": 893.8624627127539, + "y": 109.51250136018149, "name": "in-0", "alignment": "left", - "parentNode": "e5dde8dc-e732-4c73-8021-e545dbfeb64c", + "parentNode": "3e888ac7-6482-4088-a023-a291b03824f7", "links": [ "3c2c4812-2310-4eec-952c-2976334cd2fe" ], @@ -915,14 +936,14 @@ "dataType": "" }, { - "id": "c241e77e-4b79-438c-8148-e8401e5b349f", + "id": "76748a69-d36d-4921-bab8-204764b11c00", "type": "default", "extras": {}, - "x": 894.549, - "y": 125.278, + "x": 893.8624627127539, + "y": 131.11253330827267, "name": "parameter-any-X_train", "alignment": "left", - "parentNode": "e5dde8dc-e732-4c73-8021-e545dbfeb64c", + "parentNode": "3e888ac7-6482-4088-a023-a291b03824f7", "links": [ "f3d06f07-4d3f-41f2-a83b-10204a68de8d" ], @@ -933,14 +954,14 @@ "dataType": "any" }, { - "id": "35a9daa2-3062-4d50-bf9c-0f6a4316b5dd", + "id": "2425a5e6-e74b-4763-b683-b7720d5cff72", "type": "default", "extras": {}, - "x": 894.549, - "y": 141.262, + "x": 893.8624627127539, + "y": 152.71251375794827, "name": "parameter-any-y_train", "alignment": "left", - "parentNode": "e5dde8dc-e732-4c73-8021-e545dbfeb64c", + "parentNode": "3e888ac7-6482-4088-a023-a291b03824f7", "links": [ "d11ef17a-f25b-4bd4-a118-b0bba7fe4143" ], @@ -951,14 +972,14 @@ "dataType": "any" }, { - "id": "8d749cba-f19a-4fd7-a87e-d904f05fd0b1", + "id": "314675e0-8731-4b01-8f2e-f97de8d8e343", "type": "default", "extras": {}, - "x": 894.549, - "y": 157.245, + "x": 893.8624627127539, + "y": 174.31254570603946, "name": "parameter-any-model", "alignment": "left", - "parentNode": "e5dde8dc-e732-4c73-8021-e545dbfeb64c", + "parentNode": "3e888ac7-6482-4088-a023-a291b03824f7", "links": [ "3e540202-7bba-4fca-a741-ebb626d46f37" ], @@ -969,14 +990,14 @@ "dataType": "any" }, { - "id": "146e48aa-1f5f-4b53-aa3b-0ba40d8b951e", + "id": "94b4382a-dca5-4e76-8323-9aab536ac031", "type": "default", "extras": {}, - "x": 1087.13, - "y": 109.294, + "x": 1062.3875258291089, + "y": 109.51250136018149, "name": "out-0", "alignment": "right", - "parentNode": "e5dde8dc-e732-4c73-8021-e545dbfeb64c", + "parentNode": "3e888ac7-6482-4088-a023-a291b03824f7", "links": [ "fc7b5d75-4649-4e06-80e2-921852db8865" ], @@ -987,14 +1008,14 @@ "dataType": "" }, { - "id": "580668e1-daad-4970-b598-272cb23cd38d", + "id": "07d322d8-a128-4f7d-bb97-754518768327", "type": "default", "extras": {}, - "x": 1087.13, - "y": 125.278, + "x": 1062.3875258291089, + "y": 131.11253330827267, "name": "parameter-out-any-trained_model", "alignment": "right", - "parentNode": "e5dde8dc-e732-4c73-8021-e545dbfeb64c", + "parentNode": "3e888ac7-6482-4088-a023-a291b03824f7", "links": [ "c6914c62-3370-4346-a896-3e4ae21a6302", "f1543d05-ca15-4123-9ea7-bbc4cba71106" @@ -1003,28 +1024,28 @@ "label": "trained_model", "varName": "trained_model", "portType": "", - "dataType": "" + "dataType": "any" } ], "name": "SKLearnModelTraining", - "color": "rgb(153,204,51)", + "color": "rgb(255,153,0)", "portsInOrder": [ - "c09b83c1-697b-406d-9356-7009748edda3", - "c241e77e-4b79-438c-8148-e8401e5b349f", - "35a9daa2-3062-4d50-bf9c-0f6a4316b5dd", - "8d749cba-f19a-4fd7-a87e-d904f05fd0b1" + "71980a0f-3a11-4db6-b46f-3255408b1d39", + "76748a69-d36d-4921-bab8-204764b11c00", + "2425a5e6-e74b-4763-b683-b7720d5cff72", + "314675e0-8731-4b01-8f2e-f97de8d8e343" ], "portsOutOrder": [ - "146e48aa-1f5f-4b53-aa3b-0ba40d8b951e", - "580668e1-daad-4970-b598-272cb23cd38d" + "94b4382a-dca5-4e76-8323-9aab536ac031", + "07d322d8-a128-4f7d-bb97-754518768327" ] }, - "038a8325-01ef-4b7c-9e60-27ad3eb44e96": { - "id": "038a8325-01ef-4b7c-9e60-27ad3eb44e96", + "d59d9f14-ccc5-4d55-a568-c6ae810d73a4": { + "id": "d59d9f14-ccc5-4d55-a568-c6ae810d73a4", "type": "custom-node", - "selected": false, + "selected": true, "extras": { - "type": "debug", + "type": "library_component", "path": "xai_components/xai_sklearn/sklearn_models.py", "description": "Initializes a RandomForestClassifier model with given parameters. RandomForestClassifier is suitable for a wide range of classification tasks and is known for its high accuracy.\n\n#### Reference:\n- [RandomForestClassifier](https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html)\n\n##### inPorts:\n- model_params: A dictionary of parameters to initialize the model with. If not provided, default parameters will be used.\n\n##### outPorts:\n- model: The initialized RandomForestClassifier model, ready for training with datasets.", "lineNo": [ @@ -1038,14 +1059,14 @@ "y": 16.019, "ports": [ { - "id": "92a878e6-f87b-4ffd-8497-0239a21caf1b", + "id": "cb795633-8b5b-438f-bbfe-dcb54199c47b", "type": "default", "extras": {}, - "x": 602.431, - "y": 42.604, + "x": 601.749956918133, + "y": 42.812500218862766, "name": "in-0", "alignment": "left", - "parentNode": "038a8325-01ef-4b7c-9e60-27ad3eb44e96", + "parentNode": "d59d9f14-ccc5-4d55-a568-c6ae810d73a4", "links": [ "059ba555-0a5b-4a85-a6c4-fa25500e60cb" ], @@ -1056,14 +1077,14 @@ "dataType": "" }, { - "id": "ec14f9f2-07d1-47b4-9e5e-c15c9929a767", + "id": "b8efa66d-a0e7-4bad-96df-d5bfe9248fe7", "type": "default", "extras": {}, - "x": 602.431, - "y": 58.588, + "x": 601.749956918133, + "y": 64.41250641774616, "name": "parameter-dict-model_params", "alignment": "left", - "parentNode": "038a8325-01ef-4b7c-9e60-27ad3eb44e96", + "parentNode": "d59d9f14-ccc5-4d55-a568-c6ae810d73a4", "links": [], "in": true, "label": "model_params", @@ -1072,14 +1093,14 @@ "dataType": "dict" }, { - "id": "cad9a30b-9c1e-4137-a42e-cb54ba51dc55", + "id": "79cb9ae4-9bbf-4834-981c-fc5520a94fd8", "type": "default", "extras": {}, - "x": 792.072, - "y": 42.604, + "x": 822.5500317285888, + "y": 42.812500218862766, "name": "out-0", "alignment": "right", - "parentNode": "038a8325-01ef-4b7c-9e60-27ad3eb44e96", + "parentNode": "d59d9f14-ccc5-4d55-a568-c6ae810d73a4", "links": [ "3c2c4812-2310-4eec-952c-2976334cd2fe" ], @@ -1090,14 +1111,14 @@ "dataType": "" }, { - "id": "07fce528-8663-4510-899a-3c7904472dd1", + "id": "30312b14-3507-4b31-b048-2e2bb7ffbb01", "type": "default", "extras": {}, - "x": 792.072, - "y": 58.588, + "x": 822.5500317285888, + "y": 64.41250641774616, "name": "parameter-out-any-model", "alignment": "right", - "parentNode": "038a8325-01ef-4b7c-9e60-27ad3eb44e96", + "parentNode": "d59d9f14-ccc5-4d55-a568-c6ae810d73a4", "links": [ "3e540202-7bba-4fca-a741-ebb626d46f37" ], @@ -1105,32 +1126,32 @@ "label": "model", "varName": "model", "portType": "", - "dataType": "" + "dataType": "any" } ], "name": "SKLearnRandomForestClassifier", - "color": "rgb(153,51,204)", + "color": "rgb(153,0,102)", "portsInOrder": [ - "92a878e6-f87b-4ffd-8497-0239a21caf1b", - "ec14f9f2-07d1-47b4-9e5e-c15c9929a767" + "cb795633-8b5b-438f-bbfe-dcb54199c47b", + "b8efa66d-a0e7-4bad-96df-d5bfe9248fe7" ], "portsOutOrder": [ - "cad9a30b-9c1e-4137-a42e-cb54ba51dc55", - "07fce528-8663-4510-899a-3c7904472dd1" + "79cb9ae4-9bbf-4834-981c-fc5520a94fd8", + "30312b14-3507-4b31-b048-2e2bb7ffbb01" ] }, - "865e60e5-9806-45eb-b1b9-aa08ac31f640": { - "id": "865e60e5-9806-45eb-b1b9-aa08ac31f640", + "7d51db12-7711-4956-b937-73d04c15505c": { + "id": "7d51db12-7711-4956-b937-73d04c15505c", "type": "custom-node", "selected": true, "extras": { - "type": "debug", + "type": "library_component", "path": "xai_components/xai_sklearn/sklearn_utils.py", "description": "Evaluates a trained scikit-learn classification model using testing data, providing key metrics such as accuracy, precision, recall, and F1 score.\n\n#### Reference:\n- [sklearn.metrics](https://scikit-learn.org/stable/modules/classes.html#module-sklearn.metrics)\n\n##### inPorts:\n- X_test: Testing data features.\n- y_test: Testing data targets.\n- trained_model: The trained scikit-learn classification model.\n- average_method: The averaging method for multi-class classification metrics ('micro', 'macro', 'weighted'). Default is 'macro'.\n\n##### outPorts:\n- evaluation_metrics: The performance metrics of the model on testing data.", "lineNo": [ { - "lineno": 180, - "end_lineno": 220 + "lineno": 181, + "end_lineno": 225 } ] }, @@ -1138,14 +1159,14 @@ "y": 146.519, "ports": [ { - "id": "7f846f02-a464-499b-8c7f-291869d2def0", + "id": "feb679b5-29da-4f09-ae25-058731c8d800", "type": "default", "extras": {}, - "x": 1175.058, - "y": 173.102, + "x": 1174.374950396392, + "y": 173.31249797375455, "name": "in-0", "alignment": "left", - "parentNode": "865e60e5-9806-45eb-b1b9-aa08ac31f640", + "parentNode": "7d51db12-7711-4956-b937-73d04c15505c", "links": [ "fc7b5d75-4649-4e06-80e2-921852db8865" ], @@ -1156,14 +1177,14 @@ "dataType": "" }, { - "id": "5746d965-a062-439e-9e8f-75e2949ca754", + "id": "8111c534-2884-49a5-8f7a-71ca76bf9c97", "type": "default", "extras": {}, - "x": 1175.058, - "y": 189.086, + "x": 1174.374950396392, + "y": 194.91252992184573, "name": "parameter-any-X_test", "alignment": "left", - "parentNode": "865e60e5-9806-45eb-b1b9-aa08ac31f640", + "parentNode": "7d51db12-7711-4956-b937-73d04c15505c", "links": [ "88936993-3566-4da8-9623-6e35ec89a7f5" ], @@ -1174,14 +1195,14 @@ "dataType": "any" }, { - "id": "0b2e36a9-5e48-441f-844a-06a74efe19e9", + "id": "1d1c33c1-16eb-4c24-bbac-3206e12ff348", "type": "default", "extras": {}, - "x": 1175.058, - "y": 205.069, + "x": 1174.374950396392, + "y": 216.51245887310574, "name": "parameter-any-y_test", "alignment": "left", - "parentNode": "865e60e5-9806-45eb-b1b9-aa08ac31f640", + "parentNode": "7d51db12-7711-4956-b937-73d04c15505c", "links": [ "e7e7d6fc-8d73-4234-94c4-50f3e9da2dd2" ], @@ -1192,14 +1213,14 @@ "dataType": "any" }, { - "id": "27dec33c-d828-44db-9582-0e0cf1daf15a", + "id": "b2165601-2583-4011-9123-3f0c8803a804", "type": "default", "extras": {}, - "x": 1175.058, - "y": 221.053, + "x": 1174.374950396392, + "y": 238.11249082119693, "name": "parameter-any-trained_model", "alignment": "left", - "parentNode": "865e60e5-9806-45eb-b1b9-aa08ac31f640", + "parentNode": "7d51db12-7711-4956-b937-73d04c15505c", "links": [ "c6914c62-3370-4346-a896-3e4ae21a6302", "f1543d05-ca15-4123-9ea7-bbc4cba71106" @@ -1211,14 +1232,14 @@ "dataType": "any" }, { - "id": "1ef9690e-bde6-4802-8498-32f6e8727d5a", + "id": "bc2819aa-fff8-4882-be0c-ec5d916df9fc", "type": "default", "extras": {}, - "x": 1175.058, - "y": 237.037, + "x": 1174.374950396392, + "y": 259.7124712708725, "name": "parameter-string-average_method", "alignment": "left", - "parentNode": "865e60e5-9806-45eb-b1b9-aa08ac31f640", + "parentNode": "7d51db12-7711-4956-b937-73d04c15505c", "links": [], "in": true, "label": "average_method", @@ -1227,14 +1248,14 @@ "dataType": "string" }, { - "id": "9d46f601-ebc1-49e0-83f2-0be558965de4", + "id": "46f954df-6f57-43bb-8295-c4c6cb4aa997", "type": "default", "extras": {}, - "x": 1428.137, - "y": 173.102, + "x": 1399.2498888385887, + "y": 173.31249797375455, "name": "out-0", "alignment": "right", - "parentNode": "865e60e5-9806-45eb-b1b9-aa08ac31f640", + "parentNode": "7d51db12-7711-4956-b937-73d04c15505c", "links": [ "49517243-aed1-429a-8027-f1259ac91281" ], @@ -1245,34 +1266,34 @@ "dataType": "" }, { - "id": "bcbdbd98-61dd-4501-a22d-1e76ddf3e1e2", + "id": "5671e429-3537-4f8b-bd4c-e38e919c2f88", "type": "default", "extras": {}, - "x": 1428.137, - "y": 189.086, + "x": 1399.2498888385887, + "y": 194.91252992184573, "name": "parameter-out-dict-evaluation_metrics", "alignment": "right", - "parentNode": "865e60e5-9806-45eb-b1b9-aa08ac31f640", + "parentNode": "7d51db12-7711-4956-b937-73d04c15505c", "links": [], "in": false, "label": "evaluation_metrics", "varName": "evaluation_metrics", "portType": "", - "dataType": "" + "dataType": "dict" } ], "name": "SKLearnClassificationEvaluation", - "color": "rgb(255,153,0)", + "color": "rgb(255,204,0)", "portsInOrder": [ - "7f846f02-a464-499b-8c7f-291869d2def0", - "5746d965-a062-439e-9e8f-75e2949ca754", - "0b2e36a9-5e48-441f-844a-06a74efe19e9", - "27dec33c-d828-44db-9582-0e0cf1daf15a", - "1ef9690e-bde6-4802-8498-32f6e8727d5a" + "feb679b5-29da-4f09-ae25-058731c8d800", + "8111c534-2884-49a5-8f7a-71ca76bf9c97", + "1d1c33c1-16eb-4c24-bbac-3206e12ff348", + "b2165601-2583-4011-9123-3f0c8803a804", + "bc2819aa-fff8-4882-be0c-ec5d916df9fc" ], "portsOutOrder": [ - "9d46f601-ebc1-49e0-83f2-0be558965de4", - "bcbdbd98-61dd-4501-a22d-1e76ddf3e1e2" + "46f954df-6f57-43bb-8295-c4c6cb4aa997", + "5671e429-3537-4f8b-bd4c-e38e919c2f88" ] } } From d6e0ca7c3e6b72e48978419004dc452b93c45916 Mon Sep 17 00:00:00 2001 From: Mansour Alawi Date: Mon, 7 Oct 2024 11:15:02 +0800 Subject: [PATCH 4/5] Update README.md add logo --- README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8ee9b53..3c3790c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,4 @@ - - -

Component LibrariesProject Templates @@ -13,10 +10,12 @@ ContributeBlogDiscord + +

+

-< -

Xircuits Component Library for integrating scikit-learn models, datasets, and evaluation tools.

--- From 7c678413372cf4e6d8eb3fb50ada280ed18ff2f3 Mon Sep 17 00:00:00 2001 From: rabea-al Date: Mon, 7 Oct 2024 18:24:34 +0800 Subject: [PATCH 5/5] Update README and requirement --- README.md | 79 +++++++++++------------------------------------- requirements.txt | 2 +- 2 files changed, 18 insertions(+), 63 deletions(-) diff --git a/README.md b/README.md index 3c3790c..3257bfa 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ + + +

Component LibrariesProject Templates @@ -10,7 +13,8 @@ ContributeBlogDiscord - +

+

@@ -48,21 +52,17 @@ Before using this library, you’ll need the following: 3. **pandas**: For handling CSV and tabular data 4. **Xircuits**: To integrate the components into your workflows -## Installation -To install the SKLearn XAI Components Library, follow these steps: -### 1. Install the required dependencies +## Installation -Ensure that the required libraries are installed by running: +To use this component library, ensure that you have an existing [Xircuits setup](https://xircuits.io/docs/main/Installation). You can then install the SKLearn library using the [component library interface](https://xircuits.io/docs/component-library/installation#installation-using-the-xircuits-library-interface), or through the CLI using: -```bash -pip install -r requirements.txt +``` +xircuits install sklearn ``` -### 2. Add the components to your Xircuits project - -You can either pull the repository as a submodule or manually clone it into your **Xircuits** project directory: +You can also do it manually by cloning and installing it. ```bash # To clone the repository into your Xircuits project directory @@ -74,69 +74,24 @@ pip install -r xai_components/xai_sklearn/requirements.txt ## Getting Started with SKLearn XAI Components -Once you have installed the required libraries and components, you can start building machine learning workflows in **Xircuits** using the **SKLearn XAI Components Library**. - -Below is a sample workflow for training and evaluating a **RandomForestClassifier**. - -### Example Workflow: RandomForestClassifier - -1. **Load a Dataset** - Use `SKLearnLoadDataset` to load built-in datasets such as **Iris**: - ```python - dataset = SKLearnLoadDataset('iris') - ``` - -2. **Split the Dataset** - Split the data into training and testing sets using `SKLearnTrainTestSplit`: - ```python - X_train, X_test, y_train, y_test = SKLearnTrainTestSplit(dataset) - ``` - -3. **Initialize and Train the Model** - Initialize and train a **RandomForestClassifier**: - ```python - model = SKLearnRandomForestClassifier() - trained_model = SKLearnModelTraining(model, X_train, y_train) - ``` - -4. **Evaluate the Model** - Evaluate the model's performance using `SKLearnClassificationEvaluation`: - ```python - SKLearnClassificationEvaluation(trained_model, X_test, y_test) - ``` -For more detailed examples and component usage, refer to the **Component Documentation**. -## Components Overview +Now that you have installed the required libraries and components, you can begin using the SKLearn XAI Components Library to build machine learning workflows in Xircuits. Please follow the documentation and examples provided in the library to learn how to create, customize, and manage machine learning components using SKLearn XAI. -The **SKLearn XAI Components Library** is structured into several categories to cover the entire workflow of dataset handling, model training, and evaluation. -### Dataset Handling +## Try the Example -- **`SKLearnLoadDataset`**: Fetches built-in datasets from scikit-learn. -- **`CSVToSKLearnDataset`**: Converts a CSV file into a format compatible with scikit-learn datasets. +We have provided an example workflow to help you get started with the SKLearn XAI Components Library. Give it a try and see how you can create a custom machine learning workflow for your projects. -### Data Preprocessing +### Train Evaluate -- **`SKLearnTrainTestSplit`**: Splits datasets into training and testing sets with configurable options like shuffle and random state. +This example demonstrates a machine learning workflow in Xircuits using the SKLearn XAI Components Library. It creates a pipeline for loading the Iris dataset, splitting it, training a RandomForestClassifier, and evaluating its performance -### Model Training -- **`SKLearnModelTraining`**: Trains a scikit-learn model with the provided training data. -- **`SKLearnRandomForestClassifier`**: Initializes a **RandomForestClassifier**. -- **`SKLearnLogisticRegression`**: Initializes a **LogisticRegression** model. -- **`SKLearnSVC`**: Initializes a **Support Vector Classifier (SVC)**. -- **`SKLearnKNeighborsClassifier`**: Initializes a **KNeighborsClassifier**. -- **`SKLearnDecisionTreeClassifier`**: Initializes a **DecisionTreeClassifier**. -- **`SKLearnGradientBoostingClassifier`**: Initializes a **GradientBoostingClassifier**. -- **`SKLearnSVR`**: Initializes a **Support Vector Regression (SVR)** model. -- **`SKLearnMultinomialNB`**: Initializes a **Multinomial Naive Bayes** model. -- **`SKLearnRidgeRegression`**: Initializes a **Ridge Regression** model. -- **`SKLearnKMeans`**: Initializes a **KMeans** clustering model. +## Components Library -### Model Evaluation +The SKLearn XAI Components Library offers a variety of components designed to facilitate every stage of the machine learning process. You are encouraged to explore these components and consult their documentation to enhance your understanding and application in building effective machine learning workflows. -- **`SKLearnClassificationEvaluation`**: Evaluates a trained classification model using metrics such as accuracy, precision, recall, and F1-score. ## Contributing diff --git a/requirements.txt b/requirements.txt index 699f328..6b032c0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ scikit-learn==1.5.2 -pandas==2.2.3 +pandas