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

initial multiclass support - take 2 #279

Closed
wants to merge 1 commit into from
Closed

initial multiclass support - take 2 #279

wants to merge 1 commit into from

Conversation

zachmayer
Copy link
Owner

@zachmayer zachmayer commented Jul 9, 2024

rebased #191 off main, seems good now!

Initial working version of multiclass ensembling. Work to be done:

  • predict.caretList return a matrix of probs, not a vector for the positive class.
  • predict.caretStack return a matrix of probs, not a vector for the positive class.
  • Internally, makePredObsMatrix just uses positive class probs. Make it use ALL class probs so we can do proper ensembling.
  • Fix the test to do a train/test split and make a confusion matrix

Copy link
Contributor

coderabbitai bot commented Jul 9, 2024

Walkthrough

The updates encompass several areas: restructuring the default task sequence in the Makefile, commenting out specific segments of multiclass functionality and adding TODOs in helper_functions.R, modifying tests in test-helper_functions.R, and introducing new tests for multiclass models in test-multiclass.R. These changes primarily aim to reorganize the build process and refine the handling and validation of multiclass model support.

Changes

File Path Change Summary
Makefile Modified the default task sequence by placing the clean task before tasks like fix-style, install, etc.
R/helper_functions.R Partially commented out multiclass model functionality; added a TODO for models with nulls and a note to possibly use all probabilities for multiclass models.
tests/testthat/test-helper_functions.R Replaced expect_error function call with a direct call to check_caretList_model_types using models_multi as an argument.
tests/testthat/test-multiclass.R Introduced tests for caretList and caretStack functionalities for multiclass problems with the iris dataset.

Sequence Diagram(s)

Silently ignoring as generating the diagram doesn’t make sense because the changes are too simple, too varied, etc.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@zachmayer zachmayer mentioned this pull request Jul 9, 2024
4 tasks
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range and nitpick comments (6)
tests/testthat/test-multiclass.R (3)

6-11: Ensure reproducibility by setting a seed.

Consider setting a random seed to ensure reproducibility of the results.

set.seed(123)

19-19: Consider adding assertions for the caretStack object.

Add assertions to check the structure and attributes of the caretStack object.

expect_is(ens, "caretStack")

25-27: Verify the structure of the probability predictions.

The test currently checks the type and length of the probability predictions. Consider adding checks for the structure and names of the columns.

expect_true(is.matrix(p))
expect_equal(ncol(p), length(levels(iris$Species)))
expect_equal(colnames(p), levels(iris$Species))
R/helper_functions.R (3)

100-100: Clarify the TODO comment.

The TODO comment should specify the exact check needed for the savePredictions parameter.

# TODO: Add a check that if `model$pred` is null, ensure `savePredictions` was set to "final" in the trainControl.

102-102: Clarify the TODO comment.

The TODO comment should specify the exact check needed for models having null values.

# TODO: Add a check for any models having null values in their predictions.

322-322: Clarify the TODO comment.

The TODO comment should specify the need to use all class probabilities for multiclass models.

# TODO: For multiclass, use all class probabilities instead of just the positive class probabilities.
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 63602eb and 6e61ace.

Files selected for processing (4)
  • Makefile (1 hunks)
  • R/helper_functions.R (2 hunks)
  • tests/testthat/test-helper_functions.R (1 hunks)
  • tests/testthat/test-multiclass.R (1 hunks)
Files skipped from review due to trivial changes (1)
  • Makefile
Additional comments not posted (2)
tests/testthat/test-multiclass.R (1)

2-2: Good context description for the test.

The context string clearly defines the purpose of the test, which is to verify the functionality of caretList and caretStack for multiclass problems.

tests/testthat/test-helper_functions.R (1)

32-32: Good use of check_caretList_model_types.

The call to check_caretList_model_types ensures that the models are validated correctly.

@zachmayer
Copy link
Owner Author

Actually, I was able to rebase #191

@zachmayer zachmayer closed this Jul 9, 2024
@zachmayer zachmayer deleted the zam-multi branch July 9, 2024 20:12
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.

1 participant