f35b10ad6e8bd19dba0cc1eb1d1338f51fefcdcf,examples/molnet/train_molnet.py,,main,#,55

Before Change


    trainer.extend(E.snapshot(), trigger=(args.epoch, "epoch"))
    trainer.extend(E.LogReport())
    print_report_targets = ["epoch", "main/loss", "validation/main/loss"]
    if metrics_fun is not None and type(metrics_fun) == dict:
        for m_k in metrics_fun.keys():
            print_report_targets.append("main/"+m_k)
            print_report_targets.append("validation/main/"+m_k)

After Change


    trainer.extend(E.snapshot(), trigger=(args.epoch, "epoch"))
    trainer.extend(E.LogReport())
    print_report_targets = ["epoch", "main/loss", "validation/main/loss"]
    for metric_name, metric_fun in metrics.items():
        if isinstance(metric_fun, types.FunctionType):
            print_report_targets.append("main/" + metric_name)
            print_report_targets.append("validation/main/" + metric_name)
        elif BatchEvaluator in inspect.getmro(metric_fun):
            // Evaluation for train data takes time, skip for now.
            // trainer.extend(metric_fun(
            //     train_iter, model, device=args.gpu, eval_func=predictor,
            //     converter=concat_mols, name="train",
            //     raise_value_error=False))
            // print_report_targets.append("train/main/roc_auc")
            trainer.extend(metric_fun(
                val_iter, model, device=args.gpu, eval_func=predictor,
                converter=concat_mols, name="val", raise_value_error=False))
            print_report_targets.append("val/main/" + metric_name)
        else:
            raise TypeError
    print_report_targets.append("elapsed_time")
    trainer.extend(E.PrintReport(print_report_targets))
    trainer.extend(E.ProgressBar())
    trainer.run()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: pfnet-research/chainer-chemistry
Commit Name: f35b10ad6e8bd19dba0cc1eb1d1338f51fefcdcf
Time: 2018-07-14
Author: mottodora@gmail.com
File Name: examples/molnet/train_molnet.py
Class Name:
Method Name: main


Project Name: Microsoft/nni
Commit Name: b7366b685afdde156e551f8ba5008857f789e368
Time: 2019-02-11
Author: 871886504@qq.com
File Name: tools/nni_annotation/code_generator.py
Class Name:
Method Name: test_variable_equal


Project Name: CNuge/kaggle-code
Commit Name: e8dbb918a8ec454320bedb6d6c8e97009b2ddf68
Time: 2018-01-10
Author: nugentc@uoguelph.ca
File Name: california_housing/feature_engineering.py
Class Name:
Method Name:


Project Name: pantsbuild/pants
Commit Name: 595799cb641c6514eccd4b6908cfaf4426c5a389
Time: 2015-10-23
Author: john.sirois@gmail.com
File Name: src/python/pants/engine/exp/configuration.py
Class Name: Configuration
Method Name: create