def save_data(self):
if len(self.data.keys()) == <NUM_LIT:0>:<EOL><INDENT>return<EOL><DEDENT>assert '<STR_LIT>' in self.data<EOL>sorted_indexes = np.argsort(self.data['<STR_LIT>'])<EOL>sorted_data = {}<EOL>for key, values in self.data.items():<EOL><INDENT>assert len(self.data[key]) == len(sorted_indexes)<EOL>sorted_data[key] = np.array([self.data[key][idx] for idx in sorted_indexes]).tolist()<EOL><DEDENT>with open(self.filepath, '<STR_LIT:w>') as f:<EOL><INDENT>json.dump(sorted_data, f)<EOL><DEDENT>
Save metrics in a json file