def prepare_datatraining(self): """ Step to build the training and testing set """ self.array_features_totrain, self.array_labels_totrain , self.df_totrain = ext.prepare_data(self.df_decks_totrain, self.features) self.next(self.prepare_mlmagic)
def prepare_datascoring(self): """ Step to build the scoring set """ self.array_features_toscore, self.array_labels_toscore, self.df_toscore = ext.prepare_data(self.df_decks_toscore, self.features) self.next(self.prepare_mlmagic)
for idx, features in enumerate(features_cardid[:-1]): features_cardid.append(features) informations_topcards[archetypes[idx]] = features features = list(itertools.chain.from_iterable(features_cardid)) features = list(dict.fromkeys(features)) dict_df_decks_dataset = { "train" : df_decks_totrain, "test" : df_decks_totest, "score" : df_decks_toscore, } dict_df_decks_dataset_rtu = {} for dataset in dict_df_decks_dataset: array_features, array_labels, df = ext.prepare_data(dict_df_decks_dataset[dataset], features) dict_df_decks_dataset_rtu[dataset] = { "array_features" : array_features, "array_labels" : array_labels, "df" : df } parameters_model = random.choices(combinations_parameters_randomforest, k = 5) """ trigger_build_model + build_model steps """ from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import accuracy_score