You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/classification.rst
+49-40Lines changed: 49 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ HDC Learning
4
4
After learning about representing and manipulating information in hyperspace, we can implement our first HDC classification model! We will use as an example the famous MNIST dataset that contains images of handwritten digits.
5
5
6
6
7
-
We start by importing Torchhd and any other libraries we need:
7
+
We start by importing Torchhd and the other libraries we need, in addition to specifying the training parameters:
8
8
9
9
.. code-block:: python
10
10
@@ -13,11 +13,22 @@ We start by importing Torchhd and any other libraries we need:
13
13
import torch.nn.functional as F
14
14
import torchvision
15
15
from torchvision.datasets importMNIST
16
+
# Note: this example requires the torchmetrics library: https://torchmetrics.readthedocs.io
In addition to the various datasets available in the Torch ecosystem, such as MNIST, the :ref:`datasets` module provides interface to several commonly used datasets in HDC. Such interfaces inherit from PyTorch's dataset class, ensuring interoperability with other datasets.
48
+
In addition to the various datasets available in the Torch ecosystem, such as MNIST, the :ref:`datasets` module provides an interface to several commonly used datasets in HDC. Such interfaces inherit from PyTorch's dataset class, ensuring interoperability with other datasets.
38
49
39
50
Training
40
51
--------
41
52
42
-
To perform the training, we start by defining a model. In addition to specifying the basis-hypervectors sets, the core part of the model is the encoding function. In the example below, we use random-hypervectors and level-hypervectors to encode the position and value of each pixel, respectively:
53
+
To perform the training, we start by defining an encoding. In addition to specifying the basis-hypervectors sets, a core part of learning is the encoding function. In the example below, we use random-hypervectors and level-hypervectors to encode the position and value of each pixel, respectively:
0 commit comments