Skip to content

Commit 05d7618

Browse files
authored
test: allow for alternative PCA solutions in tests (#143)
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://togithub.com/googleapis/python-bigquery-dataframes/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) Fixes #<issue_number_goes_here> 🦕
1 parent 6fea8ef commit 05d7618

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

tests/system/large/ml/test_decomposition.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ def test_decomposition_configure_fit_score_predict(
6767
index=pd.Index([1633, 1672, 1690], name="tag_number", dtype="Int64"),
6868
)
6969
pd.testing.assert_frame_equal(
70-
result.sort_index(),
71-
expected,
70+
abs(result.sort_index()), # results may differ by a minus sign
71+
abs(expected),
7272
check_exact=False,
7373
rtol=0.1,
7474
)

tests/system/large/ml/test_pipeline.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,10 +431,16 @@ def test_pipeline_PCA_fit_score_predict(session, penguins_df_default_index):
431431
index=pd.Index([1633, 1672, 1690], name="tag_number", dtype="Int64"),
432432
)
433433
pd.testing.assert_frame_equal(
434-
predictions[
435-
["principal_component_1", "principal_component_2", "principal_component_3"]
436-
],
437-
expected,
434+
abs( # results may differ by a minus sign
435+
predictions[
436+
[
437+
"principal_component_1",
438+
"principal_component_2",
439+
"principal_component_3",
440+
]
441+
]
442+
),
443+
abs(expected),
438444
check_exact=False,
439445
rtol=0.1,
440446
)

0 commit comments

Comments
 (0)