refactoring
loss function for measure results