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

generate LearnerRanker summary reports as data frames, not text #95

Merged
merged 9 commits into from
Oct 12, 2020

Conversation

j-ittner
Copy link
Member

@j-ittner j-ittner commented Oct 9, 2020

closes #50

@j-ittner j-ittner added the API New feature or request label Oct 9, 2020
@j-ittner j-ittner requested a review from jason-bentley October 9, 2020 20:53
@j-ittner j-ittner self-assigned this Oct 9, 2020
Copy link
Contributor

@jason-bentley jason-bentley left a comment

Choose a reason for hiding this comment

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

Changes look great! I checked expected results for the following scenarios using the getting started example as the basis:

  1. Single learner single hyperparameter
  2. Single learner multiple hyperparameters
  3. Two learners with distinct multiple hyperparameters
  4. Two learners with distinct multiple hyperparameters and a common one (n_estimators)

DF outputs were as expected. Couple of follow-up questions:

  1. Would it make sense to add the performance metric (i.e., accuracy or AUC etc) as a column to the output?
  2. Would it make sense to also add the number of folds or something about the CV scheme so I know the mean and SD are based off say 10 values or 25?

Once this PR is merged I will update all notebooks accordingly in a separate PR.

@j-ittner
Copy link
Member Author

Good ideas!

On 1. I suggest we include the name of the metric in the relevant column headings, e.g. roc_auc_mean

For 2 I am not so sure, this would create a column with the same value in every row, and it is an input to the ranker not a result. However we could think about the meaning of the number of splits and add a derived metric. E.G., standard error estimate in % of the mean score (easy) and of the standard deviation (tricky). That would help folks determine the number of splits.

Thoughts?

@jason-bentley
Copy link
Contributor

On proposed solution for 1. completely agree!

On 2, I think if we do try to add this information we need to be direct and clear so the user doesn't need to further interpret/calculate from. Perhaps we either (1) don't add anything additional or (2) create a column with the CV object string (if possible) - the learner ranker will always have something passed to the CV argument so just take that argument as a string and drop into a column. What do you think?

@j-ittner
Copy link
Member Author

j-ittner commented Oct 10, 2020 via email

@jason-bentley
Copy link
Contributor

For 2 I was thinking more of the use case where someone might export the table and then someone else looks at it without the context of the code. However, I agree that it could just bloat the table. In my example the user them selves could choose to add this type of information to the table themselves if needed, so perhaps best not to add anything explicitly for 2.

@j-ittner
Copy link
Member Author

Agree. I have pushed updates, obviously your approval can wait until Monday!

Copy link
Contributor

@jason-bentley jason-bentley left a comment

Choose a reason for hiding this comment

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

Changes look great, and get the expected output when scoring metric is specified:

image

However, when this is not specified (i.e., left as default) it does not (see image below) - can we cover this fringe case as well. Thanks!

image

@j-ittner
Copy link
Member Author

Hmmm... is it safe to assume that the default scorer for regression is always r2 and the default scorer for classification is always accuracy? See sklearn docs for RegressorMixin and ClassifierMixin ..

@jason-bentley
Copy link
Contributor

Hmmm, good point. In that case let's keep things simple and maybe note in the docstring that the naming of the columns with the model performance metric is only when scoring='' is specified. Good practice is to always have scoring='' anyway.

@j-ittner
Copy link
Member Author

I had a closer look at the sklearn docs and code. There is a very clear default behaviour so I will use that for naming.

The regressive score method uses r2_score
The classifier score method uses accuracy_score

Let me make this change to the code.

Meanwhile could you check if you get meaningful names when you pass a scoring function (as a callable) to the ranker, instead of a string?

@j-ittner
Copy link
Member Author

Ok I made the changes required to identify the default scoring function for regressors and classifiers - could you please have a look? Thanks!

@jason-bentley
Copy link
Contributor

Can confirm I get r2 and accuracy as the metric names in the DF output when not specifying a value for scoring for regression and classification, respectively.

Copy link
Contributor

@jason-bentley jason-bentley left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks so much!

@j-ittner j-ittner merged commit 05ce3d3 into develop Oct 12, 2020
@j-ittner j-ittner deleted the feature/ranker_summary_report_as_frame branch October 20, 2020 15:57
@j-ittner j-ittner added this to the 1.0.1 milestone Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LeanerRanker summary output as Pandas DataFrame
2 participants