pyanno4rt.optimization.components._machine_learning_component_class
Machine learning component template.
Overview
Machine learning component template class. |
Classes
- class pyanno4rt.optimization.components._machine_learning_component_class.MachineLearningComponentClass(name, parameter_name, parameter_category, model_parameters, embedding, weight, rank, bounds, link, identifier, display)[source]
Machine learning component template class.
- Parameters:
name (str) – Name of the component class.
parameter_name (tuple) – Name of the component parameters.
parameter_category (tuple) – Category of the component parameters.
model_parameters (dict) –
Dictionary with the data handling & learning model parameters:
- model_labelstr
Label for the machine learning model.
- model_folder_pathNone or str, default=None
Path to a folder for loading an external machine learning model.
- data_pathstr
Path to the data set used for fitting the machine learning model.
- feature_filterdict, default={‘features’: [], ‘filter_mode’: ‘remove’}
Dictionary with a list of feature names and a value from {‘retain’, ‘remove’} as an indicator for retaining/removing the features prior to model fitting.
- label_namestr
Name of the label variable.
- label_boundslist, default=[1, 1]
Bounds for the label values to binarize into positive (value lies inside the bounds) and negative class (value lies outside the bounds).
- time_variable_nameNone or str, default=None
Name of the time-after-radiotherapy variable (unit should be days).
- label_viewpoint{‘early’, ‘late’, ‘long-term’, ‘longitudinal’, ‘profile’}, default=’longitudinal’
Time of observation for the presence of tumor control and/or normal tissue complication events. The options can be described as follows:
’early’ : event between 0 and 6 months after treatment
’late’ : event between 6 and 15 months after treatment
’long-term’ : event between 15 and 24 months after treatment
’longitudinal’ : no period, time after treatment as covariate
’profile’ : TCP/NTCP profiling over time, multi-label scenario with one label per month (up to 24 labels in total).
- fuzzy_matchingbool, default=True
Indicator for the use of fuzzy string matching to generate the feature map (if False, exact string matching is applied).
- preprocessing_stepslist, default=[‘Identity’]
Sequence of labels associated with preprocessing algorithms to preprocess the input features.
The following preprocessing steps are currently available:
’Identity’
Identity’StandardScaler’
StandardScaler’Whitening’
Whitening
- architecture{‘input-convex’, ‘standard’}, default=’input-convex’
Type of architecture for the neural network model.
- max_hidden_layersint, default=2
Maximum number of hidden layers for the neural network model.
- tune_spacedict, default={}
Search space for the Bayesian hyperparameter optimization.
- tune_evaluationsint, default=50
Number of evaluation steps (trials) for the Bayesian hyperparameter optimization.
- tune_score{‘AUC’, ‘Brier score’, ‘Logloss’}, default=’Logloss’
Scoring function for the evaluation of the hyperparameter set candidates.
- tune_splitsint, default=5
Number of splits for the stratified cross-validation within each hyperparameter optimization step.
- inspect_modelbool, default=False
Indicator for the inspection of the machine learning model.
- evaluate_modelbool, default=False
Indicator for the evaluation of the machine learning model.
- oof_splitsint, default=5
Number of splits for the stratified cross-validation within the out-of-folds evaluation step.
- write_featuresbool, default=True
Indicator for writing the iteratively calculated feature vectors into a feature history.
- display_optionsdict, default={‘graphs’: [‘AUC-ROC’, ‘AUC-PR’, ‘F1’], ‘kpis’: [‘Logloss’, ‘Brier score’, ‘Subset accuracy’, ‘Cohen Kappa’, ‘Hamming loss’, ‘Jaccard score’, ‘Precision’, ‘Recall’, ‘F1 score’, ‘MCC’, ‘AUC’]}
Dictionary with the graph and KPI display options.
embedding ({'active', 'passive'}) – Mode of embedding for the component. In ‘passive’ mode, the component value is computed and tracked, but not considered in the optimization problem, unlike in ‘active’ mode.
weight (int or float) – Weight of the component function.
rank (int, default=1) – Rank of the component in the lexicographic order.
bounds (None or list) – Constraint bounds for the component.
link (None or list) – Other segments used for joint evaluation.
identifier (None or str) – Additional string for naming the component.
display (bool) – Indicator for the display of the component.
- name
See ‘Parameters’.
- Type:
str
- parameter_name
See ‘Parameters’.
- Type:
tuple
- parameter_category
See ‘Parameters’.
- Type:
tuple
- parameter_value
Value of the component parameters.
- Type:
list
- embedding
See ‘Parameters’.
- Type:
{‘active’, ‘passive’}
- weight
See ‘Parameters’.
- Type:
float
- rank
See ‘Parameters’.
- Type:
int
- bounds
See ‘Parameters’.
- Type:
list
- link
See ‘Parameters’.
- Type:
list
- identifier
See ‘Parameters’.
- Type:
None or str
- display
See ‘Parameters’.
- Type:
bool
- model_parameters
See ‘Parameters’.
- Type:
dict
- data_model_handler
Initial variable for the object used to handle the dataset, the feature map generation and the feature (re-)calculation.
- Type:
None
- model
Initial variable for the object used to preprocess, tune, train, inspect and evaluate the machine learning model.
- Type:
None
- adjusted_parameters
Indicator for the adjustment of the parameters due to fractionation.
- Type:
bool
- RETURNS_OUTCOME
Indicator for the outcome focus of the component.
- Type:
bool
- DEPENDS_ON_MODEL
Indicator for the model dependency of the component.
- Type:
bool
Overview
Methods Get the value of the parameters.
set_parameter_value(*args)Set the value of the parameters.
Get the value of the weight.
set_weight_value(*args)Set the value of the weight.
abc Add the machine learning model to the component.
compute_value(*args)abc Compute the component value.
compute_gradient(*args)abc Compute the component gradient.
Members
- get_parameter_value()[source]
Get the value of the parameters.
- Returns:
Value of the parameters.
- Return type:
list
- set_parameter_value(*args)[source]
Set the value of the parameters.
- Parameters:
*args (tuple) – Keyworded parameters. args[0] should give the value to be set.
- get_weight_value()[source]
Get the value of the weight.
- Returns:
Value of the weight.
- Return type:
float