Skip to content

Commit 692ff9d

Browse files
authored
Add files via upload
1 parent 96d551e commit 692ff9d

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

Pytest/test_linear_model.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def test_loaded_model_works():
9696

9797
#-------------------------------------------------------------------
9898

99-
def test_model_works_data_range():
99+
def test_model_works_data_range_sign_change():
100100
# Small-valued data
101101
X,y = fixed_data_constructor()
102102
X = 1.0e-9*X
@@ -119,6 +119,26 @@ def test_model_works_data_range():
119119
assert scores['Train-score'] == 1.0
120120
assert scores['Test-score'] == 1.0
121121

122+
# X-values are flipped
123+
X,y = fixed_data_constructor()
124+
X = -1 * X
125+
filename = 'testing'
126+
scores = train_linear_model(X,y, filename=filename)
127+
128+
# Check that test and train scores are perfectly equal to 1.0
129+
assert scores['Train-score'] == 1.0
130+
assert scores['Test-score'] == 1.0
131+
132+
# y-values are flipped
133+
X,y = fixed_data_constructor()
134+
y = -1 * y
135+
filename = 'testing'
136+
scores = train_linear_model(X,y, filename=filename)
137+
138+
# Check that test and train scores are perfectly equal to 1.0
139+
assert scores['Train-score'] == 1.0
140+
assert scores['Test-score'] == 1.0
141+
122142
#-------------------------------------------------------------------
123143

124144
def test_noise_impact():

0 commit comments

Comments
 (0)