Add implementation of standard deviation on data#1
Conversation
There was a problem hiding this comment.
Enable the function to read JSON files also.
There was a problem hiding this comment.
Outside the scope of the pull request, but useful functionality. Will add as issue for future work.
There was a problem hiding this comment.
Standard deviation should raise an error if an empty array is passed.
Make sure the functions performs accurately for negative values .
sl6391
left a comment
There was a problem hiding this comment.
Add test for daily mean that has mix of both zeros and integers
|
|
||
|
|
||
| @pytest.mark.parametrize('data, expected_standard_deviation', [ | ||
| ([0, 0, 0], 0.0), | ||
| ([1.0, 1.0, 1.0], 0), | ||
| ([0.0, 2.0], 1.0) | ||
| ]) | ||
| def test_daily_standard_deviation(data, expected_standard_deviation): | ||
| from inflammation.models import s_dev | ||
| result_data = s_dev(data)['standard deviation'] | ||
| npt.assert_approx_equal(result_data, expected_standard_deviation) |
There was a problem hiding this comment.
Do these tests cover enough possibilities?
There was a problem hiding this comment.
Will implement tests to make sure the functions performs accurately for negative values.
| return np.min(data, axis=0) | ||
|
|
||
|
|
||
| def s_dev(data): |
There was a problem hiding this comment.
Could s_dev be rewritten to standard_deviation to avoid confusion?
|
|
||
| views.visualize(view_data) | ||
|
|
There was a problem hiding this comment.
Could graph section be taken out of this part of code and have it's own section? Have the code return data instead
Extend to show the graph of standard deviation.