schemas#
This module contains classes to handle the Galaxy Zoo decision tree - Schema, Question, and Answer - and functions to help link them. This is crucial for both calculating the custom loss and analysing the predictions in practice.
See Training on Vote Counts for full explanation.
Instantiate the Answer classes for a given
Question
. Each answer includes the answer text (often used as a column header), the corresponding question, and its index inlabel_cols
(often used for slicing model outputs)- Parameters
question (Question) – question to which to create answers e.g. Question(smooth-or-featured)
answers_texts (List) – answer strings e.g. [‘smooth-or-featured_smooth’, ‘smooth-or-featured_featured-or-disk’]
label_cols (List) – list of all questions and answers e.g. [‘smooth-or-featured_smooth’, ‘smooth-or-featured_featured-or-disk’, …]
- Returns
of Answers to that question e.g. [Answer(smooth-or-featured_smooth), Answer(smooth-or-featured_featured-or-disk)]
- Return type
List
Link each answer to question which follows, and vica versa. Acts inplace.
Specifically, for every answer in every question, set answer._next question to refer to the Question which follows that answer. Then for that Question, set question._asked_after to that answer.
- Parameters
questions (List) – of questions e.g. [Question(‘smooth-or-featured’), Question(‘edge-on-disk’)]
dependencies (dict) – dict mapping each question (e.g. disk-edge-on) to the answer on which it depends (e.g. smooth-or-featured_featured-or-disk)