Parameters ---------- features : must be a sequence of either integers or strings if it contains strings 'feature_names' parameter must be defined and string ids from 'features' must represent a subset of in 'feature_names' featur
(features, feature_names)
| 309 | |
| 310 | |
| 311 | def _get_features_indices(features, feature_names): |
| 312 | """ |
| 313 | Parameters |
| 314 | ---------- |
| 315 | features : |
| 316 | must be a sequence of either integers or strings |
| 317 | if it contains strings 'feature_names' parameter must be defined and string ids from 'features' |
| 318 | must represent a subset of in 'feature_names' |
| 319 | |
| 320 | feature_names : |
| 321 | A sequence of string ids for features or None. |
| 322 | Used to get feature indices for string ids in 'features' parameter |
| 323 | """ |
| 324 | if (not isinstance(features, (Sequence, np.ndarray))) or isinstance(features, (str, bytes, bytearray)): |
| 325 | raise CatBoostError("feature names should be a sequence, but got " + repr(features)) |
| 326 | if feature_names is not None: |
| 327 | return [ |
| 328 | feature_names.index(f) if isinstance(f, STRING_TYPES) else f |
| 329 | for f in features |
| 330 | ] |
| 331 | else: |
| 332 | for f in features: |
| 333 | if isinstance(f, STRING_TYPES): |
| 334 | raise CatBoostError("features parameter contains string value '{}' but feature names " |
| 335 | "for a dataset are not specified".format(f)) |
| 336 | return features |
| 337 | |
| 338 | |
| 339 | def _update_params_quantize_part(params, ignored_features, per_float_feature_quantization, border_count, |
no test coverage detected