Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide Pysmo warnings in tests #1428

Closed
wants to merge 21 commits into from
Closed

Conversation

dangunter
Copy link
Member

@dangunter dangunter commented Jun 3, 2024

Fixes #1421

Summary/Motivation:

They are annoying

Changes proposed in this PR:

  • Change print() to log
  • Lower log level in tests
  • Cleanup: remove pylint-disable comments

Legal Acknowledgement

By contributing to this software project, I agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the license terms described in the LICENSE.txt file at the top level of this directory.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

Comment on lines 13 to 15
# TODO: Missing doc strings
# pylint: disable=missing-module-docstring
# pylint: disable=missing-function-docstring
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get rid of these Pylint disables now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't looking at that, but sure should be an easy fix while I'm breaking things in those files

@dangunter dangunter self-assigned this Jun 3, 2024
@ksbeattie ksbeattie added the Priority:Normal Normal Priority Issue or PR label Jun 6, 2024
Copy link
Contributor

@bpaul4 bpaul4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks reasonable, some lines are commented out but not removed. If this is so they can be unhidden later, then they are fine.

@staticmethod
def print_fun(x, f, accepted):
print("at minimum %.4f accepted %d" % (f, int(accepted)))
# @staticmethod
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented code

print(
"\n===========================Polynomial Regression===============================================\n"
)
# print(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented code

# print(
# "\n===========================Polynomial Regression===============================================\n"
# )
_log.info("Polynomial Regression (begin)")
# Checks if fname is provided or exists in the path
if not isinstance(overwrite, bool):
# PYLINT-TODO
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pylint disable-next=broad-exception-raised is used in a few places in this file, are they still necessary?

'".\n',
_log.warning(
f"Warning: '{fname}' exists, "
f"results will be saved to {self.filename}"
)
# self.filename = 'solution.pickle'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is commented, but seems like it was already commented out before this PR.

)
self.number_of_crossvalidations = number_of_crossvalidations
# warnings.warn(msg)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, commented out line

)
maximum_polynomial_order = 10
self.max_polynomial_order = maximum_polynomial_order
# warnings.warn(msg)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too

@@ -1274,11 +1293,12 @@ def polynomial_regression_fitting(self, additional_regression_features=None):
< self.original_data.shape[0]
)
):
print("\n-------------------------------------------------")
print("\nIteration ", iteration_number)
# print("\n-------------------------------------------------")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here as well

" / MSE: %4f" % mse_error_opt,
" / R_sq: %4f" % r_square_opt,
" / Adjusted R^2: %4f" % r_square_adj_opt,
# print(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

KrigingClass.print_fun(1, 2, 3.7)
sys.stdout = sys.__stdout__
assert "at minimum 2.0000 accepted 3\n" == capturedOutput.getvalue()
# @pytest.mark.unit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this left commented on purpose, or can this be removed?

@@ -1647,7 +1661,7 @@ def test_results_generation_01(self, array_type1, array_type2):
row_list = np.array([["k"], ["(x_1)^1"], ["(x_2)^1"]])
expected_df = pd.concat(
[
expected_df,
#expected_df,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented here, and in a couple places farther down in this file

@dangunter dangunter marked this pull request as draft June 10, 2024 23:49
@lbianchi-lbl
Copy link
Contributor

Superseded by #1472

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:Normal Normal Priority Issue or PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove PySMO warnings in tests
5 participants