How to use the asreview.logging.Logger.from_file function in asreview

To help you get started, we’ve selected a few asreview examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github msdslab / automated-systematic-review / test / test_oracle.py View on Github external
if use_granular:
        with Logger.from_file(log_file) as logger:
            # Two loops of training and classification.
            reviewer.train()
            reviewer.log_probabilities(logger)
            query_idx = reviewer.query(1)
            inclusions = reviewer._get_labels(query_idx)
            reviewer.classify(query_idx, inclusions, logger)

            reviewer.train()
            reviewer.log_probabilities(logger)
            query_idx = reviewer.query(1)
            inclusions = reviewer._get_labels(query_idx)
            reviewer.classify(query_idx, inclusions, logger)
    else:
        with Logger.from_file(log_file) as logger:
            if log_file is None:
                logger.set_labels(reviewer.y)
                init_idx, init_labels = reviewer._prior_knowledge()
                reviewer.query_i = 0
                reviewer.train_idx = np.array([], dtype=np.int)
                reviewer.classify(init_idx, init_labels, logger, method="initial")

            reviewer._do_review(logger)
            if log_file is None:
                print(logger._log_dict)
                check_log(logger)

    if log_file is not None:
        with Logger.from_file(log_file, read_only=True) as logger:
            check_log(logger)
github msdslab / automated-systematic-review / test / test_oracle.py View on Github external
if not continue_from_log:
        try:
            if log_file is not None:
                os.unlink(log_file)
        except OSError:
            pass

    if monkeypatch is not None:
        monkeypatch.setattr('builtins.input', lambda _: "0")
    # start the review process.
    reviewer = get_reviewer(data_fp, mode=mode, embedding_fp=embedding_fp,
                            prior_included=[1, 3], prior_excluded=[2, 4],
                            log_file=log_file,
                            **kwargs)
    if use_granular:
        with Logger.from_file(log_file) as logger:
            # Two loops of training and classification.
            reviewer.train()
            reviewer.log_probabilities(logger)
            query_idx = reviewer.query(1)
            inclusions = reviewer._get_labels(query_idx)
            reviewer.classify(query_idx, inclusions, logger)

            reviewer.train()
            reviewer.log_probabilities(logger)
            query_idx = reviewer.query(1)
            inclusions = reviewer._get_labels(query_idx)
            reviewer.classify(query_idx, inclusions, logger)
    else:
        with Logger.from_file(log_file) as logger:
            if log_file is None:
                logger.set_labels(reviewer.y)
github msdslab / automated-systematic-review / test / test_oracle.py View on Github external
else:
        with Logger.from_file(log_file) as logger:
            if log_file is None:
                logger.set_labels(reviewer.y)
                init_idx, init_labels = reviewer._prior_knowledge()
                reviewer.query_i = 0
                reviewer.train_idx = np.array([], dtype=np.int)
                reviewer.classify(init_idx, init_labels, logger, method="initial")

            reviewer._do_review(logger)
            if log_file is None:
                print(logger._log_dict)
                check_log(logger)

    if log_file is not None:
        with Logger.from_file(log_file, read_only=True) as logger:
            check_log(logger)