Example #1
0
        else:
            to_remove.append(index)

mrna_dataset["beta"] = mrna_dataset["beta"].drop(to_remove)
mrna_dataset["pheno"] = mrna_dataset["pheno"].drop(to_remove)

# Classification with ML and DL models
params = {
    "input_shape": mrna_dataset["beta"].shape[1],
    "model_serialization_path": "../data/models/classifier/",
    "dropout_rate": 0.3,
    "output_shape": len(mrna_dataset["pheno"]["subtype"].unique())
}
val_res, test_res = methylation_array_kcv(
    mrna_dataset,
    NeuralClassifier,
    params,
    "subtype",
    callbacks=[EarlyStopping(monitor="val_loss", min_delta=0.05, patience=10)])

print("Validation accuracy: {} - Test accuracy: {}".format(val_res, test_res))
svm_val, svm_test = benchmark_svm(mrna_dataset, "subtype")
print("SVM validation accuracy: {} - SVM test accuracy: {}".format(
    svm_val, svm_test))
knn_val, knn_test = benchmark_knn(mrna_dataset, "subtype")
print("KNN validation accuracy: {} - KNN test accuracy: {}".format(
    knn_val, knn_test))
rf_val, rf_test = benchmark_rf(mrna_dataset, "subtype")
print("RF validation accuracy: {} - RF test accuracy: {}".format(
    rf_val, rf_test))

with open(logfile_name, 'a') as logfile:
        else:
            to_remove.append(index)

cnv_dataset["beta"] = cnv_dataset["beta"].drop(to_remove)
cnv_dataset["pheno"] = cnv_dataset["pheno"].drop(to_remove)

# Classification with ML and DL models
params = {
    "input_shape": cnv_dataset["beta"].shape[1],
    "model_serialization_path": "../data/models/classifier/",
    "dropout_rate": 0.3,
    "output_shape": len(cnv_dataset["pheno"]["subtype"].unique())
}
val_res, test_res = methylation_array_kcv(
    cnv_dataset,
    Daneel,
    params,
    "subtype",
    callbacks=[EarlyStopping(monitor="val_loss", min_delta=0.05, patience=10)])

print("Validation accuracy: {} - Test accuracy: {}".format(val_res, test_res))
svm_val, svm_test = benchmark_svm(cnv_dataset, "subtype")
print("SVM validation accuracy: {} - SVM test accuracy: {}".format(
    svm_val, svm_test))
knn_val, knn_test = benchmark_knn(cnv_dataset, "subtype")
print("KNN validation accuracy: {} - KNN test accuracy: {}".format(
    knn_val, knn_test))
rf_val, rf_test = benchmark_rf(cnv_dataset, "subtype")
print("RF validation accuracy: {} - RF test accuracy: {}".format(
    rf_val, rf_test))

with open(logfile_name, 'a') as logfile: