def evaluation(self): """ Admin function: Runs the whole evaluation """ aicrowd_helpers.execution_start() try: with time_limit(self.inference_setup_timeout): self.prediction_setup() except NotImplementedError: print("prediction_setup doesn't exist for this run, skipping...") aicrowd_helpers.execution_running() music_names = self.get_all_music_names() for music_name in music_names: with time_limit(self.inference_per_music_timeout): self.prediction( mixture_file_path=self.get_music_file_location(music_name), bass_file_path=self.get_music_file_location( music_name, "bass"), drums_file_path=self.get_music_file_location( music_name, "drums"), other_file_path=self.get_music_file_location( music_name, "other"), vocals_file_path=self.get_music_file_location( music_name, "vocals"), ) if not self.verify_results(music_name): raise Exception( "verification failed, demixed files not found.") aicrowd_helpers.execution_success()
def evaluation(self): aicrowd_helpers.execution_start() try: with time_limit(self.predictions_setup_timeout): self.predict_setup() except NotImplementedError: print("predict_setup doesn't exist for this run, skipping...") aicrowd_helpers.execution_running() test_df = pd.read_csv(self.test_data_path) predictions = [] for _, row in test_df.iterrows(): with time_limit(self.predictions_timeout): prediction_arr = self.predict(row['SMILES']) prediction = ';'.join([','.join(sorted(set(i))) for i in prediction_arr]) predictions.append(prediction) submission_df = pd.DataFrame({ "SMILES" : test_df.SMILES.tolist(), "PREDICTIONS" : predictions }) submission_df.to_csv( self.predictions_output_path, index=False ) aicrowd_helpers.execution_success()