microsoft / gated-graph-neural-network-samples

Sample Code for Gated Graph Neural Networks
MIT License
1.03k stars 264 forks source link

reported loss #22

Closed himaghna closed 4 years ago

himaghna commented 5 years ago

Hi! It seems to me that the training/ test 'loss' reported per epoch is the mean absolute error average_per_moelcule(|y-y*|). Is that correct? I am new to tf so the syntax is not very intuitive to me.

Thanks!

mmjb commented 4 years ago

Sorry for the late reply. The code that is reported as error is the mean absolute error, see:

                diff = computed_values - self.placeholders['target_values'][internal_id,:]
                task_target_mask = self.placeholders['target_mask'][internal_id,:]
                task_target_num = tf.reduce_sum(task_target_mask) + SMALL_NUMBER
                diff = diff * task_target_mask  # Mask out unused values
                self.ops['accuracy_task%i' % task_id] = tf.reduce_sum(tf.abs(diff)) / task_target_num

(cf. https://github.com/microsoft/gated-graph-neural-network-samples/blob/master/chem_tensorflow.py#L158)

The loss itself is half of the mean squared error (tf.reduce_sum(0.5 * tf.square(diff)) / task_target_num).