Skip to content

BEyeLSTM

BeyeLSTM model arguments and parameters.

BEyeLSTMArgs dataclass

Bases: DLModelArgs

Model arguments for the BEyeLSTM model.

? update the docstring to include all parameters

Attributes: max_eye_len (int): The maximum sequence length for the eye input, in tokens. batch_size (int): Batch size for training. backbone (BackboneNames): Backbone model to use. use_fixation_report (bool): Whether to use fixation report. compute_trial_level_features (bool): Whether to compute trial-level features. fixation_features (list[str]): List of fixation features. eye_features (list[str]): List of eye features. word_features (list[str]): List of word features. ia_categorical_features (list[str]): List of categorical features for interest areas. num_pos (int): Number of positions. num_content (int): Number of content types. fixations_dim (int): Dimension of fixations. gsf_dim (int): Dimension of GSF.

Source code in src/configs/models/dl/BEyeLSTM.py
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
@register_model_config
@dataclass
class BEyeLSTMArgs(DLModelArgs):
    """
    Model arguments for the BEyeLSTM model.
    #? update the docstring to include all parameters
    Attributes:
        max_eye_len (int): The maximum sequence length for the eye input, in tokens.
        batch_size (int): Batch size for training.
        backbone (BackboneNames): Backbone model to use.
        use_fixation_report (bool): Whether to use fixation report.
        compute_trial_level_features (bool): Whether to compute trial-level features.
        fixation_features (list[str]): List of fixation features.
        eye_features (list[str]): List of eye features.
        word_features (list[str]): List of word features.
        ia_categorical_features (list[str]): List of categorical features for interest areas.
        num_pos (int): Number of positions.
        num_content (int): Number of content types.
        fixations_dim (int): Dimension of fixations.
        gsf_dim (int): Dimension of GSF.
    """

    max_supported_seq_len: int = 1_000_000
    base_model_name: DLModelNames = DLModelNames.BEYELSTM_MODEL
    batch_size: int = 64
    use_fixation_report: bool = True
    use_eyes_only: bool = True
    num_pos: int = 5
    num_content: int = 2
    fixations_dim: int = 4  #! Not a hyperparameter to play with
    """
    Originally:
    **35** binned values X (**13** reading features + **5** linguistic features) + **4** global features = **634**
    Ours:
    **44** binned values X (**11** reading features + **5** linguistic features) + **4** global features = **708**
    """
    gsf_dim: int = -1
    dropout_rate: float = 0.5  # Dropout rate of fc1 and fc2
    embedding_dim: int = (
        4  # The embedding dimension for categorical features (universal_pos, Content)
    )
    # The output dimensions for fc1,2 after each LSTM
    lstm_block_fc1_out_dim: int = 50  # originally: 50
    lstm_block_fc2_out_dim: int = 20  # originally: 20
    gsf_out_dim: int = 32  # originally: 32
    # The middle embedding size of the FC after the concat of all LSTM results and gsf (all separate layers, only the dim is shared)
    after_cat_fc_hidden_dim: int = 32
    hidden_dim: int = 64  # the hidden dim inside the LSTM. Originally: 25

    compute_trial_level_features: bool = True
    fixation_features: list[str] = field(
        default_factory=lambda: [
            'CURRENT_FIX_DURATION',
            'CURRENT_FIX_PUPIL',
            'CURRENT_FIX_X',
            'CURRENT_FIX_Y',
            'NEXT_FIX_INTEREST_AREA_INDEX',
            'CURRENT_FIX_INTEREST_AREA_INDEX',
            'LengthCategory',
            'is_reg_sum',
            'is_progressive_sum',
            'IA_REGRESSION_IN_COUNT_sum',
            'normalized_outgoing_regression_count',
            'normalized_outgoing_progressive_count',
            'normalized_incoming_regression_count',
        ]
    )
    eye_features: list[str] = field(
        default_factory=lambda: [
            'TRIAL_IA_COUNT',
            'IA_REGRESSION_OUT_FULL_COUNT',
            'IA_FIXATION_COUNT',
            'IA_REGRESSION_IN_COUNT',
            'IA_FIRST_FIXATION_DURATION',
            'IA_DWELL_TIME',
        ]
    )

    word_features: list[str] = field(
        default_factory=lambda: [
            'is_content_word',
            'ptb_pos',
            'left_dependents_count',
            'right_dependents_count',
            'distance_to_head',
            'head_direction',
            'gpt2_surprisal',
            'wordfreq_frequency',
            'word_length',
            # 'entity_type',
            'universal_pos',
        ]
    )

    ia_categorical_features: list[str] = field(
        default_factory=lambda: [
            'is_content_word',
            'ptb_pos',
            # 'entity_type',
            'universal_pos',
            'Head_Direction',
            'head_direction',
            'TRIAL_IA_COUNT',
            'LengthCategory',
            'IA_REGRESSION_OUT_FULL_COUNT',
            'IA_FIXATION_COUNT',
            'IA_REGRESSION_IN_COUNT',
        ]
    )

    item_level_features_modes: list[ItemLevelFeaturesModes] = field(
        default_factory=lambda: [ItemLevelFeaturesModes.BEYELSTM]
    )
    max_epochs: int = 1000
    early_stopping_patience: int = 50

fixations_dim = 4 class-attribute instance-attribute

Originally: 35 binned values X (13 reading features + 5 linguistic features) + 4 global features = 634 Ours: 44 binned values X (11 reading features + 5 linguistic features) + 4 global features = 708