parameters: (model, subclass)
return_statement: return converted_model
docstring: Convert a CatBoost model to a sklearn-compatible model.
  
      Parameters
      ----------
      model : CatBoost model
          a model to convert from
  
      subclass : an sklearn-compatible class
          a class to convert to : CatBoostClassifier, CatBoostRegressor or CatBoostRanker
  
      Returns
      -------
      a converted model : `subclass` type
          a model converted from the initial CatBoost `model` to a sklearn-compatible `subclass` model
docstring_summary: Convert a CatBoost model to a sklearn-compatible model.
docstring_tokens: Convert a CatBoost model to a sklearn - compatible model .
function: def _to_subclass(model, subclass):
      """
      Convert a CatBoost model to a sklearn-compatible model.
  
      Parameters
      ----------
      model : CatBoost model
          a model to convert from
  
      subclass : an sklearn-compatible class
          a class to convert to : CatBoostClassifier, CatBoostRegressor or CatBoostRanker
  
      Returns
      -------
      a converted model : `subclass` type
          a model converted from the initial CatBoost `model` to a sklearn-compatible `subclass` model
      """
      if isinstance(model, subclass):
          return model
      if not isinstance(model, CatBoost):
          raise CatBoostError('model should be a subclass of CatBoost')
  
      converted_model = subclass.__new__(subclass)
  
      # TODO(ilyzhin) change on get_all_params after MLTOOLS-4758
      params = deepcopy(model._init_params)
      _process_synonyms(params)
      if 'loss_function' in params:
          subclass._check_is_compatible_loss(params['loss_function'])
  
      for attr in model.__dict__:
          setattr(converted_model, attr, getattr(model, attr))
      return converted_model
function_tokens: def _to_subclass ( model , subclass ) : if isinstance ( model , subclass ) : return model if not isinstance ( model , CatBoost ) : raise CatBoostError ( 'model should be a subclass of CatBoost' ) converted_model = subclass . __new__ ( subclass ) # TODO(ilyzhin) change on get_all_params after MLTOOLS-4758 params = deepcopy ( model . _init_params ) _process_synonyms ( params ) if 'loss_function' in params : subclass . _check_is_compatible_loss ( params [ 'loss_function' ] ) for attr in model . __dict__ : setattr ( converted_model , attr , getattr ( model , attr ) ) return converted_model