DecisionTreeRegressor
#include <Skigen/Tree>
template <typename Scalar = double>
class Skigen::DecisionTreeRegressor(max_depth=-1, min_samples_split=2, max_features_mode=0, max_features_value=0.0, random_state=std::nullopt)
A decision tree regressor.
Uses MSE (Mean Squared Error) reduction as the splitting criterion. The prediction for a leaf node is the mean of the target values.
Mirrors sklearn.tree.DecisionTreeRegressor.
Attributes:
-
feature_importances : RowVectorType
-
n_targets : int
Methods
fit(X, y)
Build a decision tree regressor from the training set.
fit(X, y)
Fit on a sparse design matrix.
The sparse input is converted to a dense MatrixType internally and forwarded to the regular split-finding path. The numerical results match a dense fit; native sparse split-finding is not implemented.
predict(X)
Predict using a sparse design matrix (densifies internally).
fit_with_indices(X, y, sample_indices)
predict(X)
Predict target values for X.
score(X, y)
Return the coefficient of determination.
fit_multi(X, Y)
Fit on a multi-target response matrix Y (n_samples × n_targets).
Implementation: fits one independent DecisionTreeRegressor per target column. This deviates from sklearn's DecisionTreeRegressor, which fits a tree whose split criterion is the sum-of-squared-errors aggregated across all targets. The independent-tree approach matches sklearn's output only when the targets are uncorrelated; for correlated targets the per-tree splits will diverge from sklearn's joint splits.
The single-target API (fit(X, y) / predict(X)) is unchanged; after fit_multi, the first target column's tree backs predict() for callers that expect a vector output.
predict_multi(X)
Multi-target predict (n_samples × n_targets).