database Module

database Module

Defines a database object to store model results.

class pyanno.database.PyannoDatabase(filename)[source]

Bases: object

Database to store model results.

The database is based on shelve. Keys are strings that uniquely identify data sets. Values are lists of PyannoResult objects, which contain a copy of the annotations, the pyanno model that has been applied on them, and the value of the log likelihood of the annotations given the model.

close()[source]

Close database.

get_available_id()[source]

Return an data ID that has is not present in the database.

The returned IDs have the form “<new_data_N>”, where N is an integer number.

remove(data_id, idx)[source]

Remove entry from database.

Parameters:
  • data_id (string) – Readable unique identifier for the annotations set
  • idx (int) – Index in the list of entries with id data_id
retrieve_id(data_id)[source]

Return all entries with given data ID.

Parameters:data_id (string) – Readable unique identifier for the annotations set
store_result(data_id, anno_container, model, value)[source]

Store a pyAnno result in the database.

The data_id must be a unique identifier for an annotations set.

Parameters:
  • data_id (string) – Readable unique identifier for the annotations set (e.g., the file name where the annotations are stored).
  • anno_container (AnnotationsContainer) – An annotations container (see AnnotationsContainer).
  • model (object) – pyAnno model object instance (subclass of AbstractModel
  • value (float) – Value of the objective function for the model-annotations pair, typically the log likelihood of the annotations given the model
closed = None

True if the database is closed

database = None

shelve database storing the models

class pyanno.database.PyannoResult[source]

Bases: traits.has_traits.HasStrictTraits

Class for database entries

anno_container = None

AnnotationsContainer object

model = None

pyAnno model (subclass of AbstractModel)

value = None

value of the model performance (usually the log likelihood)

Table Of Contents

Previous topic

measures Package

Next topic

plots Package

This Page