Skip to content

Commit

Permalink
Added testing instructions (#31)
Browse files Browse the repository at this point in the history
* renaming input_datas to input_data

* added testing instructions
  • Loading branch information
enochkan authored Mar 22, 2021
1 parent 944f4a4 commit 3f664fe
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,18 @@ Metrics from `tf.keras.metrics` and other metrics that are already implemented v
- [ ] CategoricalCrossEntropy class
- [ ] SparseCategoricalCrossentropy class

## Local Development
## Local Development and Testing

To quickly get started with local development, run:
```python
make develop
```

To test, run:
```python
python3 -m pytest
```

### Pre-commit hooks

To run pre-commit against all files:
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ black>=19.10b0
flake8>=3.8.4
isort>=5.7.0
pre-commit>=2.10.1
scikit-learn>=0.24.1
pytest>=6.1.1
File renamed without changes.
3 changes: 2 additions & 1 deletion tests/test_classification_metrics.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import numpy as np
import pytest
import torch
from input_datas import binary_prob_inputs, binary_raw_inputs
from numpy.testing import assert_allclose
from sklearn.metrics import accuracy_score, f1_score, precision_score
from torch_metrics.classification import Accuracy, F1Score, Precision

from input_data import binary_prob_inputs, binary_raw_inputs

torch.manual_seed(42)


Expand Down
20 changes: 10 additions & 10 deletions tests/test_regression_metrics.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import numpy as np
import pytest
import torch
from input_datas import normal_regression_inputs, uniform_regression_inputs
from numpy.testing import assert_allclose
from sklearn.metrics import (mean_absolute_error, mean_squared_error,
mean_squared_log_error)
from torch_metrics.regression import (MeanAbsoluteError, MeanSquaredError,
MeanSquaredLogarithmicError,
RootMeanSquaredError)
from sklearn.metrics import mean_absolute_error, mean_squared_error, mean_squared_log_error
from torch_metrics.regression import (
MeanAbsoluteError,
MeanSquaredError,
MeanSquaredLogarithmicError,
RootMeanSquaredError,
)

from input_data import normal_regression_inputs, uniform_regression_inputs

torch.manual_seed(42)

Expand Down Expand Up @@ -45,10 +48,7 @@ def test_mse(y_true, y_pred):


@pytest.mark.parametrize(
"y_true, y_pred",
[
(uniform_regression_inputs.target, uniform_regression_inputs.preds),
],
"y_true, y_pred", [(uniform_regression_inputs.target, uniform_regression_inputs.preds),],
)
def test_msle(y_true, y_pred):
sk_preds = y_pred.numpy()
Expand Down

0 comments on commit 3f664fe

Please sign in to comment.