def _check_correctness(self, computed_mfs, known_mfs, filename):
test_failures = {}<EOL>fail_message = "<STR_LIT>"<EOL>for mf_id, result in computed_mfs.items():<EOL><INDENT>computed_value = result[Metafeatures.VALUE_KEY]<EOL>known_value = known_mfs[mf_id][Metafeatures.VALUE_KEY]<EOL>correct = True<EOL>if known_value is None:<EOL><INDENT>correct = False<EOL><DEDENT>elif type(known_value) is str:<EOL><INDENT>correct = known_value == computed_value<EOL><DEDENT>else:<EOL><INDENT>correct = np.array(np.isclose(known_value, computed_value, equal_nan=True)).all()<EOL><DEDENT>if not correct:<EOL><INDENT>test_failures[mf_id] = {<EOL>"<STR_LIT>": known_value,<EOL>"<STR_LIT>": computed_value<EOL>}<EOL><DEDENT><DEDENT>return self._format_check_report(<EOL>"<STR_LIT>", fail_message, test_failures, filename<EOL>)<EOL>
Tests whether computed_mfs are close to previously computed metafeature
values. This assumes that the previously computed values are correct
and allows testing for changes in metafeature computation. Only checks
the correctness of the metafeatures passed in--does not test that all
computable metafeatures were computed.