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

Sc/hier shrinkage #139

Merged
merged 20 commits into from
Aug 7, 2023
Merged

Sc/hier shrinkage #139

merged 20 commits into from
Aug 7, 2023

Conversation

sidc321
Copy link
Collaborator

@sidc321 sidc321 commented Jul 25, 2023

No description provided.

@github-actions
Copy link

github-actions bot commented Jul 30, 2023

☂️ Python Coverage

current status: ✅

Overall Coverage

Statements Covered Coverage Threshold Status
763 529 69% 60% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
Python/random_forestry/forestry.py 67% 🟢
TOTAL 67% 🟢

**updated for commit: 15d502c

… working, additional information vectors created are now exposed in the python package - average_count and split_count
Copy link
Collaborator

@edwardwliu edwardwliu left a comment

Choose a reason for hiding this comment

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

Overall changes look good, just a change to the exposed user parameters and some nits.

R/R/forestry.R Outdated Show resolved Hide resolved
src/RFNode.cpp Outdated Show resolved Hide resolved
src/forestryTree.h Outdated Show resolved Hide resolved
src/utils.h Outdated Show resolved Hide resolved
…fied to only expose one paraeter to the user not two, predictWeightsFull, valuesFull etc are now renamed post refactor
@@ -643,6 +643,7 @@ def _aggregation_oob(
exact: bool,
return_weight_matrix: bool,
training_idx: Optional[np.ndarray],
hierShrinkageLambda: float,
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Can we comply with the snake case conventions in Python?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

if hierShrinkageLambda is not None:
if hierShrinkageLambda < 0:
raise ValueError("Hierarchical shrinkage parameter must be positive!")
else:
Copy link
Collaborator

@edwardwliu edwardwliu Aug 3, 2023

Choose a reason for hiding this comment

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

This else can be removed, same with the parallel hierShrinkageLambda checks below, to avoid unnecessary nesting.

Copy link
Collaborator Author

@sidc321 sidc321 Aug 4, 2023

Choose a reason for hiding this comment

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

Have just pushed a change - is that what you had in mind @edwardwliu

Copy link
Collaborator

@edwardwliu edwardwliu left a comment

Choose a reason for hiding this comment

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

Made another loop, think we can merge in after this round, pending if @theo-s has comments.

@@ -110,7 +110,9 @@ extern "C" {
bool verbose,
std::vector<double>& predictions,
std::vector<double>& weight_matrix,
std::vector<size_t> training_idx
std::vector<size_t> training_idx,
bool hierShrinkage,
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: if possible, let's switch to snake case here as well and for new usages throughout the Python API

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

R/R/forestry.R Outdated
# hierarchical shrinkage factor must be positive
if (hierShrinkageLambda < 0){
stop("The value of the hierarchical shrinkage parameter must be positive")
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same unnecessary else statement and below as well in this R file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Have just pushed a change - is that what you had in mind

Copy link
Collaborator

@edwardwliu edwardwliu left a comment

Choose a reason for hiding this comment

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

LGTM

@edwardwliu edwardwliu merged commit ff265e0 into master Aug 7, 2023
13 checks passed
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.

3 participants