in bindings/jupyter/mlvis/widget_ext/Manifold.py [0:0]
def process_y_pred(self, y_pred):
"""
Convert y pred feature -- the predictions of each features for each model into the manifold recognized informat
:param y_pred: A ndarray/list of data frames. Each data frame is the predict probability of one model,
which each column being the predicted probability for one class
:return: A list for the y_pred attribute with the manifold data format
"""
if isinstance(y_pred, np.ndarray):
return [y.to_dict('records') if isinstance(y, pd.DataFrame) else y for y in np.nditer(y_pred)]
else:
return [y.to_dict('records') if isinstance(y, pd.DataFrame) else y for y in y_pred]