File size: 2,625 Bytes
1206896 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 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 |
"""Sybil model configuration"""
from transformers import PretrainedConfig
from typing import Optional, List, Dict
import json
class SybilConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`SybilForRiskPrediction`].
It is used to instantiate a Sybil model according to the specified arguments, defining the model architecture.
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs.
Args:
hidden_dim (`int`, *optional*, defaults to 512):
Dimensionality of the hidden representations.
dropout (`float`, *optional*, defaults to 0.0):
The dropout probability for all fully connected layers.
max_followup (`int`, *optional*, defaults to 6):
Maximum number of years for risk prediction.
num_images (`int`, *optional*, defaults to 208):
Number of CT scan slices to process.
img_size (`List[int]`, *optional*, defaults to `[512, 512]`):
Size of input images after preprocessing.
voxel_spacing (`List[float]`, *optional*, defaults to `[0.703125, 0.703125, 2.5]`):
Target voxel spacing for CT scans (row, column, slice thickness).
censoring_distribution (`str`, *optional*, defaults to "weibull"):
Distribution used for censoring in survival analysis.
ensemble_size (`int`, *optional*, defaults to 5):
Number of models in the ensemble.
calibrator_data (`Dict`, *optional*):
Calibration data for risk score adjustment.
"""
model_type = "sybil"
def __init__(
self,
hidden_dim: int = 512,
dropout: float = 0.0,
max_followup: int = 6,
num_images: int = 208,
img_size: List[int] = None,
voxel_spacing: List[float] = None,
censoring_distribution: str = "weibull",
ensemble_size: int = 5,
calibrator_data: Optional[Dict] = None,
initializer_range: float = 0.02,
**kwargs
):
super().__init__(**kwargs)
self.hidden_dim = hidden_dim
self.dropout = dropout
self.max_followup = max_followup
self.num_images = num_images
self.img_size = img_size if img_size is not None else [512, 512]
self.voxel_spacing = voxel_spacing if voxel_spacing is not None else [0.703125, 0.703125, 2.5]
self.censoring_distribution = censoring_distribution
self.ensemble_size = ensemble_size
self.calibrator_data = calibrator_data
self.initializer_range = initializer_range |