code: def energies(self, samples_like, dtype=np.float):
          
          samples, labels = as_samples(samples_like)
          if labels:
              idx, label = zip(*enumerate(labels))
              labeldict = dict(zip(label, idx))
          else:
              labeldict = {}
  
          num_samples = samples.shape[0]
  
          energies = np.zeros(num_samples, dtype=dtype)
          for term, bias in self.items():
              if len(term) == 0:
                  energies += bias
              else:
                  energies += np.prod([samples[:, labeldict[v]] for v in term], axis=0) * bias
  
          return energies
docs: The energies of the given samples.
  
          Args:
              samples_like (samples_like):
                  A collection of raw samples. `samples_like` is an extension of
                  NumPy's array_like structure. See :func:`.as_samples`.
  
              dtype (:class:`numpy.dtype`, optional):
                  The data type of the returned energies. Defaults to float.
  
          Returns:
              :obj:`numpy.ndarray`: The energies.