code: def dict_to_dataset(
      data,
      *,
      attrs=None,
      library=None,
      coords=None,
      dims=None,
      default_dims=None,
      index_origin=None,
      skip_event_dims=None,
  ):
      """Convert a dictionary of numpy arrays to an xarray.Dataset.
  
      Parameters
      ----------
      data : dict[str] -> ndarray
          Data to convert. Keys are variable names.
      attrs : dict
          Json serializable metadata to attach to the dataset, in addition to defaults.
      library : module
          Library used for performing inference. Will be attached to the attrs metadata.
      coords : dict[str] -> ndarray
          Coordinates for the dataset
      dims : dict[str] -> list[str]
          Dimensions of each variable. The keys are variable names, values are lists of
          coordinates.
      default_dims : list of str, optional
          Passed to :py:func:`numpy_to_data_array`
      index_origin : int, optional
          Passed to :py:func:`numpy_to_data_array`
      skip_event_dims : bool
          If True, cut extra dims whenever present to match the shape of the data.
          Necessary for PPLs which have the same name in both observed data and log
          likelihood groups, to account for their different shapes when observations are
          multivariate.
  
      Returns
      -------
      xr.Dataset
  
      Examples
      --------
      dict_to_dataset({'x': np.random.randn(4, 100), 'y': np.random.rand(4, 100)})
  
      """
      if dims is None:
          dims = {}
  
      data_vars = {
          key: numpy_to_data_array(
              values,
              var_name=key,
              coords=coords,
              dims=dims.get(key),
              default_dims=default_dims,
              index_origin=index_origin,
              skip_event_dims=skip_event_dims,
          )
          for key, values in data.items()
      }
      return xr.Dataset(
          data_vars=data_vars,
          attrs=make_attrs(attrs=attrs, library=library),
      )
  
imports: import datetime
  import functools
  import importlib
  import re
  import warnings
  from copy import deepcopy
  from typing import Any, Callable, Dict, List, Optional, Tuple, TypeVar, Union
  import numpy
  import xarray
  from ..None import __version__, utils
  from ..rcparams import rcParams
label_desc: Use image node_id 3 for calling a global function with example usage: dict_to_dataset(data) and returns: xr