asreview.state.SQLiteState

class asreview.state.SQLiteState(read_only=True)[source]

Class for storing the review state.

The results are stored in a sqlite database.

Parameters:

read_only (bool) – Open state in read only mode. Default False.

Variables:
  • version (str) – Return the version number of the state.

  • settings (asreview.settings.ASReviewSettings) – Return an ASReview settings object with model settings and active learning settings.

  • n_records_labeled (int) – Get the number of labeled records, where each prior is counted individually.

  • n_priors (int) – Number of priors. If priors have not been selected returns None.

  • exist_new_labeled_records (bool) – Have there been labeled records added to the state since the last time a model ranking was added to the state?

  • model_has_trained (bool) – Has the ranking by a model been added to the state?

Attributes

exist_new_labeled_records

Return True if there are new labeled records.

model_has_trained

Return True if there is data of a trained model in the state.

n_priors

Number of records added as prior knowledge.

n_records

Number of records in the loop.

n_records_labeled

Number labeled records.

settings

Settings of the ASReview pipeline.

version

Version number of the state.

Methods

add_labeling_data(record_ids, labels[, ...])

Add the data corresponding to a labeling action to the state file.

add_last_probabilities(probabilities)

Save the probabilities produced by the last classifier.

add_last_ranking(ranked_record_ids, ...)

Save the ranking of the last iteration of the model.

add_note(note, record_id)

Add a text note to save with a labeled record.

add_record_table(record_ids)

Add the record table to the state.

close()

Close the files opened by the state.

connect_to_sql_r()

Get a connection to the SQLite database.

connect_to_sql_wr()

Get a connection to the SQLite database.

delete_record_labeling_data(record_id)

Delete the labeling data for the given record id.

get_balance_strategies([priors, pending])

Get the balance strategies from the state.

get_classifiers([priors, pending])

Get the classifiers from the state.

get_data_by_query_number(query[, columns])

Get the data of a specific query from the results table.

get_data_by_record_id(record_id[, columns])

Get the data of a specific query from the results table.

get_dataset([columns, priors, pending])

Get a subset from the results table.

get_decision_changes()

Get the record ids for any decision changes.

get_feature_extraction([priors, pending])

Get the query strategies from the state.

get_labeled()

Get the labeled records in order of labeling.

get_labeling_times([time_format, priors, ...])

Get the time of labeling from the state.

get_labels([priors, pending])

Get the labels from the state.

get_last_probabilities()

Get the probabilities produced by the last classifier.

get_last_ranking()

Get the ranking from the state.

get_order_of_labeling([priors, pending])

Get full array of record id's in order that they were labeled.

get_pending()

Get the record_ids of the records pending a labeling decision.

get_pool()

Get the unlabeled, not-pending records in ranking order.

get_pool_labeled_pending()

Return the unlabeled pool, labeled and pending records.

get_priors([columns])

Get the record ids of the priors.

get_query_strategies([priors, pending])

Get the query strategies from the state.

get_record_table()

Get the record table of the state.

get_training_sets([priors, pending])

Get the training_sets from the state.

is_empty()

Check if state has no results.

query_top_ranked(n)

Get the top ranked records from the ranking table.

to_dict()

Convert state to dictionary.

update_decision(record_id, label[, note, tags])

Change the label of an already labeled record.