|
| 1 | +<h1 align="center"> |
| 2 | +<br> |
| 3 | +<a href="https://sinapsis.tech/"> |
| 4 | + <img |
| 5 | + src="https://github.com/Sinapsis-AI/brand-resources/blob/main/sinapsis_logo/4x/logo.png?raw=true" |
| 6 | + alt="" width="300"> |
| 7 | +</a><br> |
| 8 | +Sinapsis Data Analysis |
| 9 | +<br> |
| 10 | +</h1> |
| 11 | + |
| 12 | +<h4 align="center">Module for machine learning model training, analysis, and inference, using the Scikit-learn and XGBoost libraries.</h4> |
| 13 | + |
| 14 | +<p align="center"> |
| 15 | +<a href="#installation">🐍 Installation</a> • |
| 16 | +<a href="#features"> 🚀 Features</a> • |
| 17 | +<a href="#example"> 📚 Usage Example</a> • |
| 18 | +<a href="#documentation">📙 Documentation</a> • |
| 19 | +<a href="#license"> 🔍 License </a> |
| 20 | +</p> |
| 21 | + |
| 22 | +**Sinapsis Data Analysis** provides a comprehensive set of tools for machine learning model training, evaluation, and inference using industry-standard libraries like scikit-learn and XGBoost. |
| 23 | + |
| 24 | +<h2 id="installation"> 🐍 Installation </h2> |
| 25 | + |
| 26 | +Install using your package manager of choice. We encourage the use of <code>uv</code> |
| 27 | + |
| 28 | +Example with <code>uv</code>: |
| 29 | + |
| 30 | +```bash |
| 31 | + uv pip install sinapsis-data-analysis --extra-index-url https://pypi.sinapsis.tech |
| 32 | +``` |
| 33 | + or with raw <code>pip</code>: |
| 34 | +```bash |
| 35 | + pip install sinapsis-data-analysis --extra-index-url https://pypi.sinapsis.tech |
| 36 | +``` |
| 37 | + |
| 38 | + |
| 39 | +<h2 id="features">🚀 Features</h2> |
| 40 | + |
| 41 | +<h3> Templates Supported</h3> |
| 42 | + |
| 43 | +**Sinapsis Data Analysis** provides a variety of templates for machine learning workflows: |
| 44 | + |
| 45 | +<details> |
| 46 | +<summary><strong><span style="font-size: 1.25em;">Scikit-Learn Models</span></strong></summary> |
| 47 | + |
| 48 | +The following model types are supported: |
| 49 | + |
| 50 | +- **Linear Models**: LinearRegression, Ridge, Lasso, ElasticNet, LogisticRegression, etc. |
| 51 | +- **Neighbors Models**: KNeighborsClassifier, KNeighborsRegressor, RadiusNeighborsClassifier, etc. |
| 52 | +- **Neural Network Models**: MLPClassifier, MLPRegressor, BernoulliRBM |
| 53 | +- **Tree Models**: DecisionTreeClassifier, DecisionTreeRegressor, ExtraTreeClassifier, etc. |
| 54 | + |
| 55 | +Each template uses the same base attributes: |
| 56 | +- **`generic_field_key` (str, required)**: Key of the generic field where datasets are stored |
| 57 | +- **`model_save_path` (str, required)**: Path where the trained model will be saved |
| 58 | +</details> |
| 59 | + |
| 60 | +<details> |
| 61 | +<summary><strong><span style="font-size: 1.25em;">XGBoost Models</span></strong></summary> |
| 62 | + |
| 63 | +XGBoost model templates include: |
| 64 | +- XGBClassifier |
| 65 | +- XGBRegressor |
| 66 | +- XGBRanker |
| 67 | +- XGBRFClassifier |
| 68 | +- XGBRFRegressor |
| 69 | +- Booster |
| 70 | + |
| 71 | +Attributes are the same as those for Scikit-learn templates. |
| 72 | +</details> |
| 73 | + |
| 74 | +<details> |
| 75 | +<summary><strong><span style="font-size: 1.25em;">Manifold Learning</span></strong></summary> |
| 76 | + |
| 77 | +Templates for dimensionality reduction using scikit-learn's manifold learning techniques: |
| 78 | + |
| 79 | +- **SKLearnManifold**: Base class for all manifold learning algorithms |
| 80 | + - **`generic_field_key` (str, required)**: Key of the generic field where the input data is stored |
| 81 | + |
| 82 | +Specific algorithms include t-SNE, MDS, Isomap, LocallyLinearEmbedding, and more. |
| 83 | +</details> |
| 84 | + |
| 85 | +<details> |
| 86 | +<summary><strong><span style="font-size: 1.25em;">Inference Templates</span></strong></summary> |
| 87 | + |
| 88 | +Templates for using trained models to make predictions on new data: |
| 89 | + |
| 90 | +- **SKLearnInference**: For inference with scikit-learn models |
| 91 | +- **XGBoostInference**: For inference with XGBoost models |
| 92 | + |
| 93 | +To use these templates, you should replace the **`model_path`** to point to the path of the trained model. |
| 94 | +</details> |
| 95 | + |
| 96 | +> [!TIP] |
| 97 | +> Use CLI command ``` sinapsis info --all-template-names``` to show a list with all the available Template names installed with Sinapsis Data Analysis. |
| 98 | +
|
| 99 | +> [!TIP] |
| 100 | +> Use CLI command ```sinapsis info --example-template-config TEMPLATE_NAME``` to produce an example Agent config for the Template specified in ***TEMPLATE_NAME***. |
| 101 | +
|
| 102 | +For example, for ***LinearRegression*** use ```sinapsis info --example-template-config LinearRegression``` to produce an example config. |
| 103 | + |
| 104 | +<h2 id="example"> 📚 Usage Example </h2> |
| 105 | +Below is an example configuration for **Sinapsis Data Analysis** using LinearRegressionWrapper for regression. |
| 106 | + |
| 107 | +<details> |
| 108 | +<summary><strong><span style="font-size: 1.25em;">Example config</span></strong></summary> |
| 109 | + |
| 110 | +```yaml |
| 111 | +agent: |
| 112 | + name: sklearn_linear_models_agent |
| 113 | + description: agent to train a LinearRegression model from scikit-learn using the load_diabetes dataset |
| 114 | + |
| 115 | +templates: |
| 116 | +- template_name: InputTemplate |
| 117 | + class_name: InputTemplate |
| 118 | + attributes: {} |
| 119 | + |
| 120 | +- template_name: load_diabetesWrapper |
| 121 | + class_name: load_diabetesWrapper |
| 122 | + template_input: InputTemplate |
| 123 | + attributes: |
| 124 | + split_dataset: true |
| 125 | + train_size: 0.8 |
| 126 | + load_diabetes: |
| 127 | + return_X_y: false |
| 128 | + as_frame: true |
| 129 | + |
| 130 | +- template_name: LinearRegressionWrapper |
| 131 | + class_name: LinearRegressionWrapper |
| 132 | + template_input: load_diabetesWrapper |
| 133 | + attributes: |
| 134 | + generic_field_for_data: load_diabetesWrapper |
| 135 | + model_save_path: "artifacts/linear_regression.joblib" |
| 136 | + linearregression_init: |
| 137 | + fit_intercept: true |
| 138 | + copy_X: true |
| 139 | + n_jobs: null |
| 140 | + positive: false |
| 141 | +``` |
| 142 | +</details> |
| 143 | +
|
| 144 | +To run the config, use the CLI: |
| 145 | +```bash |
| 146 | +sinapsis run name_of_config.yml |
| 147 | +``` |
| 148 | + |
| 149 | +<h2 id="documentation">📙 Documentation</h2> |
| 150 | + |
| 151 | +Documentation for this and other sinapsis packages is available on the [sinapsis website](https://docs.sinapsis.tech/docs) |
| 152 | + |
| 153 | +Tutorials for different projects within sinapsis are available at [sinapsis tutorials page](https://docs.sinapsis.tech/tutorials) |
| 154 | + |
| 155 | +<h2 id="license">🔍 License</h2> |
| 156 | + |
| 157 | +This project is licensed under the AGPLv3 license, which encourages open collaboration and sharing. For more details, please refer to the [LICENSE](LICENSE) file. |
| 158 | + |
| 159 | +For commercial use, please refer to our [official Sinapsis website](https://sinapsis.tech) for information on obtaining a commercial license. |
0 commit comments