RuleTreeBase#
- class RuleTreeBase[source]#
Bases:
BaseEstimator,ABCBase class for RuleTree estimators.
RuleTree estimators may receive one input container for each supported data type:
Xfor tabular data,X_tsfor time series,X_imgfor images, andX_txtfor text. The only assumption made by this base class is that the first dimension of every provided container is the number of samples. This is enough to validate that all provided inputs, andywhen available, refer to the same set of instances.Internally, the inputs are handled as a single dictionary
{data_type: array}(seeRuleTree.utils.define.DATA_INPUT_TYPES), built by_validate_inputs().Notes
The class follows the scikit-learn estimator API by inheriting from
sklearn.base.BaseEstimator. The base implementation only validates inputs; concrete estimators are expected to implement the actual fitting and prediction behavior.See also
RuleTree.tree.RuleTree.RuleTreethe base class of the trees.
- fit(X=None, y=None, X_ts=None, X_img=None, X_txt=None)[source]#
Validate input data before fitting.
- Parameters:
X (array-like of shape (n_samples, n_features), default=None) – Tabular input data.
X_ts (array-like of shape (n_samples, ...), default=None) – Time-series input data.
X_img (array-like of shape (n_samples, ...), default=None) – Image input data.
X_txt (array-like of shape (n_samples, ...), default=None) – Text input data.
y (array-like of shape (n_samples,), default=None) – Target values.
- Returns:
self – The validated estimator instance.
- Return type:
- Raises:
ValueError – If no input container is provided, or if the provided containers and
ydo not have a consistent number of samples.
- predict(X=None, X_ts=None, X_img=None, X_txt=None)[source]#
Validate input data before prediction.
- Parameters:
X (array-like of shape (n_samples, n_features), default=None) – Tabular input data.
X_ts (array-like of shape (n_samples, ...), default=None) – Time-series input data.
X_img (array-like of shape (n_samples, ...), default=None) – Image input data.
X_txt (array-like of shape (n_samples, ...), default=None) – Text input data.
- Raises:
ValueError – If no input container is provided, or if the provided containers do not have a consistent number of samples.