class_docstr: Holds an array of fits and allows access to their attributes and
  methods
class_docstr_tok: ["Holds","an","array","of","fits","and","allows","access","to","their","attributes","and","methods"]
docstr: Predict for the multi-voxel object using each single-object's
  prediction API, with S0 provided from an array.
docstr_tok: ["Predict","for","the","multi-voxel","object","using","each","single-object's","prediction","API",",","with","S0","provided","from","an","array","."]
code: def predict(self, *args, **kwargs):
      """
      Predict for the multi-voxel object using each single-object's
      prediction API, with S0 provided from an array.
      """
      S0 = kwargs.get("S0", np.ones(self.fit_array.shape))
      idx = ndindex(self.fit_array.shape)
      ijk = next(idx)
  
      def gimme_S0(S0, ijk):
          if isinstance(S0, np.ndarray):
              return S0[ijk]
          else:
              return S0
  
      kwargs["S0"] = gimme_S0(S0, ijk)
      # If we have a mask, we might have some Nones up front, skip those:
      while self.fit_array[ijk] is None:
          ijk = next(idx)
  
      if not hasattr(self.fit_array[ijk], "predict"):
          msg = "This model does not have prediction implemented yet"
          raise NotImplementedError(msg)
  
      first_pred = self.fit_array[ijk].predict(*args, **kwargs)
      result = np.zeros(self.fit_array.shape + (first_pred.shape[-1],))
      result[ijk] = first_pred
      for ijk in idx:
          kwargs["S0"] = gimme_S0(S0, ijk)
          # If it's masked, we predict a 0:
          if self.fit_array[ijk] is None:
              result[ijk] *= 0
          else:
              result[ijk] = self.fit_array[ijk].predict(*args, **kwargs)
  
      return result
  
file_path: dipy/dipy/reconst/multi_voxel.py
imports: import numpy
  from numpy.lib.stride_tricks import as_strided
  from tqdm import tqdm
  from dipy.core.ndindex import ndindex
  from dipy.reconst.quick_squash import quick_squash
  from dipy.reconst.base import ReconstFit
label_desc: Use image node_id 5 for calling the MultiVoxelFit obj's underlying member method code with example usage: obj.predict() and returns: result, S0, S0