class_docstr: Dummy model class used for inference with static predictions from the user.
  
  Parameters
  ----------
  train: TextData
      Dataset, representing data an estimator was fitted on.
  test: TextData
      Dataset, representing data an estimator predicts on.
  y_pred_train: np.ndarray
      Array of the model prediction over the train dataset.
  y_pred_test: np.ndarray
      Array of the model prediction over the test dataset.
  y_proba_train: np.ndarray
      Array of the model prediction probabilities over the train dataset.
  y_proba_test: np.ndarray
      Array of the model prediction probabilities over the test dataset.
  validate_data_on_predict: bool, default = True
      If true, before predicting validates that the received data samples have the same index as in original data.
class_docstr_tok: ["Dummy","model","class","used","for","inference","with","static","predictions","from","the","user",".","Parameters","--","--","--","--","--","train",":","TextData","Dataset",",","representing","data","an","estimator","was","fitted","on",".","test",":","TextData","Dataset",",","representing","data","an","estimator","predicts","on",".","y_pred_train",":","np.ndarray","Array","of","the","model","prediction","over","the","train","dataset",".","y_pred_test",":","np.ndarray","Array","of","the","model","prediction","over","the","test","dataset",".","y_proba_train",":","np.ndarray","Array","of","the","model","prediction","probabilities","over","the","train","dataset",".","y_proba_test",":","np.ndarray","Array","of","the","model","prediction","probabilities","over","the","test","dataset",".","validate_data_on_predict",":","bool",",","default","=","True","If","true",",","before","predicting","validates","that","the","received","data","samples","have","the","same","index","as","in","original","data","."]
docstr: Initialize dummy model.
docstr_tok: ["Initialize","dummy","model","."]
code: def __init__(
      self,
      *,
      test: TextData,
      y_pred_test: TTextPred,
      y_proba_test: TTextProba,
      model_classes: t.List[t.Any],
      train: t.Optional[TextData] = None,
      y_pred_train: t.Optional[TTextPred] = None,
      y_proba_train: t.Optional[TTextProba] = None,
      validate_data_on_predict: bool = True,
      multilabel_proba_threshold: float = 0.5,
  ):
      """Initialize dummy model."""
      predictions = {}
      probas = {}
  
      if train is not None and test is not None:
          # check if datasets have same indexes
          train_index = train.get_original_text_indexes()
          test_index = test.get_original_text_indexes()
          if set(train_index) & set(test_index):
              train._original_text_index = np.asarray(
                  [f"train-{i}" for i in train_index]
              )
              test._original_text_index = np.asarray(
                  [f"test-{i}" for i in test_index]
              )
              # # This is commented out as currently text data indices are len(range(len(data)))
              # # TODO: Uncomment when text data indices are not len(range(len(data)))
              # get_logger().warning('train and test datasets have common index - adding "train"/"test"'
              #                      ' prefixes. To avoid that provide datasets with no common indexes '
              #                      'or pass the model object instead of the predictions.')
  
      for dataset, y_pred, y_proba in (
          (train, y_pred_train, y_proba_train),
          (test, y_pred_test, y_proba_test),
      ):
          if dataset is None:
              continue
  
          if dataset.is_multi_label_classification():
              y_pred, y_proba = _validate_multilabel(
                  dataset=dataset,
                  predictions=y_pred,
                  probabilities=y_proba,
                  n_of_classes=len(model_classes),
              )
              if y_pred is None and y_proba is not None:
                  y_pred = (
                      np.array(y_proba) > multilabel_proba_threshold
                  )
                  y_pred = y_pred.astype(int)
  
          elif dataset.task_type is TaskType.TEXT_CLASSIFICATION:
              y_pred, y_proba = _validate_text_classification(
                  dataset=dataset,
                  predictions=y_pred,
                  probabilities=y_proba,
                  n_of_classes=len(model_classes),
              )
              if y_pred is None and y_proba is not None:
                  y_pred = np.argmax(np.array(y_proba), axis=-1)
                  y_pred = np.array(model_classes, dtype="str")[y_pred]
  
          elif dataset.task_type is TaskType.TOKEN_CLASSIFICATION:
              _validate_token_classification(
                  dataset=dataset,
                  predictions=y_pred,
                  probabilities=y_proba,
              )
  
          else:
              raise ValueError(
                  f"Unknown task type - {type(dataset.task_type)}"
              )
  
          if y_pred is not None:
              y_pred_dict = dict(
                  zip(dataset.get_original_text_indexes(), y_pred)
              )
              predictions.update({dataset.name: y_pred_dict})
          if y_proba is not None:
              y_proba_dict = dict(
                  zip(dataset.get_original_text_indexes(), y_proba)
              )
              probas.update({dataset.name: y_proba_dict})
  
      self.predictions = predictions
      self.probas = probas
      self.validate_data_on_predict = validate_data_on_predict
      self._classes = model_classes
  
      if self.predictions:
          self.predict = self._predict
          self._prediction_indices = {
              name: set(data_preds.keys())
              for name, data_preds in self.predictions.items()
          }
      if self.probas:
          self.predict_proba = self._predict_proba
          self._proba_indices = {
              name: set(data_proba.keys())
              for name, data_proba in self.probas.items()
          }
  
imports: import typing
  from operator import itemgetter
  import numpy
  from deepchecks.core.context import BaseContext
  from deepchecks.core.errors import DatasetValidationError, DeepchecksNotSupportedError, DeepchecksValueError, ModelValidationError
  from deepchecks.nlp.input_validations import _validate_multilabel, _validate_text_classification, _validate_token_classification, compare_dataframes
  from deepchecks.nlp.metric_utils.scorers import init_validate_scorers
  from deepchecks.nlp.metric_utils.token_classification import get_default_token_scorers, get_scorer_dict, validate_scorers
  from deepchecks.nlp.task_type import TaskType
  from deepchecks.nlp.text_data import TextData
  from deepchecks.nlp.utils.data_inference import infer_observed_and_model_labels
  from deepchecks.tabular.metric_utils import DeepcheckScorer, get_default_scorers
  from deepchecks.tabular.utils.task_type import TaskType
  from deepchecks.utils.docref import doclink
  from deepchecks.utils.logger import get_logger
  from deepchecks.utils.typing import BasicModel
  from deepchecks.utils.validation import is_sequence_not_str
label_desc: Use image node_id 1 to create a new _DummyModel object from inherited base classes: BasicModel with example: obj = _DummyModel()