This repository demonstrates the process of saving and loading machine learning models using both pickle
and joblib
in Python. The example uses a logistic regression model trained on the Iris dataset.
-
model_training.py
: Python script for training a logistic regression model on the Iris dataset and saving it using bothpickle
andjoblib
. -
model_evaluation.py
: Python script for loading the saved models and making predictions on new data. -
requirements.txt
: File containing the required Python libraries and their versions.
-
Clone the Repository:
git clone <repository-url> cd <repository-directory>
-
Install Dependencies:
pip install -r requirements.txt
-
Train and Save the Model:
python model_training.py
-
Evaluate the Model:
python model_evaluation.py
-
model.pkl
: Pickle file containing the trained logistic regression model. -
model.joblib
: Joblib file containing the trained logistic regression model.
-
The
model_training.ipynb
script trains a logistic regression model on the Iris dataset, evaluates its accuracy, and saves it using bothpickle
andjoblib
. -
The
model_evaluation.py
script loads the saved models and makes predictions on new data. -
The
requirements.txt
file specifies the required Python libraries and their versions.
Feel free to customize this structure and documentation to fit your specific needs.