Browse Source

feat: stable

main
Taha Mohammadzadeh 5 months ago
parent
commit
10e538a00f
4 changed files with 8 additions and 12 deletions
  1. 0
    3
      data_loader.py
  2. 5
    6
      evaluation.py
  3. 2
    2
      main.py
  4. 1
    1
      utils.py

+ 0
- 3
data_loader.py View File

@@ -137,9 +137,6 @@ class RawDataLoader:

df = (df - df.min()) / (df.max() - df.min())
df = df.fillna(0)

print("has null:")
print(df.isnull().sum().sum())
if intersect:
if file.startswith('cell'):
if cell_line_names:

+ 5
- 6
evaluation.py View File

@@ -72,11 +72,11 @@ class Evaluation:

# Step 2: Calculate and print AUC
fpr, tpr, thresholds = metrics.roc_curve(all_targets, mlp_output)
auc = np.round(metrics.auc(fpr, tpr), 3)
auc = np.round(metrics.auc(fpr, tpr), 4)

# Step 3: Calculate and print AUPRC
precision, recall, thresholds = metrics.precision_recall_curve(all_targets, mlp_output)
auprc = np.round(metrics.auc(recall, precision), 3)
auprc = np.round(metrics.auc(recall, precision), 4)

# Step 4: Print accuracy, AUC, AUPRC, and confusion matrix
accuracy = accuracy_score(all_targets, all_predictions)
@@ -84,11 +84,10 @@ class Evaluation:
precision = cm[0, 0] / (cm[0, 0] + cm[0, 1])
recall = cm[0, 0] / (cm[0, 0] + cm[1, 0])
f1_score = 2 * precision * recall / (precision + recall)
print(f'Accuracy: {accuracy:.2f}')
print(f'AUC: {auc:.2f}')
print(f'AUPRC: {auprc:.2f}')

print(f'Confusion matrix:\n{cm}')
print(f'Precision: {precision:.3f}, Recall: {recall:.3f}, F1 score: {f1_score:.3f}')
print(
f'Accuracy: {accuracy:.3f}, Precision: {precision:.3f}, Recall: {recall:.3f}, F1 score: {f1_score:.3f}, AUC: {auc:.3f}, ,AUPRC: {auprc:.3f}')

# Step 5: Display ROC and PR curves if requested
if show_plot:

+ 2
- 2
main.py View File

@@ -161,8 +161,8 @@ def run(k, is_test=False ):

# Step 2: Load training data
train_data, train_drug_screen = RawDataLoader.load_data(data_modalities=DATA_MODALITIES,
raw_file_directory=GDSC_RAW_DATA_FOLDER,
screen_file_directory=GDSC_SCREENING_DATA_FOLDER,
raw_file_directory=RAW_BOTH_DATA_FOLDER,
screen_file_directory=BOTH_SCREENING_DATA_FOLDER,
sep="\t")



+ 1
- 1
utils.py View File

@@ -31,7 +31,7 @@ SIM_KERNEL = {'cell_CN': ('euclidean', 0.001), 'cell_exp': ('euclidean', 0.01),
SAVE_MODEL = False # Change it to True to save the trained model
VARIATIONAL_AUTOENCODERS = False
# DATA_MODALITIES=['cell_CN','cell_exp','cell_methy','cell_mut','drug_comp','drug_DT'] # Change this list to only consider specific data modalities
DATA_MODALITIES = ['cell_exp', 'drug_desc']
DATA_MODALITIES = ['cell_CN','cell_exp','cell_mut', 'drug_desc','drug_finger']
RANDOM_SEED = 42 # Must be used wherever can be used



Loading…
Cancel
Save