Skip to content

Commit

Permalink
increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
dvolgyes committed Jun 29, 2017
1 parent 1934208 commit ccf0e71
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ before_script:

script:
- coverage${PYVERSION} run --source ffx tests/x_square_test.py
- coverage${PYVERSION} run --source ffx tests/nonlinear_verbose_test.py

after_success:
- coveralls
19 changes: 19 additions & 0 deletions tests/nonlinear_verbose_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python

import numpy as np
import ffx

# This creates a dataset of 1 predictor
train_X = np.array([[-5,-4,-3,-2,-1, 0, 1, 2, 3,4,5,6,7,8,9]]).T
train_y = np.array([4,4,3,2,1, 0, 1, 2, 3,4,4,4,4,4,4])
test_X = np.array([[10,11,12]]).T
test_y = np.array([4, 4,4,])

models = ffx.run(train_X, train_y, test_X, test_y, ["x"],verbose = True)

print('True model: y = min(abs(x),4)')
print('Results:')
print('Num bases,Test error (%),Model\n')
for model in models:
print('%10s, %13s, %s\n' %
('%d' % model.numBases(), '%.4f' % (model.test_nmse * 100.0), model))

0 comments on commit ccf0e71

Please sign in to comment.