-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add testing #102
Add testing #102
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! One minor stylistic comment. I will run the GitHub Actions workflow on this PR and then we can merge it into the fix_get_feature_importances
branch and that branch's PR will also be ready for review.
hlink/tests/training_test.py
Outdated
tf = spark.table("training_feature_importances").toPandas() | ||
for var in training_conf["training"]["independent_vars"]: | ||
assert not tf.loc[tf["feature_name"].str.startswith(f"{var}", na=False)].empty | ||
assert all([col in ['feature_name', 'coefficient_or_importance'] for col in tf.columns]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we should be able to use a generator expression instead of a list comprehension, which means we can drop the outermost pair of [
s. This is not a big deal, but a nice style thing.
@@ -88,7 +88,7 @@ def _run(self): | |||
features_df = self.task.spark.createDataFrame( | |||
zip(column_names, feature_importances), | |||
"feature_name: string, coefficient_or_importance: double", | |||
).sort("importance", ascending=False) | |||
).sort("coefficient_or_importance", ascending=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This small bug fix was made on the target branch too, looks good. 👍
440cdff
into
ipums:fix_get_feature_importances
This should lock in what currently is getting returned, with a little room for variance. Asserts everything exists and is reasonable. Can certainly be edited, this isn't exactly exhaustive testing.