JustDataML 0.0.26__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,103 @@
1
+ import os
2
+ import sys
3
+ from dataclasses import dataclass
4
+
5
+ from sklearn.metrics import r2_score, accuracy_score
6
+
7
+
8
+ from ...source.Logger import logging
9
+ from ...source.Utils import save_object, evaluate_model
10
+ from ...source.Exception import CustomException
11
+
12
+
13
+
14
+
15
+ @dataclass
16
+ class ModelTrainerConfig:
17
+
18
+ """
19
+ Creating a Model Trainer Config to store model inot a pickle file
20
+
21
+ """
22
+
23
+ train_model_file_path = os.path.join("artifact","model.pkl")
24
+
25
+ class ModelTrainer:
26
+
27
+ """
28
+ Here we are Running the Models and Doing Evalution
29
+ It will train based on the Problem Objective (Regression or Classification)
30
+ If you have given Hyperparameter Argument as Yes it will do Hyperparater too for these Models
31
+ I have tried to include all most frequently used models for both objectives.
32
+ This Function will pick up the best Models and train on that model with best hyper parameter tuning.
33
+ """
34
+
35
+ def __init__(self, models, hyperparameter_yes_or_no, problem_objective):
36
+ self.Models = models
37
+ self.HyperParamter_Yes_or_No = hyperparameter_yes_or_no
38
+ self.Problem_Objective = problem_objective
39
+ self.model_trainer_config = ModelTrainerConfig()
40
+
41
+ def initiate_model_trainer(self,train_array,test_array):
42
+ try:
43
+ logging.info("Splitting Training and Test input Data into Features and Target")
44
+ X_train,y_train,X_test,y_test = (
45
+ train_array[:,:-1],
46
+ train_array[:,-1],
47
+ test_array[:,:-1],
48
+ test_array[:,-1]
49
+ )
50
+
51
+ models = self.Models
52
+ logging.info(f"It will use {list(models.keys())} Models for Training ")
53
+ Hyparams= self.HyperParamter_Yes_or_No
54
+ logging.info(f" Models are Running with HypterParater Configuration of [{Hyparams}]")
55
+
56
+ model_report:dict = evaluate_model(X_train=X_train,y_train=y_train,
57
+ X_test=X_test,y_test=y_test,
58
+ models= models,param = Hyparams,prob = self.Problem_Objective)
59
+
60
+ #print(model_report)
61
+ ## to get the best score from the model
62
+ best_model_score = max(sorted(model_report.values()))
63
+
64
+ ## to get the best model name from dict
65
+ best_model_name = list(model_report.keys())[
66
+ list(model_report.values()).index(best_model_score)
67
+ ]
68
+
69
+ best_model = models[best_model_name]
70
+
71
+
72
+ if (best_model_score < 0.8) and (best_model_score >= 0.5):
73
+ #raise CustomException("No Best model Found need improvment",sys)
74
+ logging.info(f'Note : Need Improvement \n The best model is {best_model_name} with score {best_model_score}')
75
+ elif best_model_score < 0.5:
76
+ #raise CustomException("Something is Wrong please check with Data ? Features and codes",sys)
77
+ logging.info(f" There is Some ERROR in your model or Code please check Data,Features and Codes \n The best model is {best_model_name} with score {best_model_score} ")
78
+ else:
79
+ print(f"The Best model is {best_model_name} with score of {best_model_score}")
80
+
81
+ logging.info(f"Model is Trained and output is there \n The Best model is {best_model_name} with score of {best_model_score}")
82
+
83
+ save_object(
84
+ file_path=self.model_trainer_config.train_model_file_path,
85
+ obj=best_model
86
+ )
87
+
88
+ predicted = best_model.predict(X_test)
89
+
90
+ if self.Problem_Objective == 'Regression':
91
+ matric = r2_score(y_test,predicted)
92
+ elif self.Problem_Objective == 'Classification':
93
+ matric = accuracy_score(y_test,predicted)
94
+ else:
95
+ print("Correct Problem Objective")
96
+
97
+
98
+ #print(f"The best Score is {r2_sq}")
99
+ return matric
100
+
101
+
102
+ except Exception as e:
103
+ raise CustomException(e,sys)
File without changes
@@ -0,0 +1,266 @@
1
+ Metadata-Version: 2.1
2
+ Name: JustDataML
3
+ Version: 0.0.26
4
+ Summary: This is a Machine Learning Tool Developed to Help Non Tech Students and Non Coders to try ML for there Data
5
+ Home-page: https://github.com/jaideepsinhdabhi/JustDataML
6
+ Author: Jaideepsinh Dabhi
7
+ Author-email: jadieep.dabhi7603@gmail.com
8
+ License: Apache License 2.0
9
+ Classifier: License :: OSI Approved :: Apache Software License
10
+ Classifier: Programming Language :: Python :: 3.9
11
+ Classifier: Operating System :: OS Independent
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: pandas
14
+ Requires-Dist: numpy
15
+ Requires-Dist: seaborn
16
+ Requires-Dist: matplotlib
17
+ Requires-Dist: scikit-learn
18
+ Requires-Dist: xgboost
19
+ Requires-Dist: setuptools
20
+
21
+
22
+ # JustDataML :Simplified Machine Learning for Everyone
23
+
24
+ Welcome to JustDataML, a user-friendly tool designed to make machine learning accessible to all, regardless of technical background. JustDataML automates the process of model selection, data preprocessing, and prediction, allowing you to focus on insights rather than coding complexities.
25
+
26
+
27
+ ## Authors
28
+
29
+ - [@jaideepsinhdabhi](https://www.github.com/jaideepsinhdabhi)
30
+
31
+
32
+ ## Features
33
+
34
+ - Automated Model Selection
35
+ - Streamlined Preprocessing
36
+ - Quick Predictions
37
+ - Flexible Configuration
38
+ - Hyperparameter Tuning
39
+ - Prediction accurately
40
+
41
+ ## Requirements
42
+
43
+ to Run this Tool you will Require
44
+ Below this thing to do
45
+
46
+
47
+ ## Installation
48
+
49
+ Suggestion: Please Use a Virtual env for this to succesfully run it
50
+
51
+ 1. Install my Application with pip install
52
+
53
+ ```bash
54
+ pip install JustDataML
55
+
56
+ ```
57
+ and Now you can use it as
58
+
59
+ ```bash
60
+ JDML --Config <Data Config file> --Train --Predict <test.csv> --Output <Output Name>
61
+
62
+ ```
63
+
64
+ 2. Install by cloning this repository
65
+
66
+ ```bash
67
+ git clone https://github.com/jaideepsinhdabhi/JustDataML.git
68
+ ```
69
+ Go into the Repo Folder
70
+
71
+ ```bash
72
+ cd JustDataML
73
+ ```
74
+ we need to download all the required packages
75
+ ```bash
76
+ pip install -r requirements.txt
77
+ ```
78
+ ## Usage/Examples CLI Tool
79
+
80
+ ```bash
81
+ python JDML/JDML.py -- Config <Data Config File> --Train --Predict <test.csv> --Output <Output Name>
82
+
83
+ ```
84
+ ### Arguments
85
+ - `-C, --Config`: [Compulsory] You need to provide a configuration file to obtain all the necessary arguments.
86
+
87
+ Note: Make sure you give proper argument mentioned in the Document.
88
+
89
+ - `-T, --Train`: [Optional] If provided, it initiates model training based on the specified data_config file.
90
+
91
+ Note : Ensure that the Data files are available in the "Data" folder.
92
+
93
+ - `-P, --Predict`: [Optional] If provided, performs prediction using the trained model. Make sure not to delete or modify the artifact folder to get the results.
94
+
95
+ - `-O, --Output`: [Required with -P (--Predict)] Specifies the output name for the predicted dataframe generated from the test data.
96
+ Note: it will also generate Model_summary file and if Hyperparameter is given Yes in Config file then it will generate stats file for that too
97
+
98
+
99
+
100
+ ## Usage/Examples Python
101
+
102
+ we can also use this tool as a python library
103
+ ```python
104
+ from JDML.JDML import Just_Data_ML
105
+ import argparse
106
+
107
+ ```
108
+ Import the Tool
109
+
110
+ ```python
111
+
112
+ arguments = argparse.Namespace(Config="Data_Config.csv",Train=True,Predict="Test.csv", Output="Output.csv")
113
+ ```
114
+ Yes we need to give arguments like this (will fix thsi issue in next release)
115
+
116
+ ```python
117
+ jdml=Just_Data_ML(arguments)
118
+
119
+ ```
120
+ parsing the arugments
121
+
122
+ ```python
123
+ jdml.Data_df
124
+ ```
125
+ For checking the DataFrame you provided
126
+
127
+ ```python
128
+ jdml.Data_train()
129
+ ```
130
+ For Model Training
131
+
132
+ ```python
133
+ jdml.Predict_test()
134
+
135
+ ```
136
+ For Predicting the Test gvien
137
+
138
+ Voila You will have the Prediction file (Column `Target_Out`) in the Output Folder.
139
+
140
+ ## Data Configuration File Example
141
+
142
+ This is an example of a data configuration file (`Data_Config.csv`) used with the JustData_ML (JDML) tool. This file specifies the necessary information for training and predicting with machine learning models.
143
+
144
+ ### CSV Structure:
145
+
146
+ The CSV file contains the following fields:
147
+
148
+ - **Data_Name:** Name of the dataset file with extension and it should be present in Data Folder (`Iris.data` in this example).
149
+ - **Features_Cols:** Comma-separated list of feature columns in the dataset (`sepal length, sepal width, petal length, petal width` in this example).
150
+ - **Target_Col:** Name of the target column in the dataset (`class` in this example).
151
+ - **Problem_Objective:** Objective of the machine learning task (`Classification` or `Regression`).
152
+ - **Normalization_tech:** Normalization technique to be applied (`StandardScaler`, `MinMaxScaler`, etc.).
153
+ - **Model_to_include:** Models to include in the training process (`ALL` or specific models). (below Listed for Models)
154
+ - **HyperParamter_Yes_or_No:** Indicates whether hyperparameter tuning should be performed (`Yes` or `No`).
155
+
156
+
157
+ ##### A sample csv file and some Data are there in Data Folder for a demo Run
158
+
159
+ #### Note : It will also generate logs into a logs folder for every run please check for every Run to get more idea on that.
160
+
161
+ ## Available Models for Regression and Classification
162
+
163
+ ### Regression Models:
164
+
165
+ 1. **Random Forest**
166
+ - Description: Random Forest is an ensemble learning method that operates by constructing multiple decision trees during training and outputting the mean prediction of the individual trees.
167
+
168
+ 2. **Decision Tree**
169
+ - Description: Decision Tree is a non-parametric supervised learning method used for classification and regression. It works by partitioning the input space into regions and predicting the target variable based on the average of the training instances in the corresponding region.
170
+
171
+ 3. **Gradient Boosting**
172
+ - Description: Gradient Boosting is a machine learning technique for regression and classification problems that builds models in a stage-wise manner and tries to fit new models to the residuals of the previous models.
173
+
174
+ 4. **Linear Regression**
175
+ - Description: Linear Regression is a linear approach to modeling the relationship between a dependent variable and one or more independent variables.
176
+
177
+ 5. **XGBRegressor**
178
+ - Description: XGBoost is an optimized distributed gradient boosting library designed to be highly efficient, flexible, and portable.
179
+
180
+ 6. **Support Vector Reg**
181
+ - Description: Support Vector Regression (SVR) is a type of Support Vector Machine (SVM) algorithm that is used to predict a continuous variable.
182
+
183
+ 7. **Linear Ridge**
184
+ - Description: Ridge Regression is a linear regression technique that is used to analyze multiple regression data that suffer from multicollinearity.
185
+
186
+ 8. **Linear Lasso**
187
+ - Description: Lasso regression is a type of linear regression that uses shrinkage. It penalizes the absolute size of the regression coefficients.
188
+
189
+ 9. **ElasticNet**
190
+ - Description: ElasticNet is a linear regression model that combines the properties of Ridge Regression and Lasso Regression.
191
+
192
+ 10. **AdaBoost Regressor**
193
+ - Description: AdaBoost (Adaptive Boosting) is an ensemble learning method that combines multiple weak learners to create a strong learner.
194
+
195
+ 11. **KNeighborsRegressor**
196
+ - Description: KNeighborsRegressor is a simple, non-parametric method used for regression tasks based on the k-nearest neighbors algorithm.
197
+
198
+ ### Classification Models:
199
+
200
+ 1. **Logistic Regression**
201
+ - Description: Logistic Regression is a statistical method for analyzing a dataset in which there are one or more independent variables that determine an outcome.
202
+
203
+ 2. **Ridge Classification**
204
+ - Description: Ridge Classifier is a classifier that uses Ridge Regression to classify data points.
205
+
206
+ 3. **GaussianNB**
207
+ - Description: Gaussian Naive Bayes is a simple probabilistic classifier based on applying Bayes' theorem with strong independence assumptions between the features.
208
+
209
+ 4. **KNeighborsClassifier**
210
+ - Description: KNeighborsClassifier is a simple, instance-based learning algorithm used for classification tasks based on the k-nearest neighbors algorithm.
211
+
212
+ 5. **Decision Tree Classifier**
213
+ - Description: Decision Tree Classifier is a non-parametric supervised learning method used for classification.
214
+
215
+ 6. **Random Forest Classifier**
216
+ - Description: Random Forest Classifier is an ensemble learning method for classification that operates by constructing multiple decision trees during training and outputting the class that is the mode of the classes (classification) of the individual trees.
217
+
218
+ 7. **Support Vector Classifier**
219
+ - Description: Support Vector Classifier (SVC) is a type of Support Vector Machine (SVM) algorithm that is used for classification tasks.
220
+
221
+ 8. **AdaBoost Classifier**
222
+ - Description: AdaBoost Classifier is an ensemble learning method that combines multiple weak learners to create a strong learner.
223
+
224
+ 9. **Gradient Boosting Classifier**
225
+ - Description: Gradient Boosting Classifier is a machine learning technique for classification problems that builds models in a stage-wise manner and tries to fit new models to the residuals of the previous models.
226
+
227
+ 10. **XGBClassifier**
228
+ - Description: XGBoost Classifier is an optimized distributed gradient boosting library designed for classification problems.
229
+
230
+ These are the available regression and classification models supported by the JDML tool. You can use them for training and prediction based on your specific machine learning tasks.
231
+
232
+ ## Feedback
233
+
234
+ If you have any feedback or suggestions , please reach out to us at jaideep.dabhi7603@gmail.com
235
+
236
+
237
+ ## Acknowledgements
238
+
239
+ - [Krish Naik Playlist of End-to-End Machine Learning Project](https://youtube.com/playlist?list=PLZoTAELRMXVPS-dOaVbAux22vzqdgoGhG&si=Q1cXWDAZIdeeiC3m) This playlist really helped a lot I followed till the end and tried to code at the same time.
240
+
241
+
242
+ - [Krish Naik Github Repo for Above Project ](https://github.com/krishnaik06/mlproject) Github Repo from the playlist for reference.
243
+ - [How to Build a Complete Python Package Step-by-Step by ArjanCodes](https://youtu.be/5KEObONUkik?si=QYVU4lu8tpfmyTXV). This video really helped me to write a python Package and published it to the [PyPi](pypi.org)
244
+
245
+ # Hi, I'm Jaideepsinh Dabhi (jD)! 👋
246
+
247
+
248
+ ## 🚀 About Me
249
+
250
+ 🚀 Data Scientist | Analytics Enthusiast | Python Aficionado 🐍 \
251
+ I'm a Data Scientist working in a BioTech Industry.\
252
+ I am based out of India 🇮🇳 \
253
+ I love to code in python ,Bash and R \
254
+ I have a strong base in statistics and Machine learning \
255
+ I am passionate about networking and fostering meaningful connections within the tech community. Feel free to reach out if you'd like to discuss Data Science 👨🏻‍💻, Machine Learning 🦾, Chess ♞ or Pens 🖋️
256
+
257
+
258
+ ## 🔗 Links
259
+ [![GitHub](https://img.shields.io/badge/my_portfolio-000?style=for-the-badge&logo=ko-fi&logoColor=white)](https://github.com/jaideepsinhdabhi)
260
+ [![linkedin](https://img.shields.io/badge/linkedin-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/jaideepsinh-d-543476167/)
261
+
262
+
263
+
264
+ ## License
265
+
266
+ This project is licensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0)
@@ -0,0 +1,19 @@
1
+ JDML/JDML.py,sha256=W1bLCfqJjlv28jZw3DOauR7orB5K6S-324cllsXYmNo,6736
2
+ JDML/__init__.py,sha256=JvBMwcE9Lye9-8HZI2rKCPjBdunrBedsMW4dpRfn-Tk,8
3
+ JDML/source/Configuration.py,sha256=r3r8uQf9nxlbiz2Zs9FsMb9_tcg-0PKN6juZ2NQ_jto,2596
4
+ JDML/source/Exception.py,sha256=gNGdFUci-iZSopoFWGxr0f-Fsrm-Oc4RdOHrSlbcbLM,636
5
+ JDML/source/Logger.py,sha256=2G5XlkziDT2sKX96cL0wh7f4GLyAGr45Le--9ldKcLU,474
6
+ JDML/source/Utils.py,sha256=a7kmaLjq5jX2SwXvdc_KHCVlK1pao9kIP5rtjwZysps,13717
7
+ JDML/source/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ JDML/source/Pipeline/Predict_Pipeline.py,sha256=NgQPPQh2U37tyb_9mHARtcDaBRJtIVkTnLPv10nqqZM,86942
9
+ JDML/source/Pipeline/Train_Pipeline.py,sha256=Wa-l2Zo-DLvAJEF-hwbabKKT4SQKdEMqOzgoOXPNmx4,1935
10
+ JDML/source/Pipeline/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ JDML/source/components/Data_Transformation.py,sha256=3eultgHPZ3ZSFIK5-kx0W6OcvhfznqHrITQnfisdtBA,6604
12
+ JDML/source/components/Data_ingestion.py,sha256=awQofJ33JG4MrNRFRsvOaQrPa3XFr4TRlyMtjl7QgyI,1916
13
+ JDML/source/components/Model_Trainer.py,sha256=cO-6mksI8IP_wiQb_9bF3djL7t2jJvhaQY-G1yT8Gw4,4028
14
+ JDML/source/components/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
+ JustDataML-0.0.26.dist-info/METADATA,sha256=oEeAF-kq8CwOXaaCMvsfb3n--OQRXuZg_Jh0AyeDQOM,10934
16
+ JustDataML-0.0.26.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
17
+ JustDataML-0.0.26.dist-info/entry_points.txt,sha256=-kpNjSUFAaqE-eIhx3JpZUJZplbu05_gUejVCFkv2T0,42
18
+ JustDataML-0.0.26.dist-info/top_level.txt,sha256=wpT5y6dLBGoQVit7ia4ZFyCIlUTDnH1A50Tx5k8r3x0,5
19
+ JustDataML-0.0.26.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.41.2)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ JDML = JDML.JDML:MLtool
@@ -0,0 +1 @@
1
+ JDML