python -m venv venv
source venv/bin/activate
This should activate a private version of python 3.11. You can check it with
which python
That should show the path to venv/bin/python
.
By using an virtual environment you isolate this installation from the python
installation on your machine and stuff you might have installed as a --user
.
Every time you want to run this code you need to activate it with:
source venv/bin/activate
And when you want to use your regular python setup, just run:
source venv/bin/deactivate
pip install jupyterlab
pip install notebook
python -m ipykernel install --user --name=venv
pip install psycopg2
pip install scikit-learn
pip install numpy
pip install matplotlib
pip install pandas
pip install torch
pip install torchvision
Beware that the torch
package is several GBytes!
cd postgresql
docker-compose start
./do_load.sh
Password: postgres
...
Password: postgres
The script will prompt you twice for the password and just enter postgres
.
tar -xzf MNIST.tgz
jupyter notebook
In the main tab just double-click on any of the .ipynb
files on the list to open a new tab
with that notebook. A tutorial on Jupyter Notebook can be found at Jupiter Notebook Tutorial
Remember to activate your virtual environment with source venv/bin/deactivate
if not already
activated.
pip install spacy
python -m spacy download en_core_web_trf
The download is about 500 MB. A much smaller model is en_core_web_sm
.
If Jupyter Notebook is not already running, start it again and work on the SpaCy.ipynb
.
Install graphviz
and scikit-learn-tree
packages into the virtual environment and
run python decision_tree.py
to create a decision tree for the Titanic
dataset.
In the input file titanic_2.csv
Sex=1
means male
and 0
female.
The python script creates Titanic.pdf
. In the values
vector, the first element is how
many died and the second how many survived. The graph has True
condition to the left
and False
to the right. The root node is a decision on sex, so women are on the left
side (Sex <= 0.5
) and men on the right.