code: def output_predictions(
      dataset: "dc.data.Dataset", y_preds: np.ndarray, csv_out: str
  ) -> None:
      """Writes predictions to file.
  
      Writes predictions made on `dataset` to a specified file on
      disk. `dataset.ids` are used to format predictions. The produce CSV file will have format as follows
  
      | ID          | Task1Name    | Task2Name    |
      | ----------- | ------------ | ------------ |
      | identifer1  | prediction11 | prediction12 |
      | identifer2  | prediction21 | prediction22 |
  
      Parameters
      ----------
      dataset: dc.data.Dataset
          Dataset on which predictions have been made.
      y_preds: np.ndarray
          Predictions to output
      csv_out: str
          Name of file to write predictions to.
      """
      data_ids = dataset.ids
      n_tasks = len(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"] + 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 2 for calling a global function with example usage: output_predictions(dataset, y_preds, csv_out) without return types