' + self._legend())
+
+ return html
+
+ def _table_header(self, score_name, input_names):
+ """
+ Generate a table header with the name of the evaluation score in the first
+ column and then one column for each probing signal.
+ """
+ html = (
+ '
{}
'.format(self._format_name(score_name)) +
+ '
' + '
'.join(
+ [self._format_name(name) for name in input_names]) + '
')
+ return html
+
+ def _table_row(self, score_name, config_name, scores, input_names):
+ """
+ Generate a table body row with the name of the APM configuration file in the
+ first column and then one column for each probing singal.
+ """
+ cells = [self._table_cell(
+ scores[input_name], score_name, config_name, input_name) for (
+ input_name) in input_names]
+ html = ('
{}
'.format(self._format_name(config_name)) +
+ '
' + '
'.join(cells) + '
')
+ return html
+
+ def _table_cell(self, scores, score_name, config_name, input_name):
+ """
+ Generate a table cell content with all the scores for the current evaluation
+ score, APM configuration, and probing signal.
+ """
+ # Init noise generator names and noise parameters cache (if not done).
+ if self._noise_names is None:
+ self._noise_names = sorted(scores.keys())
+ self._noise_params = {noise_name: sorted(scores[noise_name].keys()) for (
+ noise_name) in self._noise_names}
+
+ # For each noisy input (that is a pair of noise generator name and noise
+ # generator parameters), add an item with the score and its metadata.
+ items = []
+ for name_index, noise_name in enumerate(self._noise_names):
+ for params_index, noise_params in enumerate(
+ self._noise_params[noise_name]):
+
+ # Init.
+ score_value = '?'
+ metadata = ''
+
+ # Extract score value and its metadata.
+ try:
+ data = scores[noise_name][noise_params]
+ score_value = '{0:f}'.format(data['score'])
+ metadata = (
+ ''
+ ''
+ ''
+ ''
+ ''
+ ).format(
+ noise_name,
+ noise_params,
+ data['audio_in_filepath'],
+ data['audio_out_filepath'],
+ data['audio_ref_filepath'])
+ except TypeError:
+ logging.warning(
+ 'missing score found: '
+ '', score_name, config_name, input_name,
+ noise_name, noise_params)
+
+ # Add the score.
+ items.append(
+ '
')
+
+ return html
+
+ def _legend(self):
+ """
+ Generate the legend for each noise generator name and parameters pair.
+ """
+ items = []
+ for name_index, noise_name in enumerate(self._noise_names):
+ for params_index, noise_params in enumerate(
+ self._noise_params[noise_name]):
+ items.append('