Skip to content

SklearnBasedRandomForestTabPFN

RandomForestTabPFNBase

Base Class for common functionalities.

fit

fit(X, y, sample_weight=None)

Fits RandomForestTabPFN :param X: Feature training data :param y: Label training data :param sample_weight: Weights of each sample :return: None.

set_categorical_features

set_categorical_features(categorical_features)

Sets categorical features :param categorical_features: Categorical features :return: None.

RandomForestTabPFNClassifier

Bases: RandomForestTabPFNBase, RandomForestClassifier

RandomForestTabPFNClassifier.

fit

fit(X, y, sample_weight=None)

Fits RandomForestTabPFN :param X: Feature training data :param y: Label training data :param sample_weight: Weights of each sample :return: None.

predict

predict(X)

Predict class for X.

The predicted class of an input sample is a vote by the trees in the forest, weighted by their probability estimates. That is, the predicted class is the one with highest mean probability estimate across the trees.

Parameters

X : {array-like, sparse matrix} of shape (n_samples, n_features) The input samples. Internally, its dtype will be converted to dtype=np.float32. If a sparse matrix is provided, it will be converted into a sparse csr_matrix.

Returns:

y : ndarray of shape (n_samples,) or (n_samples, n_outputs) The predicted classes.

predict_proba

predict_proba(X)

Predict class probabilities for X.

The predicted class probabilities of an input sample are computed as the mean predicted class probabilities of the trees in the forest. The class probability of a single tree is the fraction of samples of the same class in a leaf.

Parameters

X : {array-like, sparse matrix} of shape (n_samples, n_features) The input samples. Internally, its dtype will be converted to dtype=np.float32. If a sparse matrix is provided, it will be converted into a sparse csr_matrix.

Returns:

p : ndarray of shape (n_samples, n_classes), or a list of such arrays The class probabilities of the input samples. The order of the classes corresponds to that in the attribute :term:classes_.

set_categorical_features

set_categorical_features(categorical_features)

Sets categorical features :param categorical_features: Categorical features :return: None.

RandomForestTabPFNRegressor

Bases: RandomForestTabPFNBase, RandomForestRegressor

RandomForestTabPFNClassifier.

fit

fit(X, y, sample_weight=None)

Fits RandomForestTabPFN :param X: Feature training data :param y: Label training data :param sample_weight: Weights of each sample :return: None.

predict

predict(X)

Predict regression target for X.

The predicted regression target of an input sample is computed as the mean predicted regression targets of the trees in the forest.

Parameters

X : {array-like, sparse matrix} of shape (n_samples, n_features) The input samples. Internally, its dtype will be converted to dtype=np.float32. If a sparse matrix is provided, it will be converted into a sparse csr_matrix.

Returns:

y : ndarray of shape (n_samples,) or (n_samples, n_outputs) The predicted values.

set_categorical_features

set_categorical_features(categorical_features)

Sets categorical features :param categorical_features: Categorical features :return: None.