606a61abf04e3108949022ae1bcea975b2adb560,allennlp/training/trainer.py,Trainer,train,#Trainer#,724

Before Change


            else:
                best_validation_metric = max(validation_metric_per_epoch)
            metrics.update({f"best_validation_{k}": v for k, v in best_epoch_val_metrics.items()})
            metrics["best_epoch"] = [i for i, value in enumerate(validation_metric_per_epoch)
                                     if value == best_validation_metric][-1]
        return metrics

    def _is_best_so_far(self,
                        this_epoch_val_metric: float,

After Change


                // Update all the best_ metrics.
                // (Otherwise they just stay the same as they were.)
                metrics["best_epoch"] = epoch
                for key, value in val_metrics.items():
                    metrics["best_validation_" + key] = value

            if self._serialization_dir:
                dump_metrics(os.path.join(self._serialization_dir, f"metrics_epoch_{epoch}.json"), metrics)

            if self._learning_rate_scheduler:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 9

Instances


Project Name: allenai/allennlp
Commit Name: 606a61abf04e3108949022ae1bcea975b2adb560
Time: 2018-09-12
Author: joelgrus@gmail.com
File Name: allennlp/training/trainer.py
Class Name: Trainer
Method Name: train


Project Name: daavoo/pyntcloud
Commit Name: b6106d3044f7800af8710cbdc998ed78f7e6588c
Time: 2016-11-30
Author: daviddelaiglesiacastro@gmail.com
File Name: pyntcloud/structures/octree.py
Class Name: Octree
Method Name: get_level_as_sf


Project Name: senarvi/theanolm
Commit Name: eb8b70c825ef3e02818cbfa95c0f8a9ec4184275
Time: 2015-12-25
Author: seppo.git@marjaniemi.com
File Name: theanolm/network.py
Class Name: Network
Method Name: __init__


Project Name: pantsbuild/pants
Commit Name: 0b03c97748a27d26f5284ce1c88ed1b41316ede6
Time: 2016-11-17
Author: wangpeiyu@gmail.com
File Name: src/python/pants/backend/jvm/zinc/zinc_analysis_parser.py
Class Name: ZincAnalysisParser
Method Name: parse_deps