Skip to content

Calculate number of nodes in the tree estimators#214

Open
avolkov-intel wants to merge 1 commit into
IntelPython:mainfrom
avolkov-intel:dev/anatolyv-ensemble-nnodes
Open

Calculate number of nodes in the tree estimators#214
avolkov-intel wants to merge 1 commit into
IntelPython:mainfrom
avolkov-intel:dev/anatolyv-ensemble-nnodes

Conversation

@avolkov-intel
Copy link
Copy Markdown
Collaborator

Description

  • Automatically report total number of tree nodes (n_nodes) for Random Forest and Extra Trees estimators after training
  • Register n_nodes as an indifferent metric in the report so it's compared across libraries rather than treated as a grouping parameter

Checklist:

Completeness and readability

  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes or created a separate PR with updates and provided its number in the description, if necessary.
  • Git commit message contains an appropriate signed-off-by string (see CONTRIBUTING.md for details).
  • I have resolved any merge conflicts that might occur with the base branch.

Testing

  • I have run it locally and tested the changes extensively.
  • All CI jobs are green or I have provided justification why they aren't.
  • I have extended testing suite if new functionality was introduced in this PR.

and isinstance(iterations[0], Union[Numeric, NumpyNumeric].__args__)
):
metrics.update({"iterations": int(iterations[0])})
if hasattr(estimator_instance, "estimators_"):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This will also be set in other types of estimators - for example:
https://scikit-learn.org/stable/modules/generated/sklearn.multiclass.OneVsRestClassifier.html

Perhaps it could check if the first entry there is of tree type.

Also what about cuML? I guess it could be done by calling as_sklearn():
https://docs.rapids.ai/api/cuml/nightly/pickling_cuml_models/#Converting-Between-cuML-and-scikit-learn-Models

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.

2 participants