Use the requirements file in this repo to create a new environment.
pyenv local 3.10.10
python -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
The requirements.txt
file contains the libraries needed for deployment.. of model or dashboard .. thus no jupyter or other libs used during development.
The MLFLOW URI should not be stored on git, you have two options, to save it locally in the .mlflow_uri
file:
echo http://127.0.0.1:5000/ > .mlflow_uri
This will create a local file where the uri is stored which will not be added on github (.mlflow_uri
is in the .gitignore
file). Alternatively you can export it as an environment variable with
export MLFLOW_URI=http://127.0.0.1:5000/
This links to your local mlflow, if you want to use a different one, then change the set uri.
The code in the config.py will try to read it locally and if the file doesn't exist will look in the env var.. IF that is not set the URI will be empty in your code.
You can do it via the GUI or via command line if you use the local mlflow:
mlflow experiments create --experiment-name 0-template-ds-modeling
Check your local mlflow
mlflow ui
and open the link http://127.0.0.1:5000
This will throw an error if the experiment already exists. Save the experiment name in the config file.
In order to train the model and store test data in the data folder and the model in models run:
#activate env
source .venv/bin/activate
python -m modeling.train
In order to test that predict works on a test set you created run:
python modeling/predict.py models/linear data/X_test.csv data/y_test.csv