mlforgex 1.0.0__tar.gz → 1.0.2__tar.gz
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.
- mlforgex-1.0.2/PKG-INFO +142 -0
- mlforgex-1.0.2/README.md +109 -0
- {mlforgex-1.0.0 → mlforgex-1.0.2}/mlforge/predict.py +5 -5
- {mlforgex-1.0.0 → mlforgex-1.0.2}/mlforge/train.py +33 -24
- mlforgex-1.0.2/mlforgex.egg-info/PKG-INFO +142 -0
- mlforgex-1.0.2/mlforgex.egg-info/requires.txt +7 -0
- mlforgex-1.0.2/setup.py +39 -0
- mlforgex-1.0.0/PKG-INFO +0 -22
- mlforgex-1.0.0/README.md +0 -121
- mlforgex-1.0.0/mlforgex.egg-info/PKG-INFO +0 -22
- mlforgex-1.0.0/mlforgex.egg-info/requires.txt +0 -3
- mlforgex-1.0.0/setup.py +0 -27
- {mlforgex-1.0.0 → mlforgex-1.0.2}/LICENSE +0 -0
- {mlforgex-1.0.0 → mlforgex-1.0.2}/mlforge/__init__.py +0 -0
- {mlforgex-1.0.0 → mlforgex-1.0.2}/mlforgex.egg-info/SOURCES.txt +0 -0
- {mlforgex-1.0.0 → mlforgex-1.0.2}/mlforgex.egg-info/dependency_links.txt +0 -0
- {mlforgex-1.0.0 → mlforgex-1.0.2}/mlforgex.egg-info/entry_points.txt +0 -0
- {mlforgex-1.0.0 → mlforgex-1.0.2}/mlforgex.egg-info/top_level.txt +0 -0
- {mlforgex-1.0.0 → mlforgex-1.0.2}/pyproject.toml +0 -0
- {mlforgex-1.0.0 → mlforgex-1.0.2}/setup.cfg +0 -0
- {mlforgex-1.0.0 → mlforgex-1.0.2}/test/test_basic.py +0 -0
mlforgex-1.0.2/PKG-INFO
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mlforgex
|
|
3
|
+
Version: 1.0.2
|
|
4
|
+
Summary: Lightweight ML utility for automated training, evaluation, and prediction with CLI and Python API support
|
|
5
|
+
Home-page: https://github.com/yourusername/mlforge
|
|
6
|
+
Author: Priyanshu Mathur
|
|
7
|
+
Author-email: mathurpriyanshu2006@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Requires-Python: >=3.8
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: pandas
|
|
16
|
+
Requires-Dist: numpy
|
|
17
|
+
Requires-Dist: seaborn
|
|
18
|
+
Requires-Dist: matplotlib
|
|
19
|
+
Requires-Dist: scikit-learn
|
|
20
|
+
Requires-Dist: xgboost
|
|
21
|
+
Requires-Dist: imbalanced-learn
|
|
22
|
+
Dynamic: author
|
|
23
|
+
Dynamic: author-email
|
|
24
|
+
Dynamic: classifier
|
|
25
|
+
Dynamic: description
|
|
26
|
+
Dynamic: description-content-type
|
|
27
|
+
Dynamic: home-page
|
|
28
|
+
Dynamic: license
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
Dynamic: requires-dist
|
|
31
|
+
Dynamic: requires-python
|
|
32
|
+
Dynamic: summary
|
|
33
|
+
|
|
34
|
+
# mlforgex
|
|
35
|
+
|
|
36
|
+
**mlforgex** is a Python package that enables easy training, evaluation, and prediction for machine learning models on cleaned dataset. It supports both classification and regression problems, automates preprocessing, model selection, hyperparameter tuning, and generates useful artifacts and plots for analysis.
|
|
37
|
+
|
|
38
|
+
## Features
|
|
39
|
+
|
|
40
|
+
- Automatic data preprocessing (missing value handling, encoding, scaling)
|
|
41
|
+
- Imbalance handling (under-sampling, over-sampling)
|
|
42
|
+
- Model selection and evaluation (classification & regression)
|
|
43
|
+
- Hyperparameter tuning with RandomizedSearchCV
|
|
44
|
+
- Artifact saving (model, preprocessor, encoder)
|
|
45
|
+
- Visualization of metrics and learning curves
|
|
46
|
+
- Simple CLI for training and prediction
|
|
47
|
+
|
|
48
|
+
## Installation
|
|
49
|
+
|
|
50
|
+
Install mlforge using pip:
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
pip install mlforgex
|
|
54
|
+
```
|
|
55
|
+
stall .
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Requirements
|
|
59
|
+
|
|
60
|
+
- Python >= 3.8
|
|
61
|
+
- pandas
|
|
62
|
+
- numpy
|
|
63
|
+
- scikit-learn
|
|
64
|
+
- seaborn
|
|
65
|
+
- matplotlib
|
|
66
|
+
- xgboost
|
|
67
|
+
- imbalanced-learn
|
|
68
|
+
|
|
69
|
+
See [requirements.txt](requirements.txt) for details.
|
|
70
|
+
|
|
71
|
+
## Usage
|
|
72
|
+
|
|
73
|
+
### Train a Model
|
|
74
|
+
|
|
75
|
+
You can train a model using the CLI:
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
mlforge-train --data_path path/to/your/data.csv --dependent_feature TargetColumn --rmse_prob 0.3 --f1_prob 0.7 --n_jobs -1 --n_iter 100 --cv 3
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Or programmatically:
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
from mlforge import train_model
|
|
85
|
+
|
|
86
|
+
result = train_model(
|
|
87
|
+
data_path=<data_path>,
|
|
88
|
+
dependent_feature=<dependent_feature>,
|
|
89
|
+
rmse_prob=<rmse_probability>,
|
|
90
|
+
f1_prob=<f1_probability>,
|
|
91
|
+
n_jobs=<n_jobs>
|
|
92
|
+
)
|
|
93
|
+
print(result)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Predict
|
|
97
|
+
|
|
98
|
+
Use the CLI:
|
|
99
|
+
|
|
100
|
+
```sh
|
|
101
|
+
mlforge-predict --model_path path/to/model.pkl --preprocessor_path path/to/preprocessor.pkl --input_data path/to/input.csv --encoder_path path/to/encoder.pkl
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Or programmatically:
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
from mlforge import predict
|
|
108
|
+
|
|
109
|
+
result = predict(
|
|
110
|
+
<model.pkl>,
|
|
111
|
+
<preprocessor.pkl>,
|
|
112
|
+
<input_data.csv>,
|
|
113
|
+
<encoder.pkl>
|
|
114
|
+
)
|
|
115
|
+
print(result)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Artifacts
|
|
119
|
+
|
|
120
|
+
After training, the following files are saved :
|
|
121
|
+
|
|
122
|
+
- `model.pkl`: Trained model
|
|
123
|
+
- `preprocessor.pkl`: Preprocessing pipeline
|
|
124
|
+
- `encoder.pkl`: Label encoder (for classification)
|
|
125
|
+
- `Plots/`: Visualizations (correlation heatmap, confusion matrix, ROC curve, etc.)
|
|
126
|
+
|
|
127
|
+
## Testing
|
|
128
|
+
|
|
129
|
+
Run tests using pytest:
|
|
130
|
+
|
|
131
|
+
```sh
|
|
132
|
+
pytest test/
|
|
133
|
+
```
|
|
134
|
+
## Author
|
|
135
|
+
|
|
136
|
+
Priyanshu Mathur
|
|
137
|
+
[Portfolio](https://my-portfolio-phi-two-53.vercel.app/)
|
|
138
|
+
Email: mathurpriyanshu2006@gmail.com
|
|
139
|
+
|
|
140
|
+
## Project Links
|
|
141
|
+
|
|
142
|
+
- [PyPI](https://pypi.org/project/mlforgex/)
|
mlforgex-1.0.2/README.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# mlforgex
|
|
2
|
+
|
|
3
|
+
**mlforgex** is a Python package that enables easy training, evaluation, and prediction for machine learning models on cleaned dataset. It supports both classification and regression problems, automates preprocessing, model selection, hyperparameter tuning, and generates useful artifacts and plots for analysis.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Automatic data preprocessing (missing value handling, encoding, scaling)
|
|
8
|
+
- Imbalance handling (under-sampling, over-sampling)
|
|
9
|
+
- Model selection and evaluation (classification & regression)
|
|
10
|
+
- Hyperparameter tuning with RandomizedSearchCV
|
|
11
|
+
- Artifact saving (model, preprocessor, encoder)
|
|
12
|
+
- Visualization of metrics and learning curves
|
|
13
|
+
- Simple CLI for training and prediction
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
Install mlforge using pip:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
pip install mlforgex
|
|
21
|
+
```
|
|
22
|
+
stall .
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Requirements
|
|
26
|
+
|
|
27
|
+
- Python >= 3.8
|
|
28
|
+
- pandas
|
|
29
|
+
- numpy
|
|
30
|
+
- scikit-learn
|
|
31
|
+
- seaborn
|
|
32
|
+
- matplotlib
|
|
33
|
+
- xgboost
|
|
34
|
+
- imbalanced-learn
|
|
35
|
+
|
|
36
|
+
See [requirements.txt](requirements.txt) for details.
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
### Train a Model
|
|
41
|
+
|
|
42
|
+
You can train a model using the CLI:
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
mlforge-train --data_path path/to/your/data.csv --dependent_feature TargetColumn --rmse_prob 0.3 --f1_prob 0.7 --n_jobs -1 --n_iter 100 --cv 3
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Or programmatically:
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
from mlforge import train_model
|
|
52
|
+
|
|
53
|
+
result = train_model(
|
|
54
|
+
data_path=<data_path>,
|
|
55
|
+
dependent_feature=<dependent_feature>,
|
|
56
|
+
rmse_prob=<rmse_probability>,
|
|
57
|
+
f1_prob=<f1_probability>,
|
|
58
|
+
n_jobs=<n_jobs>
|
|
59
|
+
)
|
|
60
|
+
print(result)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Predict
|
|
64
|
+
|
|
65
|
+
Use the CLI:
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
mlforge-predict --model_path path/to/model.pkl --preprocessor_path path/to/preprocessor.pkl --input_data path/to/input.csv --encoder_path path/to/encoder.pkl
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Or programmatically:
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from mlforge import predict
|
|
75
|
+
|
|
76
|
+
result = predict(
|
|
77
|
+
<model.pkl>,
|
|
78
|
+
<preprocessor.pkl>,
|
|
79
|
+
<input_data.csv>,
|
|
80
|
+
<encoder.pkl>
|
|
81
|
+
)
|
|
82
|
+
print(result)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Artifacts
|
|
86
|
+
|
|
87
|
+
After training, the following files are saved :
|
|
88
|
+
|
|
89
|
+
- `model.pkl`: Trained model
|
|
90
|
+
- `preprocessor.pkl`: Preprocessing pipeline
|
|
91
|
+
- `encoder.pkl`: Label encoder (for classification)
|
|
92
|
+
- `Plots/`: Visualizations (correlation heatmap, confusion matrix, ROC curve, etc.)
|
|
93
|
+
|
|
94
|
+
## Testing
|
|
95
|
+
|
|
96
|
+
Run tests using pytest:
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
pytest test/
|
|
100
|
+
```
|
|
101
|
+
## Author
|
|
102
|
+
|
|
103
|
+
Priyanshu Mathur
|
|
104
|
+
[Portfolio](https://my-portfolio-phi-two-53.vercel.app/)
|
|
105
|
+
Email: mathurpriyanshu2006@gmail.com
|
|
106
|
+
|
|
107
|
+
## Project Links
|
|
108
|
+
|
|
109
|
+
- [PyPI](https://pypi.org/project/mlforgex/)
|
|
@@ -14,10 +14,10 @@ def predict(model_path,preprocessor_path,input_data, encoder_path=None):
|
|
|
14
14
|
def main():
|
|
15
15
|
import argparse
|
|
16
16
|
parser = argparse.ArgumentParser()
|
|
17
|
-
parser.add_argument("--
|
|
18
|
-
parser.add_argument("--
|
|
19
|
-
parser.add_argument("--
|
|
20
|
-
parser.add_argument("--
|
|
17
|
+
parser.add_argument("--model_path", required=True)
|
|
18
|
+
parser.add_argument("--input_data", required=True)
|
|
19
|
+
parser.add_argument("--preprocessor_path", required=True)
|
|
20
|
+
parser.add_argument("--encoder_path", required=False)
|
|
21
21
|
args = parser.parse_args()
|
|
22
|
-
print(predict(args.
|
|
22
|
+
print(predict(args.model_path, args.preprocessor_path, args.input_data, args.encoder_path))
|
|
23
23
|
|
|
@@ -25,9 +25,12 @@ from sklearn.inspection import permutation_importance
|
|
|
25
25
|
from sklearn.model_selection import learning_curve
|
|
26
26
|
import warnings
|
|
27
27
|
warnings.filterwarnings("ignore")
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
def train_model(data_path, dependent_feature,rmse_prob,f1_prob,n_jobs=-1,n_iter=100,cv=3,artifacts_dir=None):
|
|
29
|
+
if artifacts_dir:
|
|
30
|
+
artifacts_path = os.path.join(artifacts_dir, "artifacts")
|
|
31
|
+
else:
|
|
32
|
+
artifacts_path = os.path.join(os.getcwd(), "artifacts")
|
|
33
|
+
plot_path=os.path.join(artifacts_path,"Plots")
|
|
31
34
|
os.makedirs(artifacts_path,exist_ok=True)
|
|
32
35
|
print("Getting data from:",data_path)
|
|
33
36
|
data=pd.read_csv(data_path)
|
|
@@ -41,7 +44,7 @@ def train_model(data_path, dependent_feature,rmse_prob,f1_prob,n_jobs=-1,n_iter=
|
|
|
41
44
|
df[i] = df[i].fillna(df[i].mode()[0])
|
|
42
45
|
else:
|
|
43
46
|
df[i] = df[i].fillna(df[i].median())
|
|
44
|
-
|
|
47
|
+
df.drop_duplicates(inplace=True, ignore_index=True)
|
|
45
48
|
mild=False
|
|
46
49
|
moderate=False
|
|
47
50
|
majority=max(df[dependent_feature].value_counts())
|
|
@@ -113,17 +116,18 @@ def train_model(data_path, dependent_feature,rmse_prob,f1_prob,n_jobs=-1,n_iter=
|
|
|
113
116
|
num_features = [i for i in x_train.columns if x_train[i].dtype != "object" and i != dependent_feature]
|
|
114
117
|
print("Categorical features : ",cat_features)
|
|
115
118
|
print("Numerical features : ",num_features)
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
119
|
+
if classification:
|
|
120
|
+
print("Balancing the dataset...")
|
|
121
|
+
if mild :
|
|
122
|
+
from imblearn.under_sampling import RandomUnderSampler
|
|
123
|
+
undersampler = RandomUnderSampler(random_state=42)
|
|
124
|
+
x_train, y_train = undersampler.fit_resample(x_train, y_train)
|
|
125
|
+
print("Mild Imbalance Resolved")
|
|
126
|
+
if moderate:
|
|
127
|
+
from imblearn.over_sampling import SMOTETomek
|
|
128
|
+
smote_tomek = SMOTETomek(random_state=42)
|
|
129
|
+
x_train, y_train = smote_tomek.fit_resample(x_train, y_train)
|
|
130
|
+
print("Moderate Imbalace Resolved")
|
|
127
131
|
|
|
128
132
|
|
|
129
133
|
|
|
@@ -762,7 +766,7 @@ def train_model(data_path, dependent_feature,rmse_prob,f1_prob,n_jobs=-1,n_iter=
|
|
|
762
766
|
"Dropped_Columns":list(dropcorr)
|
|
763
767
|
}
|
|
764
768
|
}
|
|
765
|
-
plot_classification_metrics(model,x_train, y_train, x_test, y_test, class_names=['No', 'Yes'])
|
|
769
|
+
plot_classification_metrics(model,x_train, y_train, x_test, y_test, class_names=['No', 'Yes'],plot_path=plot_path)
|
|
766
770
|
else:
|
|
767
771
|
response={
|
|
768
772
|
"message": "Training completed successfully",
|
|
@@ -777,11 +781,16 @@ def train_model(data_path, dependent_feature,rmse_prob,f1_prob,n_jobs=-1,n_iter=
|
|
|
777
781
|
"Dropped_Columns":list(dropcorr)
|
|
778
782
|
}
|
|
779
783
|
}
|
|
780
|
-
plot_regression_metrics(model, x_train, y_train, x_test, y_test,feature_names)
|
|
784
|
+
plot_regression_metrics(model, x_train, y_train, x_test, y_test,feature_names,plot_path=plot_path)
|
|
781
785
|
print(response)
|
|
786
|
+
print("artifacts_path:", artifacts_path)
|
|
787
|
+
print("model_path:", model_path)
|
|
788
|
+
print("preprocessor_path:", preprocessor_path)
|
|
789
|
+
if encoder_path:
|
|
790
|
+
print("encoder_path:", encoder_path)
|
|
782
791
|
return {"status": "success", "model": "trained_model.pkl"}
|
|
783
792
|
|
|
784
|
-
def plot_classification_metrics(model, X_train, y_train, X_test, y_test, class_names=None):
|
|
793
|
+
def plot_classification_metrics(model, X_train, y_train, X_test, y_test, plot_path,class_names=None):
|
|
785
794
|
# Predict
|
|
786
795
|
y_pred = model.predict(X_test)
|
|
787
796
|
y_proba = model.predict_proba(X_test)[:, 1] if hasattr(model, "predict_proba") else None
|
|
@@ -826,7 +835,7 @@ def plot_classification_metrics(model, X_train, y_train, X_test, y_test, class_n
|
|
|
826
835
|
ax[1].set_title("Testing Class Distribution")
|
|
827
836
|
plt.savefig(os.path.join(plot_path,"class_distribution.png"), bbox_inches='tight')
|
|
828
837
|
plt.close()
|
|
829
|
-
def plot_regression_metrics(model, X_train, y_train, X_test, y_test,feature_names):
|
|
838
|
+
def plot_regression_metrics(model, X_train, y_train, X_test, y_test,feature_names,plot_path):
|
|
830
839
|
y_pred = model.predict(X_test)
|
|
831
840
|
residuals = y_test - y_pred
|
|
832
841
|
|
|
@@ -867,13 +876,13 @@ def plot_regression_metrics(model, X_train, y_train, X_test, y_test,feature_name
|
|
|
867
876
|
def main():
|
|
868
877
|
import argparse
|
|
869
878
|
parser = argparse.ArgumentParser()
|
|
870
|
-
parser.add_argument("--
|
|
871
|
-
parser.add_argument("--
|
|
872
|
-
parser.add_argument("--
|
|
873
|
-
parser.add_argument("--
|
|
879
|
+
parser.add_argument("--data_path", required=True)
|
|
880
|
+
parser.add_argument("--dependent_feature", required=True)
|
|
881
|
+
parser.add_argument("--rmse_prob", required=True)
|
|
882
|
+
parser.add_argument("--f1_prob", required=True)
|
|
874
883
|
parser.add_argument("--n_jobs", default=-1, type=int)
|
|
875
884
|
parser.add_argument("--n_iter", default=100, type=int)
|
|
876
885
|
parser.add_argument("--cv", default=3, type=int)
|
|
877
886
|
args = parser.parse_args()
|
|
878
|
-
print(train_model(args.
|
|
887
|
+
print(train_model(args.data_path, args.dependent_feature, rmse_prob=args.rmse_prob, f1_prob=args.f1_prob, n_jobs=args.n_jobs, n_iter=args.n_iter, cv=args.cv))
|
|
879
888
|
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mlforgex
|
|
3
|
+
Version: 1.0.2
|
|
4
|
+
Summary: Lightweight ML utility for automated training, evaluation, and prediction with CLI and Python API support
|
|
5
|
+
Home-page: https://github.com/yourusername/mlforge
|
|
6
|
+
Author: Priyanshu Mathur
|
|
7
|
+
Author-email: mathurpriyanshu2006@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Requires-Python: >=3.8
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: pandas
|
|
16
|
+
Requires-Dist: numpy
|
|
17
|
+
Requires-Dist: seaborn
|
|
18
|
+
Requires-Dist: matplotlib
|
|
19
|
+
Requires-Dist: scikit-learn
|
|
20
|
+
Requires-Dist: xgboost
|
|
21
|
+
Requires-Dist: imbalanced-learn
|
|
22
|
+
Dynamic: author
|
|
23
|
+
Dynamic: author-email
|
|
24
|
+
Dynamic: classifier
|
|
25
|
+
Dynamic: description
|
|
26
|
+
Dynamic: description-content-type
|
|
27
|
+
Dynamic: home-page
|
|
28
|
+
Dynamic: license
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
Dynamic: requires-dist
|
|
31
|
+
Dynamic: requires-python
|
|
32
|
+
Dynamic: summary
|
|
33
|
+
|
|
34
|
+
# mlforgex
|
|
35
|
+
|
|
36
|
+
**mlforgex** is a Python package that enables easy training, evaluation, and prediction for machine learning models on cleaned dataset. It supports both classification and regression problems, automates preprocessing, model selection, hyperparameter tuning, and generates useful artifacts and plots for analysis.
|
|
37
|
+
|
|
38
|
+
## Features
|
|
39
|
+
|
|
40
|
+
- Automatic data preprocessing (missing value handling, encoding, scaling)
|
|
41
|
+
- Imbalance handling (under-sampling, over-sampling)
|
|
42
|
+
- Model selection and evaluation (classification & regression)
|
|
43
|
+
- Hyperparameter tuning with RandomizedSearchCV
|
|
44
|
+
- Artifact saving (model, preprocessor, encoder)
|
|
45
|
+
- Visualization of metrics and learning curves
|
|
46
|
+
- Simple CLI for training and prediction
|
|
47
|
+
|
|
48
|
+
## Installation
|
|
49
|
+
|
|
50
|
+
Install mlforge using pip:
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
pip install mlforgex
|
|
54
|
+
```
|
|
55
|
+
stall .
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Requirements
|
|
59
|
+
|
|
60
|
+
- Python >= 3.8
|
|
61
|
+
- pandas
|
|
62
|
+
- numpy
|
|
63
|
+
- scikit-learn
|
|
64
|
+
- seaborn
|
|
65
|
+
- matplotlib
|
|
66
|
+
- xgboost
|
|
67
|
+
- imbalanced-learn
|
|
68
|
+
|
|
69
|
+
See [requirements.txt](requirements.txt) for details.
|
|
70
|
+
|
|
71
|
+
## Usage
|
|
72
|
+
|
|
73
|
+
### Train a Model
|
|
74
|
+
|
|
75
|
+
You can train a model using the CLI:
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
mlforge-train --data_path path/to/your/data.csv --dependent_feature TargetColumn --rmse_prob 0.3 --f1_prob 0.7 --n_jobs -1 --n_iter 100 --cv 3
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Or programmatically:
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
from mlforge import train_model
|
|
85
|
+
|
|
86
|
+
result = train_model(
|
|
87
|
+
data_path=<data_path>,
|
|
88
|
+
dependent_feature=<dependent_feature>,
|
|
89
|
+
rmse_prob=<rmse_probability>,
|
|
90
|
+
f1_prob=<f1_probability>,
|
|
91
|
+
n_jobs=<n_jobs>
|
|
92
|
+
)
|
|
93
|
+
print(result)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Predict
|
|
97
|
+
|
|
98
|
+
Use the CLI:
|
|
99
|
+
|
|
100
|
+
```sh
|
|
101
|
+
mlforge-predict --model_path path/to/model.pkl --preprocessor_path path/to/preprocessor.pkl --input_data path/to/input.csv --encoder_path path/to/encoder.pkl
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Or programmatically:
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
from mlforge import predict
|
|
108
|
+
|
|
109
|
+
result = predict(
|
|
110
|
+
<model.pkl>,
|
|
111
|
+
<preprocessor.pkl>,
|
|
112
|
+
<input_data.csv>,
|
|
113
|
+
<encoder.pkl>
|
|
114
|
+
)
|
|
115
|
+
print(result)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Artifacts
|
|
119
|
+
|
|
120
|
+
After training, the following files are saved :
|
|
121
|
+
|
|
122
|
+
- `model.pkl`: Trained model
|
|
123
|
+
- `preprocessor.pkl`: Preprocessing pipeline
|
|
124
|
+
- `encoder.pkl`: Label encoder (for classification)
|
|
125
|
+
- `Plots/`: Visualizations (correlation heatmap, confusion matrix, ROC curve, etc.)
|
|
126
|
+
|
|
127
|
+
## Testing
|
|
128
|
+
|
|
129
|
+
Run tests using pytest:
|
|
130
|
+
|
|
131
|
+
```sh
|
|
132
|
+
pytest test/
|
|
133
|
+
```
|
|
134
|
+
## Author
|
|
135
|
+
|
|
136
|
+
Priyanshu Mathur
|
|
137
|
+
[Portfolio](https://my-portfolio-phi-two-53.vercel.app/)
|
|
138
|
+
Email: mathurpriyanshu2006@gmail.com
|
|
139
|
+
|
|
140
|
+
## Project Links
|
|
141
|
+
|
|
142
|
+
- [PyPI](https://pypi.org/project/mlforgex/)
|
mlforgex-1.0.2/setup.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
this_directory = Path(__file__).parent
|
|
5
|
+
long_description = (this_directory / "README.md").read_text()
|
|
6
|
+
setup(
|
|
7
|
+
name="mlforgex",
|
|
8
|
+
version="1.0.2",
|
|
9
|
+
packages=find_packages(),
|
|
10
|
+
install_requires = [
|
|
11
|
+
"pandas",
|
|
12
|
+
"numpy",
|
|
13
|
+
"seaborn",
|
|
14
|
+
"matplotlib",
|
|
15
|
+
"scikit-learn",
|
|
16
|
+
"xgboost",
|
|
17
|
+
"imbalanced-learn"
|
|
18
|
+
]
|
|
19
|
+
,
|
|
20
|
+
long_description=long_description,
|
|
21
|
+
long_description_content_type="text/markdown",
|
|
22
|
+
entry_points={
|
|
23
|
+
"console_scripts": [
|
|
24
|
+
"mlforge-train=mlforge.train:main",
|
|
25
|
+
"mlforge-predict=mlforge.predict:main"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
author="Priyanshu Mathur",
|
|
29
|
+
author_email="mathurpriyanshu2006@gmail.com",
|
|
30
|
+
description="Lightweight ML utility for automated training, evaluation, and prediction with CLI and Python API support",
|
|
31
|
+
url="https://github.com/yourusername/mlforge",
|
|
32
|
+
license="MIT",
|
|
33
|
+
classifiers=[
|
|
34
|
+
"License :: OSI Approved :: MIT License",
|
|
35
|
+
"Programming Language :: Python :: 3",
|
|
36
|
+
"Operating System :: OS Independent",
|
|
37
|
+
],
|
|
38
|
+
python_requires=">=3.8",
|
|
39
|
+
)
|
mlforgex-1.0.0/PKG-INFO
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: mlforgex
|
|
3
|
-
Version: 1.0.0
|
|
4
|
-
Summary: MLForge: Train and evaluate ML models easily
|
|
5
|
-
Home-page: https://github.com/yourusername/mlforge
|
|
6
|
-
Author: Priyanshu Mathur
|
|
7
|
-
Author-email: mathurpriyanshu2006@gmail.com
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Operating System :: OS Independent
|
|
10
|
-
Requires-Python: >=3.8
|
|
11
|
-
License-File: LICENSE
|
|
12
|
-
Requires-Dist: pandas
|
|
13
|
-
Requires-Dist: numpy
|
|
14
|
-
Requires-Dist: scikit-learn
|
|
15
|
-
Dynamic: author
|
|
16
|
-
Dynamic: author-email
|
|
17
|
-
Dynamic: classifier
|
|
18
|
-
Dynamic: home-page
|
|
19
|
-
Dynamic: license-file
|
|
20
|
-
Dynamic: requires-dist
|
|
21
|
-
Dynamic: requires-python
|
|
22
|
-
Dynamic: summary
|
mlforgex-1.0.0/README.md
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
# MLForge
|
|
2
|
-
|
|
3
|
-
**MLForge** is a Python package that enables easy training, evaluation, and prediction for machine learning models. It supports both classification and regression problems, automates preprocessing, model selection, hyperparameter tuning, and generates useful artifacts and plots for analysis.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- Automatic data preprocessing (missing value handling, encoding, scaling)
|
|
8
|
-
- Imbalance handling (under-sampling, over-sampling)
|
|
9
|
-
- Model selection and evaluation (classification & regression)
|
|
10
|
-
- Hyperparameter tuning with RandomizedSearchCV
|
|
11
|
-
- Artifact saving (model, preprocessor, encoder)
|
|
12
|
-
- Visualization of metrics and learning curves
|
|
13
|
-
- Simple CLI for training and prediction
|
|
14
|
-
|
|
15
|
-
## Installation
|
|
16
|
-
|
|
17
|
-
Install MLForge using pip:
|
|
18
|
-
|
|
19
|
-
```sh
|
|
20
|
-
pip install mlforge
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
Or clone the repository and install locally:
|
|
24
|
-
|
|
25
|
-
```sh
|
|
26
|
-
git clone https://github.com/yourusername/mlforge.git
|
|
27
|
-
cd mlforge
|
|
28
|
-
pip install .
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Requirements
|
|
32
|
-
|
|
33
|
-
- Python >= 3.8
|
|
34
|
-
- pandas
|
|
35
|
-
- numpy
|
|
36
|
-
- scikit-learn
|
|
37
|
-
- seaborn
|
|
38
|
-
- matplotlib
|
|
39
|
-
- xgboost
|
|
40
|
-
- imbalanced-learn
|
|
41
|
-
|
|
42
|
-
See [requirements.txt](requirements.txt) for details.
|
|
43
|
-
|
|
44
|
-
## Usage
|
|
45
|
-
|
|
46
|
-
### Train a Model
|
|
47
|
-
|
|
48
|
-
You can train a model using the CLI:
|
|
49
|
-
|
|
50
|
-
```sh
|
|
51
|
-
mlforge-train --data mlforge/diabetes_cleaned.csv --target Outcome --rmse 0.3 --f1 0.7
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
Or programmatically:
|
|
55
|
-
|
|
56
|
-
```python
|
|
57
|
-
from mlforge import train_model
|
|
58
|
-
|
|
59
|
-
result = train_model(
|
|
60
|
-
"mlforge/diabetes_cleaned.csv",
|
|
61
|
-
"Outcome",
|
|
62
|
-
rmse_prob=0.3,
|
|
63
|
-
f1_prob=0.7,
|
|
64
|
-
n_jobs=-1
|
|
65
|
-
)
|
|
66
|
-
print(result)
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### Predict
|
|
70
|
-
|
|
71
|
-
Use the CLI:
|
|
72
|
-
|
|
73
|
-
```sh
|
|
74
|
-
mlforge-predict --model mlforge/artifacts/model.pkl --preprocessor mlforge/artifacts/preprocessor.pkl --input mlforge/input.csv --encoder mlforge/artifacts/encoder.pkl
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Or programmatically:
|
|
78
|
-
|
|
79
|
-
```python
|
|
80
|
-
from mlforge import predict
|
|
81
|
-
|
|
82
|
-
result = predict(
|
|
83
|
-
"mlforge/artifacts/model.pkl",
|
|
84
|
-
"mlforge/artifacts/preprocessor.pkl",
|
|
85
|
-
"mlforge/input.csv",
|
|
86
|
-
"mlforge/artifacts/encoder.pkl"
|
|
87
|
-
)
|
|
88
|
-
print(result)
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
## Artifacts
|
|
92
|
-
|
|
93
|
-
After training, the following files are saved in `mlforge/artifacts/`:
|
|
94
|
-
|
|
95
|
-
- `model.pkl`: Trained model
|
|
96
|
-
- `preprocessor.pkl`: Preprocessing pipeline
|
|
97
|
-
- `encoder.pkl`: Label encoder (for classification)
|
|
98
|
-
- `Plots/`: Visualizations (correlation heatmap, confusion matrix, ROC curve, etc.)
|
|
99
|
-
|
|
100
|
-
## Testing
|
|
101
|
-
|
|
102
|
-
Run tests using pytest:
|
|
103
|
-
|
|
104
|
-
```sh
|
|
105
|
-
pytest test/
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
## License
|
|
109
|
-
|
|
110
|
-
[MIT License](https://github.com/dhgefergfefruiwefhjhcduc/ML_Forge?tab=MIT-1-ov-file)
|
|
111
|
-
|
|
112
|
-
## Author
|
|
113
|
-
|
|
114
|
-
Priyanshu Mathur
|
|
115
|
-
[Portfolio](https://my-portfolio-phi-two-53.vercel.app/)
|
|
116
|
-
Email: mathurpriyanshu2006@gmail.com
|
|
117
|
-
|
|
118
|
-
## Project Links
|
|
119
|
-
|
|
120
|
-
- [PyPI](https://pypi.org/project/mlforge/)
|
|
121
|
-
- [GitHub](https://github.com/yourusername/mlforge)
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: mlforgex
|
|
3
|
-
Version: 1.0.0
|
|
4
|
-
Summary: MLForge: Train and evaluate ML models easily
|
|
5
|
-
Home-page: https://github.com/yourusername/mlforge
|
|
6
|
-
Author: Priyanshu Mathur
|
|
7
|
-
Author-email: mathurpriyanshu2006@gmail.com
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Operating System :: OS Independent
|
|
10
|
-
Requires-Python: >=3.8
|
|
11
|
-
License-File: LICENSE
|
|
12
|
-
Requires-Dist: pandas
|
|
13
|
-
Requires-Dist: numpy
|
|
14
|
-
Requires-Dist: scikit-learn
|
|
15
|
-
Dynamic: author
|
|
16
|
-
Dynamic: author-email
|
|
17
|
-
Dynamic: classifier
|
|
18
|
-
Dynamic: home-page
|
|
19
|
-
Dynamic: license-file
|
|
20
|
-
Dynamic: requires-dist
|
|
21
|
-
Dynamic: requires-python
|
|
22
|
-
Dynamic: summary
|
mlforgex-1.0.0/setup.py
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
from setuptools import setup, find_packages
|
|
2
|
-
|
|
3
|
-
setup(
|
|
4
|
-
name="mlforgex",
|
|
5
|
-
version="1.0.0",
|
|
6
|
-
packages=find_packages(),
|
|
7
|
-
install_requires=[
|
|
8
|
-
"pandas",
|
|
9
|
-
"numpy",
|
|
10
|
-
"scikit-learn"
|
|
11
|
-
],
|
|
12
|
-
entry_points={
|
|
13
|
-
"console_scripts": [
|
|
14
|
-
"mlforge-train=mlforge.train:main",
|
|
15
|
-
"mlforge-predict=mlforge.predict:main"
|
|
16
|
-
]
|
|
17
|
-
},
|
|
18
|
-
author="Priyanshu Mathur",
|
|
19
|
-
author_email="mathurpriyanshu2006@gmail.com",
|
|
20
|
-
description="MLForge: Train and evaluate ML models easily",
|
|
21
|
-
url="https://github.com/yourusername/mlforge",
|
|
22
|
-
classifiers=[
|
|
23
|
-
"Programming Language :: Python :: 3",
|
|
24
|
-
"Operating System :: OS Independent",
|
|
25
|
-
],
|
|
26
|
-
python_requires=">=3.8",
|
|
27
|
-
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|