def determine_classes_based_on_gain_in_r2_score(dataset):
  """This function determines the class of each row in the dataset based on the value 
  of column 'gain_in_r2_score'
  """
  gains = dataset['gain_in_r2_score']
  classes = ['good_gain' if i > 0 else 'loss' for i in gains]
  dataset['classes'] = classes
  return dataset