swap.utils.control

class swap.utils.control.SWAP(config)[source]

Bases: object

__init__(config)[source]

Initialize self. See help(type(self)) for accurate signature.

apply_gold(subject, gold)[source]
apply_golds(golds)[source]
apply_subjects()[source]
classify(user, subject, cl, id_)[source]
classmethod load(name)[source]
performance
retire()[source]
save()[source]
score_subjects()[source]
score_users()[source]
truncate()[source]

swap.utils.config

class swap.utils.config.Config(name, **kwargs)[source]

Bases: object

__init__(name, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

dump()[source]
classmethod load(data)[source]

swap.utils.collection

class swap.utils.collection.Collection(config, items=None)[source]

Bases: object

__init__(config, items=None)[source]

Initialize self. See help(type(self)) for accurate signature.

add(item)[source]
dump()[source]
iter()[source]
keys()[source]
list()[source]
load(data)[source]
static new(item)[source]
subset(items)[source]
truncate()[source]

swap.utils.online

class swap.utils.online.Online[source]

Bases: object

static receive(swap)[source]
static send(swap)[source]

swap.utils.parser

class swap.utils.parser.ClassificationParser(config)[source]

Bases: object

__init__(config)[source]

Initialize self. See help(type(self)) for accurate signature.

parse(cl)[source]
class swap.utils.parser.AnnotationParser(config)[source]

Bases: object

__init__(config)[source]

Initialize self. See help(type(self)) for accurate signature.

parse(annotations)[source]

swap.utils.subject

class swap.utils.subject.Subject(subject, gold, config, score=None, seen=0, retired=None)[source]

Bases: object

Class to track an individual subject, its gold status, and its score.

__init__(subject, gold, config, score=None, seen=0, retired=None)[source]

Initialize self. See help(type(self)) for accurate signature.

classify(user, cl)[source]

Add a classification to this subject

user: user that made the classification cl: classification, 1 or 0

dump()[source]

Dump this subject

classmethod load(data)[source]

Load a subject from dumped data

classmethod new(subject, gold, config)[source]

Create a new Subject

score
truncate()[source]

Clear the history of this subject, and update the prior to the current score.

update_score(thresholds=None, history=False)[source]

Recalculate the score for this subject from its stored classification history.

thresholds: Also update retirement status of this subject given
threshold parameters. (bogus, real)

history: (bool) Return list of score history

update_user(user)[source]

Update the history of this subject when a user’s score has changed

class swap.utils.subject.Subjects(config, items=None)[source]

Bases: swap.utils.collection.Collection

Collection of Subjects

get_changed()[source]
gold()[source]

Return subjects that have a gold label

new(subject)[source]

Create and return a new Subject

retired()[source]

Return all retired subjects

class swap.utils.subject.Thresholds(subjects, fpr, mdr, thresholds=None)[source]

Bases: object

Class to determine retirement thresholds

Thresholds are determined from the false positive rate (fpr) and the missed detection rate (mdr), considering only the subjects with gold labels. The bogus retirement threshold is set such that a rate equal to mdr of real subjects are mislabeled as bogus. The real retirement threshold is set such that a rate equal to fpr of bogus subjects are labeled as real.

__init__(subjects, fpr, mdr, thresholds=None)[source]

Initialize self. See help(type(self)) for accurate signature.

dump()[source]

Dump thresholds object

get_counts(scores)[source]

Get number of subjects in each gold label class (-1,0,1)

get_scores()[source]

Generate sorted list of subject scores and gold labels

classmethod load(subjects, data)[source]

Load thresholds from dumped data

swap.utils.user

class swap.utils.user.User(user, username, confusion, config)[source]

Bases: object

__init__(user, username, confusion, config)[source]
Parameters:confusion (([0_numer, 1_numer], [0_denom, 1_denom])) –
classify(subject, cl)[source]
confusion
dump()[source]
classmethod load(data)[source]
classmethod new(user, username, config)[source]
save()[source]
score
truncate()[source]
update_score()[source]
update_subject(subject)[source]
class swap.utils.user.Users(config, items=None)[source]

Bases: swap.utils.collection.Collection

new(user)[source]

caesar_external.extractor

Get classifications from Panoptes

class caesar_external.extractor.Extractor[source]

Bases: object

classmethod get_classifications(last_id)[source]
classmethod last_id(next_id=None)[source]
classmethod next()[source]

caesar_external.reducer

Get classifications from Panoptes

caesar_external.data

Storage module to track which classification was gotten last

class caesar_external.data.Config(name, project, workflow, last_id, **kwargs)[source]

Bases: object

__init__(name, project, workflow, last_id, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

static caesar_endpoint()[source]
dump()[source]
classmethod instance()[source]
classmethod load(name)[source]
save()[source]
workflow_path()[source]

caesar_external.utils.caesar_utils

class caesar_external.utils.caesar_utils.Client[source]

Bases: object

__init__()[source]

Initialize self. See help(type(self)) for accurate signature.

classmethod extract(project, last_id)[source]
classmethod instance()[source]
classmethod reduce(subject, data)[source]

PUT subject score to Caesar