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='RawFormulaVal', ntree_start=0, ntree_end=0, thread_count=-1, verbose=None, task_type="CPU")
| 2930 | return predictions[0] if data_is_single_object else predictions |
| 2931 | |
| 2932 | def predict(self, data, prediction_type='RawFormulaVal', ntree_start=0, ntree_end=0, thread_count=-1, verbose=None, task_type="CPU"): |
| 2933 | """ |
| 2934 | Predict with data. |
| 2935 | |
| 2936 | Parameters |
| 2937 | ---------- |
| 2938 | data : catboost.Pool or list of features or list of lists or numpy.ndarray or pandas.DataFrame or pandas.Series |
| 2939 | or polars.DataFrame or polars.Series or catboost.FeaturesData |
| 2940 | Data to apply model on. |
| 2941 | If data is a simple list (not list of lists) or a one-dimensional numpy.ndarray it is interpreted |
| 2942 | as a list of features for a single object. |
| 2943 | |
| 2944 | prediction_type : string, optional (default='RawFormulaVal') |
| 2945 | Can be: |
| 2946 | - 'RawFormulaVal' : return raw value. |
| 2947 | - 'Class' : return class label. |
| 2948 | - 'Probability' : return probability for every class. |
| 2949 | - 'Exponent' : return Exponent of raw formula value. |
| 2950 | - 'RMSEWithUncertainty': return standard deviation for RMSEWithUncertainty loss function |
| 2951 | (logarithm of the standard deviation is returned by default). |
| 2952 | |
| 2953 | ntree_start: int, optional (default=0) |
| 2954 | Model is applied on the interval [ntree_start, ntree_end) (zero-based indexing). |
| 2955 | |
| 2956 | ntree_end: int, optional (default=0) |
| 2957 | Model is applied on the interval [ntree_start, ntree_end) (zero-based indexing). |
| 2958 | If value equals to 0 this parameter is ignored and ntree_end equal to tree_count_. |
| 2959 | |
| 2960 | thread_count : int (default=-1) |
| 2961 | The number of threads to use when applying the model. |
| 2962 | Allows you to optimize the speed of execution. This parameter doesn't affect results. |
| 2963 | If -1, then the number of threads is set to the number of CPU cores. |
| 2964 | |
| 2965 | verbose : bool, optional (default=False) |
| 2966 | If True, writes the evaluation metric measured set to stderr. |
| 2967 | |
| 2968 | task_type : string, [default=None] |
| 2969 | The evaluator type. |
| 2970 | Possible values: |
| 2971 | - 'CPU' |
| 2972 | - 'GPU' (models with only numerical features are supported for now) |
| 2973 | |
| 2974 | Returns |
| 2975 | ------- |
| 2976 | prediction : |
| 2977 | If data is for a single object, the return value depends on prediction_type value: |
| 2978 | - 'RawFormulaVal' : return raw formula value. |
| 2979 | - 'Class' : return class label. |
| 2980 | - 'Probability' : return one-dimensional numpy.ndarray with probability for every class. |
| 2981 | otherwise numpy.ndarray, with values that depend on prediction_type value: |
| 2982 | - 'RawFormulaVal' : one-dimensional array of raw formula value for each object. |
| 2983 | - 'Class' : one-dimensional array of class label for each object. |
| 2984 | - 'Probability' : two-dimensional numpy.ndarray with shape (number_of_objects x number_of_classes) |
| 2985 | with probability for every class for each object. |
| 2986 | """ |
| 2987 | return self._predict(data, prediction_type, ntree_start, ntree_end, thread_count, verbose, 'predict', task_type) |
| 2988 | |
| 2989 | def _virtual_ensembles_predict(self, data, prediction_type, ntree_end, virtual_ensembles_count, thread_count, verbose, parent_method_name): |