Skip to content

Conversation

@eschmidt42
Copy link
Owner

This pull request refactors the codebase to move all decision tree–related modules into a new models subpackage, updates all import statements accordingly, and introduces utility functions to handle random sampling of features and samples. It also includes some minor improvements to scikit-learn compatibility and code clarity. The changes affect both the library code and the example notebooks.

1. Codebase Restructuring and Import Updates

  • Moved all decision tree modules (e.g., estimators.py, node.py, predict.py, split.py, train.py, visualize.py, and related objects) from random_tree_models/decisiontree/ to random_tree_models/models/decisiontree/ and updated all corresponding import statements throughout the codebase and notebooks. [1] [2] [3] [4] [5] [6] [7] F011abadL3R3, [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21]

2. Utility Functions for Random Sampling

  • Added new utility functions get_random_sample_ids and get_random_feature_ids in random_tree_models/models/decisiontree/random.py to encapsulate logic for randomly selecting samples and features, and refactored their usage in the decision tree estimator code. [1] [2]

3. Improvements to scikit-learn Compatibility

  • Updated the way scikit-learn estimator tags are handled for decision tree classifiers to use ClassifierTags and the __sklearn_tags__ method, improving integration with scikit-learn's estimator checks. [1] [2]

4. Minor Enhancements and Cleanups

  • Replaced usage of the old dtree alias with direct imports of DecisionTreeClassifier and DecisionTreeRegressor in ensemble models (ExtraTrees, GradientBoostedTrees), and simplified type annotations. (F011abadL3R3, [1] [2] [3] [4] [5] [6]
  • Added a check to ensure n_trees is greater than zero in GradientBoostedTreesRegressor using is_greater_zero.

These changes modernize the code structure, improve maintainability, and enhance compatibility with scikit-learn conventions.

@eschmidt42 eschmidt42 merged commit 4e5961f into main Aug 17, 2025
4 checks passed
@eschmidt42 eschmidt42 changed the title Feat/random improvements 2025 08 17 feat: random improvements 2025 08 17 Aug 17, 2025
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