Browse Source

feat: stable

main
Taha Mohammadzadeh 11 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



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

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

+ 5
- 6
evaluation.py View File



# Step 2: Calculate and print AUC # Step 2: Calculate and print AUC
fpr, tpr, thresholds = metrics.roc_curve(all_targets, mlp_output) 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 # Step 3: Calculate and print AUPRC
precision, recall, thresholds = metrics.precision_recall_curve(all_targets, mlp_output) 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 # Step 4: Print accuracy, AUC, AUPRC, and confusion matrix
accuracy = accuracy_score(all_targets, all_predictions) accuracy = accuracy_score(all_targets, all_predictions)
precision = cm[0, 0] / (cm[0, 0] + cm[0, 1]) precision = cm[0, 0] / (cm[0, 0] + cm[0, 1])
recall = cm[0, 0] / (cm[0, 0] + cm[1, 0]) recall = cm[0, 0] / (cm[0, 0] + cm[1, 0])
f1_score = 2 * precision * recall / (precision + recall) 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'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 # Step 5: Display ROC and PR curves if requested
if show_plot: if show_plot:

+ 2
- 2
main.py View File



# Step 2: Load training data # Step 2: Load training data
train_data, train_drug_screen = RawDataLoader.load_data(data_modalities=DATA_MODALITIES, 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") sep="\t")





+ 1
- 1
utils.py View File

SAVE_MODEL = False # Change it to True to save the trained model SAVE_MODEL = False # Change it to True to save the trained model
VARIATIONAL_AUTOENCODERS = False 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_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 RANDOM_SEED = 42 # Must be used wherever can be used





Loading…
Cancel
Save