default="../configs/nodeclf_ladies_reproduction.yml",
        help="configuration file to adopt",
    )
    argument_parser.add_argument("--seed", type=int, default=0, help="random seed")
    argument_parser.add_argument("--device", default=0, type=int, help="GPU device")

    arguments = argument_parser.parse_args()
    if torch.cuda.is_available():
        torch.cuda.set_device(arguments.device)
    seed = arguments.seed
    random.seed(seed)
    np.random.seed(seed)
    torch.manual_seed(seed)
    if torch.cuda.is_available():
        torch.cuda.manual_seed(seed)
        torch.backends.cudnn.deterministic = True
        torch.backends.cudnn.benchmark = False

    dataset = build_dataset_from_name(arguments.dataset)
    configs = yaml.load(
        open(arguments.configs, "r").read(),
        Loader=yaml.FullLoader
    )
    autoClassifier = AutoNodeClassifier.from_config(configs)
    # The running time is likely to exceed 1 hour when CiteSeer or Reddit dataset is adopted
    autoClassifier.fit(dataset, time_limit=24 * 3600, evaluation_method=[MicroF1])
    autoClassifier.get_leaderboard().show()
    predict_result = autoClassifier.predict_proba()
    res = autoClassifier.evaluate(metric=[MicroF1, 'acc'])
    print("Final Micro F1 {:.4f} Acc {:.4f}".format(res[0], res[1]))
Exemplo n.º 2
0
import os
os.environ["AUTOGL_BACKEND"] = "pyg"
import sys
sys.path.append('../')
from autogl.datasets import build_dataset_from_name
from autogl.solver import AutoNodeClassifier
from autogl.module.train import Acc
from autogl.solver.utils import set_seed
import argparse

if __name__ == '__main__':
    set_seed(202106)
    parser = argparse.ArgumentParser()
    parser.add_argument('--config', type=str, default='../configs/nodeclf_nas_gasso.yml')
    parser.add_argument('--dataset', choices=['cora', 'citeseer', 'pubmed'], default='citeseer', type=str)

    args = parser.parse_args()

    dataset = build_dataset_from_name(args.dataset)
    solver = AutoNodeClassifier.from_config(args.config)
    solver.fit(dataset)
    solver.get_leaderboard().show()
    print('acc on dataset', solver.evaluate())