UBC-MDS / CrossPy

A package for cross-validation in Python
MIT License
1 stars 4 forks source link

Complete summary_cv function with all tests running #17

Closed Nazliozum closed 6 years ago

Nazliozum commented 6 years ago

Here are my updates:

Example

The code below is wrong for the test file.

def test_input_contains_over_1():
    with pytest.raises(ValueError('Elements of `scores` must be between 0 and 1')):
        summary_cv(scores = [0.96, 0.97, 1.98])

Correct version:

def test_input_contains_over_1():
    with pytest.raises(ValueError):
        summary_cv(scores = [0.96, 0.97, 1.98])

The corresponding error detection in function definition would be:

if not all(item <= 1 for item in scores):
        raise ValueError('Elements of `scores` must be between 0 and 1')

I corrected this mistake for summary_cv tests but I did not want to delete the error explanations in train_test_split as I thought that Shun would be using these while writing the function definition. I wanted to describe the situation because I saw that the majority of the errors were due to this mistake.