Skip to content

variable

DV dataclass

Bases: Variable

Dependent variable.

Source code in autora/variable/__init__.py
41
42
43
44
45
46
@dataclass
class DV(Variable):
    """Dependent variable."""

    name: str = "DV"
    variable_label: str = "Dependent Variable"

IV dataclass

Bases: Variable

Independent variable.

Source code in autora/variable/__init__.py
33
34
35
36
37
38
@dataclass
class IV(Variable):
    """Independent variable."""

    name: str = "IV"
    variable_label: str = "Independent Variable"

IVTrial dataclass

Bases: IV

Experiment trial as independent variable.

Source code in autora/variable/__init__.py
58
59
60
61
62
63
64
65
66
67
68
69
70
@dataclass
class IVTrial(IV):
    """
    Experiment trial as independent variable.
    """

    name: str = "trial"
    UID: str = ""
    variable_label: str = "Trial"
    units: str = "trials"
    priority: int = 0
    value_range: Tuple[Any, Any] = (0, 10000000)
    value: float = 0

ValueType

Bases: str, Enum

Specifies supported value types supported by Variables.

Source code in autora/variable/__init__.py
 6
 7
 8
 9
10
11
12
13
14
15
16
class ValueType(str, Enum):
    """Specifies supported value types supported by Variables."""

    REAL = "real"
    SIGMOID = "sigmoid"
    PROBABILITY = "probability"  # single probability
    PROBABILITY_SAMPLE = "probability_sample"  # sample from single probability
    PROBABILITY_DISTRIBUTION = (
        "probability_distribution"  # probability distribution over classes
    )
    CLASS = "class"  # sample from probability distribution over classes

Variable dataclass

Describes an experimental variable: name, type, range, units, and value of a variable.

Source code in autora/variable/__init__.py
19
20
21
22
23
24
25
26
27
28
29
30
@dataclass
class Variable:
    """Describes an experimental variable: name, type, range, units, and value of a variable."""

    name: str = ""
    value_range: Optional[Tuple[Any, Any]] = (0, 1)
    allowed_values: Optional[Sequence] = None
    units: str = ""
    type: ValueType = ValueType.REAL
    variable_label: str = ""
    rescale: float = 1
    is_covariate: bool = False

VariableCollection dataclass

Immutable metadata about dependent / independent variables and covariates.

Source code in autora/variable/__init__.py
49
50
51
52
53
54
55
@dataclass(frozen=True)
class VariableCollection:
    """Immutable metadata about dependent / independent variables and covariates."""

    independent_variables: Sequence[Variable] = field(default_factory=list)
    dependent_variables: Sequence[Variable] = field(default_factory=list)
    covariates: Sequence[Variable] = field(default_factory=list)