File size: 2,554 Bytes
132149b | 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 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 | """
Argument Parser for Drug Repositioning Module
This module defines command-line arguments for configuring the drug-disease association prediction
training process. The arguments include general settings, training parameters, and model hyperparameters.
"""
import argparse
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter
)
# General arguments
parser.add_argument(
"-id",
"--device_id",
default=None,
type=str,
help="Device ID for GPU usage. If not provided, CPU is used.",
)
parser.add_argument(
"-da",
"--dataset",
type=str,
choices=["Bdataset", "Kdataset", "KGdataset", "KGdataset_tiny"],
required=True,
help="Dataset identifier for training. Options: 'Bdataset', 'Kdataset', 'KGdataset', or 'KGdataset_tiny'.",
)
parser.add_argument(
"-sp",
"--saved_path",
type=str,
default="result",
help="Directory path to save training results.",
)
parser.add_argument(
"-se",
"--seed",
default=42,
type=int,
help="Global random seed for reproducibility.",
)
# Training arguments
parser.add_argument(
"-fo",
"--nfold",
default=10,
type=int,
help="Number of folds for K-fold cross-validation.",
)
parser.add_argument(
"-ep",
"--epoch",
default=1000,
type=int,
help="Number of epochs for model training.",
)
parser.add_argument(
"-lr",
"--learning_rate",
default=0.005,
type=float,
help="Learning rate for the optimizer.",
)
parser.add_argument(
"-wd",
"--weight_decay",
default=0.0,
type=float,
help="Weight decay (L2 regularization) for the optimizer.",
)
parser.add_argument(
"-pa",
"--patience",
default=100,
type=int,
help="Number of epochs with no improvement after which training will be stopped (early stopping).",
)
# Model hyperparameters
parser.add_argument(
"-hf",
"--hidden_feats",
default=64,
type=int,
help="Dimension of hidden layers in the model.",
)
parser.add_argument(
"-he",
"--num_heads",
default=5,
type=int,
help="Number of attention heads in the model.",
)
parser.add_argument(
"-dp",
"--dropout",
default=0.0,
type=float,
help="Dropout rate to be applied in the model.",
)
# Parse the arguments and modify saved_path to include the seed for reproducibility
args = parser.parse_args()
args.saved_path = f"{args.saved_path}_{args.seed}"
|