Skip to content

Commit 6ac07b3

Browse files
committed
add requirements.txt versions
1 parent 2d68cde commit 6ac07b3

File tree

14 files changed

+149
-16
lines changed

14 files changed

+149
-16
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Python Setup Tips
2+
3+
4+
5+
There are several different ways you can install Python and set up your computing environment. Here, I am illustrating my personal preference.
6+
7+
(I am using computers running macOS, but this workflow is similar for Linux machines and may work for other operating systems as well.)
8+
9+
10+
11+
## 1. Download and install Miniforge
12+
13+
Download miniforge from the GitHub repository [here](https://github.com/conda-forge/miniforge).
14+
15+
<img src="figures/download.png" alt="download" style="zoom:33%;" />
16+
17+
Depending on your operating system, this should download either an `.sh` (macOS, Linux) or `.exe` file (Windows).
18+
19+
For the `.sh` file, open your command line terminal and execute the following command
20+
21+
```bash
22+
sh ~/Desktop/Miniforge3-MacOSX-arm64.sh
23+
```
24+
25+
where `Desktop/` is the folder where the Miniforge installer was downloaded to. On your computer, you may have to replace it with `Downloads/`.
26+
27+
<img src="figures/miniforge-install.png" alt="miniforge-install" style="zoom:33%;" />
28+
29+
Next, step through the download instructions, confirming with "Enter".
30+
31+
## 2. Create a new virtual environment
32+
33+
After the installation was successfully completed, I recommend creating a new virtual environment called `dl-fundamentals`, which you can do by executing
34+
35+
```bash
36+
conda create -n book python=3.9
37+
```
38+
39+
<img src="figures/new-env.png" alt="new-env" style="zoom:33%;" />
40+
41+
Next, activate your new virtual environment (you have to do it every time you open a new terminal window or tab):
42+
43+
```bash
44+
conda activate book
45+
```
46+
47+
48+
49+
## Optional: styling your terminal
50+
51+
If you want to style your terminal similar to mine so that you can see which virtual environment is active, check out the [Oh My Zsh](https://github.com/ohmyzsh/ohmyzsh) project.
52+
53+
54+
55+
# 3. Install new Python libraries
56+
57+
58+
59+
To install new Python libraries, you can now use the `conda` package installer. For example, you can install [JupyterLab](https://jupyter.org/install) and [watermark](https://github.com/rasbt/watermark) as follows:
60+
61+
```bash
62+
conda install jupyterlab watermark
63+
```
64+
65+
66+
67+
Alternatively you can also use `pip` to install libraries instead. By default, `pip` should be linked to your new `book` conda environment:
68+
69+
```bash
70+
pip install jupyterlab watermark
71+
```
72+
73+
74+
---
75+
76+
77+
78+
79+
Any questions? Please feel free to reach out in the [Discussion Forum](https://github.com/rasbt/MachineLearning-QandAI-book/discussions).
Loading
Loading
Loading

supplementary/README.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Readme
2+
3+
To install the Python code requirements for the respective chapters, I recommend creating a new virtual environment first:
4+
5+
```bash
6+
conda create --new book python=3.9
7+
conda activate book
8+
```
9+
10+
I prefer `conda`, and for more step-by-step instructions please also see the [00-1_python-setup-guide](00-1_python-setup-guide) folder for my personal Python setup preferences.
11+
12+
However, you can also use any other virtual environment manager of your choice, for example, [venv](https://docs.python.org/3/library/venv.html).
13+
14+
15+
16+
Then, you can ran the following pip command to install the code requirements:
17+
18+
19+
```
20+
pip install -r requirements.txt
21+
```

supplementary/q10-random-sources/data-sampling.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@
270270
"name": "python",
271271
"nbconvert_exporter": "python",
272272
"pygments_lexer": "ipython3",
273-
"version": "3.10.6"
273+
"version": "3.11.4"
274274
}
275275
},
276276
"nbformat": 4,

supplementary/q10-random-sources/dropout.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@
220220
"name": "python",
221221
"nbconvert_exporter": "python",
222222
"pygments_lexer": "ipython3",
223-
"version": "3.10.6"
223+
"version": "3.11.4"
224224
}
225225
},
226226
"nbformat": 4,

supplementary/q10-random-sources/random-weights.ipynb

+7-7
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
"output_type": "stream",
2828
"text": [
2929
"Parameter containing:\n",
30-
"tensor([[-0.5337, -0.5803],\n",
31-
" [ 0.3135, -0.6076],\n",
32-
" [-0.4933, 0.1692]], requires_grad=True)\n"
30+
"tensor([[ 0.1458, -0.5813],\n",
31+
" [-0.3033, 0.0979],\n",
32+
" [-0.0911, -0.2116]], requires_grad=True)\n"
3333
]
3434
}
3535
],
@@ -52,9 +52,9 @@
5252
"output_type": "stream",
5353
"text": [
5454
"Parameter containing:\n",
55-
"tensor([[ 0.4520, 0.6994],\n",
56-
" [-0.3923, -0.2530],\n",
57-
" [ 0.3781, 0.2438]], requires_grad=True)\n"
55+
"tensor([[ 0.1760, -0.6285],\n",
56+
" [-0.1398, -0.0959],\n",
57+
" [ 0.3127, 0.4303]], requires_grad=True)\n"
5858
]
5959
}
6060
],
@@ -136,7 +136,7 @@
136136
"name": "python",
137137
"nbconvert_exporter": "python",
138138
"pygments_lexer": "ipython3",
139-
"version": "3.10.6"
139+
"version": "3.11.4"
140140
}
141141
},
142142
"nbformat": 4,

supplementary/q11-conv-size/q11-conv-size.ipynb

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
},
1111
{
1212
"cell_type": "code",
13-
"execution_count": 67,
13+
"execution_count": 1,
1414
"id": "a99e7ac1-9681-45c1-a4ef-715491d22828",
1515
"metadata": {},
1616
"outputs": [
1717
{
1818
"name": "stdout",
1919
"output_type": "stream",
2020
"text": [
21-
"PyTorch version: 1.13.1\n"
21+
"PyTorch version: 2.0.1\n"
2222
]
2323
}
2424
],
@@ -521,7 +521,7 @@
521521
"name": "python",
522522
"nbconvert_exporter": "python",
523523
"pygments_lexer": "ipython3",
524-
"version": "3.10.6"
524+
"version": "3.11.4"
525525
}
526526
},
527527
"nbformat": 4,

supplementary/q12-fc-cnn-equivalence/q12-fc-cnn-equivalence.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@
374374
"name": "python",
375375
"nbconvert_exporter": "python",
376376
"pygments_lexer": "ipython3",
377-
"version": "3.10.6"
377+
"version": "3.11.4"
378378
}
379379
},
380380
"nbformat": 4,

supplementary/q15-text-augment/synonym-replacement.ipynb

+27-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,32 @@
88
"## Synonym replacement"
99
]
1010
},
11+
{
12+
"cell_type": "code",
13+
"execution_count": 1,
14+
"id": "0ab61d1f-466f-4469-99da-b172a959c2cb",
15+
"metadata": {},
16+
"outputs": [
17+
{
18+
"name": "stdout",
19+
"output_type": "stream",
20+
"text": [
21+
"Author: Sebastian Raschka\n",
22+
"\n",
23+
"Python implementation: CPython\n",
24+
"Python version : 3.11.4\n",
25+
"IPython version : 8.14.0\n",
26+
"\n",
27+
"nltk: 3.8.1\n",
28+
"\n"
29+
]
30+
}
31+
],
32+
"source": [
33+
"%load_ext watermark\n",
34+
"%watermark -a 'Sebastian Raschka' -v -p nltk"
35+
]
36+
},
1137
{
1238
"cell_type": "code",
1339
"execution_count": 4,
@@ -232,7 +258,7 @@
232258
"name": "python",
233259
"nbconvert_exporter": "python",
234260
"pygments_lexer": "ipython3",
235-
"version": "3.10.6"
261+
"version": "3.11.4"
236262
}
237263
},
238264
"nbformat": 4,

supplementary/q25_confidence-intervals/1_four-methods.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@
658658
"name": "python",
659659
"nbconvert_exporter": "python",
660660
"pygments_lexer": "ipython3",
661-
"version": "3.10.6"
661+
"version": "3.11.4"
662662
}
663663
},
664664
"nbformat": 4,

supplementary/q25_confidence-intervals/2_four-methods-vs-true-value.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@
563563
"name": "python",
564564
"nbconvert_exporter": "python",
565565
"pygments_lexer": "ipython3",
566-
"version": "3.10.6"
566+
"version": "3.11.4"
567567
}
568568
},
569569
"nbformat": 4,

supplementary/requirements.txt

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
jupyterlab
2+
mlxtend>=0.22.0
3+
nltk>=3.8.1
4+
numpy>=1.23.5
5+
scikit-learn>=1.2.2
6+
torch>=2.0.0
7+
watermark>=2.4.3

0 commit comments

Comments
 (0)