Geron Chap 2 End-to-End Machine Learning Project
From wikidb
Contents
Create the Workspace
p 42
$ tail .bashrc # For machine learning tutorila export ML_PATH="$HOME/ml" $ mkdir -p $ML_PATH $ python3 -m pip --version pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
Creating an Isolated Environment
p 43 - 44
$ python3 -m pip install --user -U virtualenv Collecting virtualenv Downloading virtualenv-20.16.6-py3-none-any.whl (8.8 MB) |████████████████████████████████| 8.8 MB 6.6 MB/s Collecting platformdirs<3,>=2.4 Downloading platformdirs-2.5.3-py3-none-any.whl (14 kB) Collecting distlib<1,>=0.3.6 Downloading distlib-0.3.6-py2.py3-none-any.whl (468 kB) |████████████████████████████████| 468 kB 4.2 MB/s Collecting filelock<4,>=3.4.1 Downloading filelock-3.8.0-py3-none-any.whl (10 kB) Installing collected packages: platformdirs, distlib, filelock, virtualenv Successfully installed distlib-0.3.6 filelock-3.8.0 platformdirs-2.5.3 virtualenv-20.16.6 $ cd $ML_PATH $ python3 -m virtualenv tfenv created virtual environment CPython3.8.10.final.0-64 in 369ms creator CPython3Posix(dest=/home/eepp/tfenv, clear=False, no_vcs_ignore=False, global=False) seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/eepp/.local/share/virtualenv) added seed packages: pip==22.3.1, setuptools==65.5.1, wheel==0.37.1 activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator $ source tfenv/bin/activate $ python3 -m pip install -U jupyter matplotlib numpy pandas scipy scikit-learn
$ python3 -m ipykernel install --user --name=python3 Installed kernelspec python3 in /home/eepp/.local/share/jupyter/kernels/python3 $ jupyter notebook [I 22:50:17.310 NotebookApp] Writing notebook server cookie secret to /home/eepp/.local/share/jupyter/runtime/notebook_cookie_secret [I 22:50:17.492 NotebookApp] Serving notebooks from local directory: /home/eepp [I 22:50:17.492 NotebookApp] Jupyter Notebook 6.5.2 is running at: [I 22:50:17.492 NotebookApp] http://localhost:8888/?token=c4b498be6a30975f85e65dc98cfb9282b48213166ec0a422 [I 22:50:17.492 NotebookApp] or http://127.0.0.1:8888/?token=c4b498be6a30975f85e65dc98cfb9282b48213166ec0a422 [I 22:50:17.492 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [C 22:50:17.548 NotebookApp] To access the notebook, open this file in a browser: file:///home/eepp/.local/share/jupyter/runtime/nbserver-77661-open.html Or copy and paste one of these URLs: http://localhost:8888/?token=c4b498be6a30975f85e65dc98cfb9282b48213166ec0a422 or http://127.0.0.1:8888/?token=c4b498be6a30975f85e65dc98cfb9282b48213166ec0a422
Start up
- In a terminal p44
cd $ML_PATH ml$ pwd /home/eepp/ml ml$ ls tfenv ml$ source tfenv/bin/activate (tfenv) eepp@sisters:ml$ (tfenv) ml$ ~/tfenv/bin/jupyter notebook [I 14:39:22.698 NotebookApp] Serving notebooks from local directory: /home/eepp/ml [I 14:39:22.698 NotebookApp] Jupyter Notebook 6.5.2 is running at: [I 14:39:22.698 NotebookApp] http://localhost:8888/?token=b4f36a52e43bd795e0303d111cef921fe849d4158cd66768 [I 14:39:22.698 NotebookApp] or http://127.0.0.1:8888/?token=b4f36a52e43bd795e0303d111cef921fe849d4158cd66768 [I 14:39:22.698 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [C 14:39:22.753 NotebookApp] To access the notebook, open this file in a browser: file:///home/eepp/.local/share/jupyter/runtime/nbserver-80989-open.html Or copy and paste one of these URLs: http://localhost:8888/?token=b4f36a52e43bd795e0303d111cef921fe849d4158cd66768 or http://127.0.0.1:8888/?token=b4f36a52e43bd795e0303d111cef921fe849d4158cd66768
- In browser new page p44,45
- Create a new notebook
- rename it to Housing
Depreciate
$ python3 -m virtualenv tftutorial_env created virtual environment CPython3.8.10.final.0-64 in 491ms creator CPython3Posix(dest=/home/eepp/tftutorial_env, clear=False, no_vcs_ignore=False, global=False) seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/eepp/.local/share/virtualenv) added seed packages: pip==22.3, setuptools==65.5.0, wheel==0.37.1 activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator $ source tftutorial_env/bin/activate (tftutorial_env) eepp@sisters:~$ (tftutorial_env) eepp@sisters:~$ deactivate eepp@sisters:~$
Return to Chapter 10
- p 296