MCPcopy Create free account
hub / github.com/catboost/catboost / predict

Method predict

catboost/python-package/catboost/core.py:6183–6229  ·  view source on GitHub ↗

Predict with data. Parameters ---------- data : catboost.Pool or list of features or list of lists or numpy.ndarray or pandas.DataFrame or pandas.Series or polars.DataFrame or polars.Series or catboost.FeaturesData Data to apply model on.

(self, data, prediction_type=None, ntree_start=0, ntree_end=0, thread_count=-1, verbose=None, task_type="CPU")

Source from the content-addressed store, hash-verified

6181 save_snapshot, snapshot_file, snapshot_interval, init_model, callbacks, log_cout, log_cerr)
6182
6183 def predict(self, data, prediction_type=None, ntree_start=0, ntree_end=0, thread_count=-1, verbose=None, task_type="CPU"):
6184 """
6185 Predict with data.
6186
6187 Parameters
6188 ----------
6189 data : catboost.Pool or list of features or list of lists or numpy.ndarray or pandas.DataFrame or pandas.Series
6190 or polars.DataFrame or polars.Series or catboost.FeaturesData
6191 Data to apply model on.
6192 If data is a simple list (not list of lists) or a one-dimensional numpy.ndarray it is interpreted
6193 as a list of features for a single object.
6194
6195 prediction_type : string, optional (default='RawFormulaVal')
6196 Can be:
6197 - 'RawFormulaVal' : return raw formula value.
6198 - 'Exponent' : return Exponent of raw formula value.
6199
6200 ntree_start: int, optional (default=0)
6201 Model is applied on the interval [ntree_start, ntree_end) (zero-based indexing).
6202
6203 ntree_end: int, optional (default=0)
6204 Model is applied on the interval [ntree_start, ntree_end) (zero-based indexing).
6205 If value equals to 0 this parameter is ignored and ntree_end equal to tree_count_.
6206
6207 thread_count : int (default=-1)
6208 The number of threads to use when applying the model.
6209 Allows you to optimize the speed of execution. This parameter doesn't affect results.
6210 If -1, then the number of threads is set to the number of CPU cores.
6211
6212 verbose : bool
6213 If True, writes the evaluation metric measured set to stderr.
6214
6215 task_type : string, [default=None]
6216 The evaluator type.
6217 Possible values:
6218 - 'CPU'
6219 - 'GPU' (models with only numerical features are supported for now)
6220
6221 Returns
6222 -------
6223 prediction :
6224 If data is for a single object, the return value is single float formula return value
6225 otherwise one-dimensional numpy.ndarray of formula return values for each object.
6226 """
6227 if prediction_type is None:
6228 prediction_type = self._get_default_prediction_type()
6229 return self._predict(data, prediction_type, ntree_start, ntree_end, thread_count, verbose, 'predict', task_type)
6230
6231 def staged_predict(self, data, prediction_type='RawFormulaVal', ntree_start=0, ntree_end=0, eval_period=1, thread_count=-1, verbose=None):
6232 """

Calls 2

_predictMethod · 0.80