tirank.Model.initial_model_para
- tirank.Model.initial_model_para(savePath, nhead=2, nhid1=96, nhid2=8, n_output=32, nlayers=3, n_pred=1, dropout=0.5, mode='Cox', infer_mode='SC', encoder_type='MLP')[source]
Initializes and saves the model hyperparameter configuration.
This function reads the input data dimensions (e.g., number of gene pairs) and spatial cluster dimensions, combines them with the user-defined hyperparameters, and saves the complete configuration as ‘model_para.pkl’.
- Parameters:
savePath (str) – The main project directory path.
nhead (int, optional) – Number of heads for Transformer encoder. Defaults to 2.
nhid1 (int, optional) – Hidden dimension for the encoder. Defaults to 96.
nhid2 (int, optional) – Hidden dimension for the predictor heads. Defaults to 8.
n_output (int, optional) – Output dimension of the encoder (embedding size). Defaults to 32.
nlayers (int, optional) – Number of layers in the encoder. Defaults to 3.
n_pred (int, optional) – Output dimension of the predictor (e.g., 1 for Cox/Regression, 2 for binary Classification). Defaults to 1.
dropout (float, optional) – Dropout rate. Defaults to 0.5.
mode (str, optional) – Analysis mode (‘Cox’, ‘Classification’, ‘Regression’). Defaults to “Cox”.
infer_mode (str, optional) – Inference data type (‘SC’ or ‘ST’). Defaults to “SC”.
encoder_type (str, optional) – Type of encoder to use (‘MLP’, ‘Transformer’, ‘DenseNet’). Defaults to “MLP”.
- Returns:
None