The code is from CMU 10714(Deep Learning System)'s homework, and I have attached the homework description(hw0.iqynb and manual_neural_nets.pdf). Also, can refer to my DeepLearningSystem repository for whole description. Also can refer to 🌟🌟🌟Wenqing machine learning blog's backpropagation.md and ffnn.md🌟🌟🌟.
It implemented softmax regression which using softmax(aka cross entropy) loss on the MNIST dataset.
- hw0.iqynb from question 2, 3 and 5
Training softmax regression:
python3 src/simple_ml.py
Testing all functions:
python3 -m pytest tests/test_simple_ml.py
Testing a single function:
python3 -m pytest -k "softmax_loss" tests/test_simple_ml.py
The
-k
option inpytest
is used to filter tests based on the names of the test functions, test class names, and test file names. It uses a substring match to select tests. When you specify-k "softmax_regression_epoch and not cpp"
,pytest
is selecting tests that match the following criteria:
- Contain
softmax_regression_epoch
: Any test function, test class, or test file that contains the substringsoftmax_regression_epoch
.- Do not contain
cpp
: Any test function, test class, or test file that does not contain the substringcpp
.This filter is a logical combination, where the
and
operator means that both conditions must be satisfied, and thenot
operator negates the second condition.