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='Class', ntree_start=0, ntree_end=0, thread_count=-1, verbose=None, task_type="CPU")
| 5550 | return self |
| 5551 | |
| 5552 | def predict(self, data, prediction_type='Class', ntree_start=0, ntree_end=0, thread_count=-1, verbose=None, task_type="CPU"): |
| 5553 | """ |
| 5554 | Predict with data. |
| 5555 | |
| 5556 | Parameters |
| 5557 | ---------- |
| 5558 | data : catboost.Pool or list of features or list of lists or numpy.ndarray or pandas.DataFrame or pandas.Series |
| 5559 | or polars.DataFrame or polars.Series or catboost.FeaturesData |
| 5560 | Data to apply model on. |
| 5561 | If data is a simple list (not list of lists) or a one-dimensional numpy.ndarray it is interpreted |
| 5562 | as a list of features for a single object. |
| 5563 | |
| 5564 | prediction_type : string, optional (default='Class') |
| 5565 | Can be: |
| 5566 | - 'RawFormulaVal' : return raw formula value. |
| 5567 | - 'Class' : return class label. |
| 5568 | - 'Probability' : return probability for every class. |
| 5569 | - 'LogProbability' : return log probability for every class. |
| 5570 | |
| 5571 | ntree_start: int, optional (default=0) |
| 5572 | Model is applied on the interval [ntree_start, ntree_end) (zero-based indexing). |
| 5573 | |
| 5574 | ntree_end: int, optional (default=0) |
| 5575 | Model is applied on the interval [ntree_start, ntree_end) (zero-based indexing). |
| 5576 | If value equals to 0 this parameter is ignored and ntree_end equal to tree_count_. |
| 5577 | |
| 5578 | thread_count : int (default=-1) |
| 5579 | The number of threads to use when applying the model. |
| 5580 | Allows you to optimize the speed of execution. This parameter doesn't affect results. |
| 5581 | If -1, then the number of threads is set to the number of CPU cores. |
| 5582 | |
| 5583 | verbose : bool, optional (default=False) |
| 5584 | If True, writes the evaluation metric measured set to stderr. |
| 5585 | |
| 5586 | task_type : string, [default=None] |
| 5587 | The evaluator type. |
| 5588 | Possible values: |
| 5589 | - 'CPU' |
| 5590 | - 'GPU' (models with only numerical features are supported for now) |
| 5591 | |
| 5592 | Returns |
| 5593 | ------- |
| 5594 | prediction: |
| 5595 | If data is for a single object, the return value depends on prediction_type value: |
| 5596 | - 'RawFormulaVal' : return raw formula value. |
| 5597 | - 'Class' : return class label. |
| 5598 | - 'Probability' : return one-dimensional numpy.ndarray with probability for every class. |
| 5599 | - 'LogProbability' : return one-dimensional numpy.ndarray with |
| 5600 | log probability for every class. |
| 5601 | otherwise numpy.ndarray, with values that depend on prediction_type value: |
| 5602 | - 'RawFormulaVal' : one-dimensional array of raw formula value for each object. |
| 5603 | - 'Class' : one-dimensional array of class label for each object. |
| 5604 | - 'Probability' : two-dimensional numpy.ndarray with shape (number_of_objects x number_of_classes) |
| 5605 | with probability for every class for each object. |
| 5606 | - 'LogProbability' : two-dimensional numpy.ndarray with shape (number_of_objects x number_of_classes) |
| 5607 | with log probability for every class for each object. |
| 5608 | """ |
| 5609 | return self._predict(data, prediction_type, ntree_start, ntree_end, thread_count, verbose, 'predict', task_type) |