Project 3 – FYS-STK4155

Project looking into use of autoencoder for semi-supervised learning and
comparing data requirements compared to supervised learning.

The folder p3 contains the source code for our python package where
the project required implementations are defined.

To format the code there is added a pre-commit
configuration so the code follows a common standard between the members of
the group. After pre-commit is installed in virtual environment or
globally, activate it for this repository by running pre-commit install. It
will now run configured linters and formatters each time you make a commit.

Setup using virtual environment

cd <path>
# Create a virtual environment
python -m venv venv
# Activate it
venv\Scripts\activate.bat # or on linux/mac: . venv/bin/activate
# Install the package and dependencies as an editable package in the venv
pip install -e .[dev,testing]

If you are using conda something like this should maybe work:

cd <path>
conda create --prefix ./env
conda activate ./env
pip install -e .[dev,testing]
# or maybe
conda install conda-build
conda develop . -n <env name>

Running tests and check coverage

To run the tests in tests folder we use pytest and coverage,
who is installed, if set-up is done as described above.

# to run tests:
(.venv)$ pytest
# to run coverage
(.venv)$ coverage run -m pytest && coverage report -m


❯ python -m p3 --help
usage: [-h] [--dataset DATASET] [--epochs EPOCHS]
                   [--batch-size BATCH_SIZE] [--lr LR]

optional arguments:
  -h, --help            show this help message and exit
  --dataset DATASET     path to dataset root. If dataset is not found at
                        location it will be downloaded to this location.
                        Default: './dataset'
  --epochs EPOCHS       train for number of epochs
  --batch-size BATCH_SIZE
                        number of samples in a batch
  --lr LR               step size during optimization


View Github