aind_behavior_curriculum.trainer.TrainerServer

class aind_behavior_curriculum.trainer.TrainerServer[source]

Bases: object

Pulls subject curriculum and history and performs evaluation.

Intended usage: 1) Implement abstract methods 2) Call Trainer.register_subject() x N 3) Call Trainer.evaluate_subject() or Trainer.override_subject_status() x N

__init__()[source]

Trainer manages a list of subjects initialized here. NOTE: Within Trainer subclass, please call super().__init__()

Methods

__init__()

Trainer manages a list of subjects initialized here.

eject_subject(s_id)

Send mouse off curriculum.

evaluate_subjects()

Calls user-defined functions to automatically update subject stage along curriculum.

load_data(subject_id)

User-defined.

override_subject_status(s_id, ...)

Override subject (stage, policies) independent of evaluation.

register_subject(subject_id, curriculum, ...)

Adds subject into the Trainer system.

write_data(subject_id, curriculum, trainer_state)

User-defined.

eject_subject(s_id: int) None[source]

Send mouse off curriculum. Only way to get mouse back into system is with Trainer.override_subject_status(…)

evaluate_subjects() None[source]

Calls user-defined functions to automatically update subject stage along curriculum. The time-step between evaluate_subject calls is flexible– this function will skip subject to the latest stage/policy they are applicable for.

Evaluation checks for stage transitions before policy transitions.

If subject does not satisfy any transition criteria, this method creates a duplicate current (stage, policy) entry in stage history.

abstract load_data(subject_id: int) tuple[Curriculum, TrainerState, Metrics][source]

User-defined. Loads 3 pieces of data in the following format: - subject Curriculum - subject Trainer State - subject Metrics

override_subject_status(s_id: int, override_stage: Stage, override_policies: Policy | list[Policy]) None[source]

Override subject (stage, policies) independent of evaluation. Stage and Policy objects may be accessed by calling Trainer.load_data and looking inside of the returned Curriculum.

(Soft Rejection– send mouse to Stage/Policy w/in Curriculum)

register_subject(subject_id: int, curriculum: Curriculum, start_stage: Stage, start_policies: Policy | List[Policy] | None = None) None[source]

Adds subject into the Trainer system. If start_policies is None, registration defaults to the Stage.start_policies.

abstract write_data(subject_id: int, curriculum: Curriculum, trainer_state: TrainerState) None[source]

User-defined. Exports 3 pieces of data to database. - subject Id - subject Curriculum - subject Trainer State