octopus.study
Study module.
OctoClassification
Bases: OctoStudy
Classification study (binary and multiclass).
Source code in octopus/study/core.py
ml_type = field(default=None, kw_only=True, validator=(validators.optional(validators.in_([MLType.BINARY, MLType.MULTICLASS]))))
class-attribute
instance-attribute
The type of machine learning model. Can be set explicitly or auto-detected from data (binary vs multiclass).
positive_class = field(default=None, validator=(validators.optional(validators.instance_of(int))))
class-attribute
instance-attribute
The positive class label for binary classification. Defaults to None. Not used for multiclass.
target_assignments
property
Get target assignments dict.
target_col = field(kw_only=True, validator=(validators.instance_of(str)))
class-attribute
instance-attribute
The target column to predict.
target_metric = field(default='AUCROC', validator=(validators.in_(Metrics.get_by_type(MLType.BINARY, MLType.MULTICLASS))))
class-attribute
instance-attribute
The primary metric used for model evaluation. Defaults to AUCROC.
OctoRegression
Bases: OctoStudy
Regression study.
Source code in octopus/study/core.py
ml_type = field(default=(MLType.REGRESSION), init=False)
class-attribute
instance-attribute
The type of machine learning model. Automatically set to regression.
target_assignments
property
Get target assignments dict.
target_col = field(kw_only=True, validator=(validators.instance_of(str)))
class-attribute
instance-attribute
The target column to predict.
target_metric = field(default='RMSE', validator=(validators.in_(Metrics.get_by_type(MLType.REGRESSION))))
class-attribute
instance-attribute
The primary metric used for model evaluation. Defaults to RMSE.
OctoStudy
Bases: ABC
Abstract base class for all Octopus studies.
Source code in octopus/study/core.py
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 130 131 132 133 134 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 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | |
datasplit_seed_outer = field(default=0, validator=[validators.instance_of(int)])
class-attribute
instance-attribute
The seed used for data splitting in outer cross-validation. Defaults to 0.
feature_cols = field(validator=[validators.instance_of(list)])
class-attribute
instance-attribute
List of all feature columns in the dataset.
ignore_data_health_warning = field(default=(Factory(lambda: False)), validator=[validators.instance_of(bool)])
class-attribute
instance-attribute
Ignore data health checks warning and run machine learning workflow.
log_dir
property
Directory where logs are stored.
ml_type = field(init=False)
class-attribute
instance-attribute
The type of machine learning model. Set automatically by subclass.
n_folds_outer = field(default=(5 if not _RUNNING_IN_TESTSUITE else 2), validator=[validators.instance_of(int)])
class-attribute
instance-attribute
The number of outer folds for cross-validation. Defaults to 5.
name = field(default='Octopus', validator=[validators.instance_of(str)])
class-attribute
instance-attribute
The name of the study. Defaults to 'Octopus'.
outer_parallelization = field(default=(Factory(lambda: True)), validator=[validators.instance_of(bool)])
class-attribute
instance-attribute
Indicates whether outer parallelization is enabled. Defaults to True.
output_path
property
Full output path for this study (path/name-timestamp).
path = field(default=(UPath('./studies/')), converter=(lambda x: UPath(x)))
class-attribute
instance-attribute
The path where study outputs are saved. Defaults to "./studies/".
row_id_col = field(default=(Factory(lambda: None)), validator=(validators.optional(validators.instance_of(str))))
class-attribute
instance-attribute
Unique row identifier.
run_single_outersplit_num = field(default=(Factory(lambda: -1)), validator=[validators.instance_of(int)])
class-attribute
instance-attribute
Select a single outersplit to execute. Defaults to -1 to run all outersplits
sample_id_col = field(validator=(validators.instance_of(str)))
class-attribute
instance-attribute
Identifier for sample instances.
stratification_col = field(default=(Factory(lambda: None)), validator=(validators.optional(validators.instance_of(str))))
class-attribute
instance-attribute
Column used for stratification during data splitting.
target_assignments
abstractmethod
property
Get target assignments dict. Must be implemented in subclasses.
target_metric
abstractmethod
property
Get target metric. Must be implemented in subclasses.
workflow = field(default=(Factory(lambda: [Octo(task_id=0)])), validator=[validators.instance_of(list), validate_workflow])
class-attribute
instance-attribute
A list of tasks that defines the processing workflow. Each item in the list is an instance of Task.
fit(data, health_check_config=None)
Fit study to data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataFrame
|
DataFrame containing the dataset. |
required |
health_check_config
|
HealthCheckConfig | None
|
Optional configuration for health check thresholds. |
None
|
Source code in octopus/study/core.py
OctoTimeToEvent
Bases: OctoStudy
Time-to-event study.
Source code in octopus/study/core.py
duration_col = field(kw_only=True, validator=(validators.instance_of(str)))
class-attribute
instance-attribute
Column containing time until event or censoring.
event_col = field(kw_only=True, validator=(validators.instance_of(str)))
class-attribute
instance-attribute
Column containing event indicator (0=censored, 1=event).
ml_type = field(default=(MLType.TIMETOEVENT), init=False)
class-attribute
instance-attribute
The type of machine learning model. Automatically set to time-to-event.
target_assignments
property
Get target assignments dict.
target_metric = field(default='CI', validator=(validators.in_(Metrics.get_by_type(MLType.TIMETOEVENT))))
class-attribute
instance-attribute
The primary metric used for model evaluation. Defaults to CI (Concordance Index).