class_docstr: Class that evaluates a model on a given dataset.
  
  The evaluator class is used to evaluate a `dc.models.Model` class on
  a given `dc.data.Dataset` object. The evaluator is aware of
  `dc.trans.Transformer` objects so will automatically undo any
  transformations which have been applied.
  
  Examples
  --------
  Evaluators allow for a model to be evaluated directly on a Metric
  for `sklearn`. Let's do a bit of setup constructing our dataset and
  model.
  
  >>> import deepchem as dc
  >>> import numpy as np
  >>> X = np.random.rand(10, 5)
  >>> y = np.random.rand(10, 1)
  >>> dataset = dc.data.NumpyDataset(X, y)
  >>> model = dc.models.MultitaskRegressor(1, 5)
  >>> transformers = []
  
  Then you can evaluate this model as follows
  >>> import sklearn
  >>> evaluator = Evaluator(model, dataset, transformers)
  >>> multitask_scores = evaluator.compute_model_performance(
  ...     sklearn.metrics.mean_absolute_error)
  
  Evaluators can also be used with `dc.metrics.Metric` objects as well
  in case you want to customize your metric further.
  
  >>> evaluator = Evaluator(model, dataset, transformers)
  >>> metric = dc.metrics.Metric(dc.metrics.mae_score)
  >>> multitask_scores = evaluator.compute_model_performance(metric)
class_docstr_tok: ["Class","that","evaluates","a","model","on","a","given","dataset",".","The","evaluator","class","is","used","to","evaluate","a","`","dc.models.Model","`","class","on","a","given","`","dc.data.Dataset","`","object",".","The","evaluator","is","aware","of","`","dc.trans.Transformer","`","objects","so","will","automatically","undo","any","transformations","which","have","been","applied",".","Examples","--","--","--","--","Evaluators","allow","for","a","model","to","be","evaluated","directly","on","a","Metric","for","`","sklearn","`",".","Let","'s","do","a","bit","of","setup","constructing","our","dataset","and","model",".",">",">",">","import","deepchem","as","dc",">",">",">","import","numpy","as","np",">",">",">","X","=","np.random.rand","(","10",",","5",")",">",">",">","y","=","np.random.rand","(","10",",","1",")",">",">",">","dataset","=","dc.data.NumpyDataset","(","X",",","y",")",">",">",">","model","=","dc.models.MultitaskRegressor","(","1",",","5",")",">",">",">","transformers","=","[","]","Then","you","can","evaluate","this","model","as","follows",">",">",">","import","sklearn",">",">",">","evaluator","=","Evaluator","(","model",",","dataset",",","transformers",")",">",">",">","multitask_scores","=","evaluator.compute_model_performance","(","...","sklearn.metrics.mean_absolute_error",")","Evaluators","can","also","be","used","with","`","dc.metrics.Metric","`","objects","as","well","in","case","you","want","to","customize","your","metric","further",".",">",">",">","evaluator","=","Evaluator","(","model",",","dataset",",","transformers",")",">",">",">","metric","=","dc.metrics.Metric","(","dc.metrics.mae_score",")",">",">",">","multitask_scores","=","evaluator.compute_model_performance","(","metric",")"]
docstr: Writes predictions to file.
  
  Writes predictions made on `self.dataset` to a specified file on
  disk. `self.dataset.ids` are used to format predictions.
  
  Parameters
  ----------
  y_preds: np.ndarray
      Predictions to output
  csv_out: str
      Name of file to write predictions to.
docstr_tok: ["Writes","predictions","to","file",".","Writes","predictions","made","on","`","self.dataset","`","to","a","specified","file","on","disk",".","`","self.dataset.ids","`","are","used","to","format","predictions",".","Parameters","--","--","--","--","--","y_preds",":","np.ndarray","Predictions","to","output","csv_out",":","str","Name","of","file","to","write","predictions","to","."]
code: def output_predictions(self, y_preds: np.ndarray, csv_out: str):
      """Writes predictions to file.
  
      Writes predictions made on `self.dataset` to a specified file on
      disk. `self.dataset.ids` are used to format predictions.
  
      Parameters
      ----------
      y_preds: np.ndarray
          Predictions to output
      csv_out: str
          Name of file to write predictions to.
      """
      logger.warning(
          "Evaluator.output_predictions is deprecated."
          "Please use dc.utils.evaluate.output_predictions instead."
          "This method will be removed in a future version of DeepChem."
      )
      data_ids = self.dataset.ids
      n_tasks = len(self.dataset.get_task_names())
      y_preds = np.reshape(y_preds, (len(y_preds), n_tasks))
      assert len(y_preds) == len(data_ids)
      with open(csv_out, "w") as csvfile:
          csvwriter = csv.writer(csvfile)
          csvwriter.writerow(["ID"] + self.dataset.get_task_names())
          for mol_id, y_pred in zip(data_ids, y_preds):
              csvwriter.writerow([mol_id] + list(y_pred))
  
imports: import csv
  import logging
  import warnings
  from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Union
  import numpy
  import deepchem
  from deepchem.metrics import Metric
label_desc: Use image node_id 3 for calling the Evaluator obj's underlying member method code with example usage: obj.output_predictions(y_preds, csv_out) without return types