[docs]defpredict_scikit(dataset:dict[str,list[DelayedSample]],model:object,output_folder:str,model_parameters:Mapping,):"""Compute the class probabilities prediction (or prediction if predict probabilities is not possible) for a set of data, given a fitted model. The prediction are computed for all samples of all keys. :param dataset: A dictionary containing a list of DelayedSample. :param model: A scikit learn model already fitted. :param output_folder: A path where prediction will be saved :param model_parameters: a dictionary where the following key need to be defined, ``transform``: list (if data are not transformed yet) """if"transform"inmodel_parameters:compose_transform=ComposeTransform(model_parameters["transform"])fork,vindataset.items():ifnot(hasattr(v[0],"features")):v=compose_transform(v)forsampleinv:ifhasattr(model,"predict_proba"):output_prob=model.predict_proba(sample.features)elifhasattr(model,"predict"):output_prob=model.predict(sample.features)[:,None]else:logger.error("Model can not predict")output_folder_pred=os.path.join(output_folder,k)save_hdf5(sample.key,output_prob,sample.label,np.arange(0,len(sample.label)),output_folder_pred,sample.features,)return