docstr: Get model hyper-parameters and model-parameters
  as a dict that can be saved to disk.
  
  Returns
  -------
  params : dict
      dict with relevant attributes sufficient to describe the model.
docstr_tok: ["Get","model","hyper-parameters","and","model-parameters","as","a","dict","that","can","be","saved","to","disk",".","Returns","--","--","--","-","params",":","dict","dict","with","relevant","attributes","sufficient","to","describe","the","model","."]
code: def _to_dict(self, output=None, hyper_parameters_only=False):
      """
      Get model hyper-parameters and model-parameters
      as a dict that can be saved to disk.
  
      Returns
      -------
      params : dict
          dict with relevant attributes sufficient to describe the model.
      """
  
      if not self._is_fitted():
          raise NotFittedError(
              "Model must be fit before it can be packaged"
          )
  
      d = {
          "hyper_params": self.get_params(),
          "model_params": self._get_model_params(),
      }
  
      # This is just for json support to convert numpy arrays to lists
      if output == "json":
          d["model_params"] = BaseModelPackage._listify(
              d["model_params"]
          )
          d["hyper_params"] = BaseModelPackage._listify(
              d["hyper_params"]
          )
  
      elif output == "hdf5":
          d["hyper_params"] = BaseModelPackage._none_to_str(
              d["hyper_params"]
          )
  
      if hyper_parameters_only:
          del d["model_params"]
  
      return d
  
imports: from abc import ABCMeta, abstractmethod
  from sklearn.exceptions import NotFittedError
  from sklearn.base import BaseEstimator
  import json
  import pickle
  import numpy
  from warnings import warn
label_desc: Use image node_id 3 for calling the BaseModelPackage obj's underlying member method code with example usage: obj._to_dict(output, hyper_parameters_only) and returns: d