predict ¶
CLI module for model prediction on datasets.
Functions:
-
add_meta_info
–Add metadata columns to predictions/labels dictionary.
-
get_args
–Parse command line arguments.
-
get_batch_size
–Get batch size from model config.
-
get_meta_keys
–Extract metadata column keys.
-
load_model
–Load model with hyperparameters and weights.
-
main
–Run model prediction pipeline.
-
parse_y_keys
–Parse dictionary keys to match input data format.
-
run
–Execute model prediction pipeline.
add_meta_info ¶
Add metadata columns to predictions/labels dictionary.
Parameters:
-
data
(DataFrame
) –Input DataFrame with metadata.
-
y
(dict[str, Any]
) –Dictionary of predictions/labels.
Returns:
Source code in src/stimulus/cli/predict.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
|
get_args ¶
get_args() -> Namespace
Parse command line arguments.
Returns:
-
Namespace
–Parsed command line arguments.
Source code in src/stimulus/cli/predict.py
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 |
|
get_batch_size ¶
Get batch size from model config.
Parameters:
Returns:
-
int
–Batch size to use for predictions.
Source code in src/stimulus/cli/predict.py
68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
get_meta_keys ¶
Extract metadata column keys.
Parameters:
Returns:
Source code in src/stimulus/cli/predict.py
123 124 125 126 127 128 129 130 131 132 |
|
load_model ¶
Load model with hyperparameters and weights.
Parameters:
-
model_class
(Any
) –Model class to instantiate.
-
weight_path
(str
) –Path to model weights.
-
mconfig
(dict[str, Any]
) –Model configuration dictionary.
Returns:
-
Any
–Loaded model instance.
Source code in src/stimulus/cli/predict.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|
main ¶
main(
model_path: str,
weight_path: str,
mconfig_path: str,
econfig_path: str,
data_path: str,
output: str,
*,
return_labels: bool = False,
split: int | None = None
) -> None
Run model prediction pipeline.
Parameters:
-
model_path
(str
) –Path to model file.
-
weight_path
(str
) –Path to model weights.
-
mconfig_path
(str
) –Path to model config.
-
econfig_path
(str
) –Path to experiment config.
-
data_path
(str
) –Path to input data.
-
output
(str
) –Path for output predictions.
-
return_labels
(bool
, default:False
) –Whether to include labels.
-
split
(int | None
, default:None
) –Data split to use.
Source code in src/stimulus/cli/predict.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
|
parse_y_keys ¶
Parse dictionary keys to match input data format.
Parameters:
-
y
(dict[str, Any]
) –Dictionary of predictions or labels.
-
data
(DataFrame
) –Input DataFrame.
-
y_type
(str
, default:'pred'
) –Type of values ('pred' or 'label').
Returns:
Source code in src/stimulus/cli/predict.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
run ¶
run() -> None
Execute model prediction pipeline.
Source code in src/stimulus/cli/predict.py
191 192 193 194 195 196 197 198 199 200 201 202 203 |
|