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

Allow ensemble filters to include multiple base filters of the… #2693

Merged
merged 21 commits into from
Dec 19, 2019

Conversation

annette987
Copy link

PR for Issue #2688

The base methods of ensemble filters currently have to be unique, which limits the types of ensembles that can be created. This PR removes that restriction by:

  • Passing the base methods as a named list, where the names are identifiers and the values are the filter methods.
  • Passing the arguments to the filters in more.args as a named list, the same as in the current implementation, but in this case the names are the same identifiers, not the filter names.
  • Distinguishing an ensemble method from a base method by checking if the name of the filter exists in the FilterEnsembleRegister.

@larskotthoff larskotthoff requested a review from pat-s December 4, 2019 23:19
@pat-s
Copy link
Member

pat-s commented Dec 5, 2019

I'll come to this after #2698 is done.

Copy link
Member

@pat-s pat-s left a comment

Choose a reason for hiding this comment

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

Thanks!

We should wait until the PRs fixing the bugs are merged before merging a feature PR. Meanwhile, you can address the comments but maybe it makes sense to wait until the other PRs are merged to prevent multiple merging efforts.

Also please make sure to apply the mlr-style.

Copy link
Member

@pat-s pat-s left a comment

Choose a reason for hiding this comment

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

After resolving the merge conflicts and the two formatting related comments, I'd say we're ready to merge.

If you want, feel free to add yourself as an author to the package DESCRIPTION.

@annette987
Copy link
Author

Sorry, I am really not sure what is going on here. I resolved the conflicts, did and git pull and a git push and the tests failed. I tried to fix things by doing a reset and starting over, but I may have made things worse. I am not sure what to do now. Can you advise please. Thanks.

Comment on lines 149 to 150
out = melt(out, value.name = "value", measure.vars = colnames(fval),
variable.name = "method")
Copy link
Member

Choose a reason for hiding this comment

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

@annette987 This change caused the test failures. It probably slipped while solving the merge conflicts in master.

Copy link
Author

Choose a reason for hiding this comment

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

Actually that change was deliberate and was there before the merge. The reason for it is that method can now have duplicate filter names, which will cause the melt to fail. So I used colnames(fval) because that is set to names(method) if not null and method otherwise. In fact I could have used index_names, which is set to teh same thing.

Copy link
Member

@pat-s pat-s Dec 16, 2019

Choose a reason for hiding this comment

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

It could be that this change is still needed then. However, in one of the latest PRs there was the change to variable.name = "filter" which definitely needs to come into this PR here.

(The column name listing all the methods used is no longer called "method" but "filter" now to avoid name clashes in other places.)

If tests fail you should then know why and be able to solve the issue quickly :)

If tests still pass despite your concern with the duplicate filter names, it might be good to add a test to verify the correct behavior of this edge case.

Copy link
Author

Choose a reason for hiding this comment

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

All OK now. It was just the change to variable.name = "filter" as you suggested. I think the test I already added should be sufficient: https://github.com/annette987/mlr/blob/21c3b8b768baa0b1d7fcad5faf1bb38d157d7fbc/tests/testthat/test_featsel_filters.R#L149
Thanks for your patience with a Github newbie! :-)

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for your patience - we know how hard it is to make PRs to packages to comply with everything and especially in mlr 😄

It seems that you need to update man/ again, just run `devtools::document()´ or press CTRL+Shift+D in case you are using RStudio.

Copy link
Author

@annette987 annette987 Dec 17, 2019

Choose a reason for hiding this comment

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

☺️
All looks OK now.I did run devtools::document() but it updated what looked like all of the documentation files and I was reluctant to push these. So I have just resolved the conflicts instead.

Copy link
Member

Choose a reason for hiding this comment

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

I'd assume that you are not running the latest version of roxygen?
When developing pkgs, it is important to always have the most recent versions of pkgs - we usually update every few days :)

Copy link
Author

Choose a reason for hiding this comment

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

Oh OK. I will do that from now on. Thanks.

@pat-s
Copy link
Member

pat-s commented Dec 18, 2019

Thanks @annette987 for all your contributions!

@annette987
Copy link
Author

My pleasure. I have learnt a lot along the way. Thanks for all your help.
Do I need to click the 'Update branch' button, or should I leave that to you? How do we finalise this?

@pat-s pat-s changed the title Allow ensemble filters to include multiple base filters of the same type Allow ensemble filters to include multiple base filters of the… Dec 19, 2019
@pat-s pat-s merged commit cc0cc38 into mlr-org:master Dec 19, 2019
@annette987 annette987 deleted the ens_filter_duplicates branch December 19, 2019 10:57
vrodriguezf pushed a commit to vrodriguezf/mlr that referenced this pull request Jan 16, 2021
…org#2693)

* Allow ensemble filters to have duplicates of the same base method.
Pass the base methods and the arguments to them as named lists, where
the names are identifiers to identify the method used.

* Fixed problem with 'melt' - column names of fval were incorrect.

* Added unit test and news.

* Fixed call to mapply so that it cannot e called with a null argument.

* Fixed issues requested by reviewer - indentation and spaces around =.

* Changes requested in PR

* Changes requested in PR 2693

* Styling changes and authorship

* Did a reset (not hard) to try and fix problems

* whitespace > tabs

* format and fix test failures

* Changed melt to use filter, not method

* fix news

* fix filterWrapper doc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants