OpenOnDemand Demo using Jupyter and Machine Learning with Python and venv

From Define Wiki
Jump to navigation Jump to search
# example for jupyter demos

git clone https://github.com/tirthajyoti/Machine-Learning-with-Python.git
python3 -m venv ml-venv
source ml-venv/bin/activate
pip install -U pip

# install deps for the Machine learning github stuff - taken from the git URL readme
pip install numpy
pip install pandas
pip install scikit-learn
pip install scipy
pip install statsmodels
pip install matplotlib
pip install seaborn
pip install sympy
pip install flask
pip install wtforms
pip install tensorflow>=1.15
pip install keras
pip install pdpipe

# this is for the jupyter integration with the python venv
pip install ipykernel
# this installs it so it'll pop up in the jupyter dashboard
python  -m ipykernel install --user --name=ml-venv
</bash>

Back to the OOD UI and spin up a jupyter env, by default it will load up a standard browser, lets:
-> Machine learning with python (where you git cloned earlier)
   -> Classification
      -> Logistic_Regression_Classification.ipynb


This will then load up a jupyter notebook with a default python3 env , so lets load up the ml-venv
-> Top right (Python3 ipykernel)
   -> Pull down menu and select ml-venv
      -> Run this - you should see the env in the top right load and it will be ready when the circle is beside it

# copy over the data sets - note, good to go in and show this failing, then going back into the file browser to move files around or show drag and drop
(ml-venv) [dpower@login-1 Classification]$ cp ~/Machine-Learning-with-Python/Datasets/titanic_t* .
(ml-venv) [dpower@login-1 Classification]$ pwd
/home/dpower/Machine-Learning-with-Python/Classification