model_based_ligand_activity_prediction: Prediction of ligand activity prediction by a model trained...

View source: R/evaluate_model_ligand_prediction.R

model_based_ligand_activity_predictionR Documentation

Prediction of ligand activity prediction by a model trained on ligand importance scores.

Description

model_based_ligand_activity_prediction Predict the activity state of a ligand based on a classification model that was trained to predict ligand activity state based on ligand importance scores.

Usage

model_based_ligand_activity_prediction(importances, model, normalization)

Arguments

importances

A data frame containing at least folowing variables: $setting, $test_ligand, $ligand and one or more feature importance scores. $test_ligand denotes the name of a possibly active ligand, $ligand the name of the truely active ligand.

model

A model object of a classification object as e.g. generated via caret.

normalization

Way of normalization of the importance measures: "mean" (classifcal z-score) or "median" (modified z-score)

Value

A data frame containing the ligand importance scores and the probabilities that according to the trained model, the ligands are active based on their importance scores.

Examples

## Not run: 
settings = lapply(expression_settings_validation[1:5],convert_expression_settings_evaluation)
settings_ligand_pred = convert_settings_ligand_prediction(settings, all_ligands = unlist(extract_ligands_from_settings(settings,combination = FALSE)), validation = TRUE, single = TRUE)

weighted_networks = construct_weighted_networks(lr_network, sig_network, gr_network, source_weights_df)
ligands = extract_ligands_from_settings(settings_ligand_pred,combination = FALSE)
ligand_target_matrix = construct_ligand_target_matrix(weighted_networks, ligands)
ligand_importances = dplyr::bind_rows(lapply(settings_ligand_pred,get_single_ligand_importances,ligand_target_matrix))
evaluation = evaluate_importances_ligand_prediction(ligand_importances,"median","lda")

settings = lapply(expression_settings_validation[5:10],convert_expression_settings_evaluation)
settings_ligand_pred = convert_settings_ligand_prediction(settings, all_ligands = unlist(extract_ligands_from_settings(settings,combination = FALSE)), validation = FALSE, single = TRUE)
ligands = extract_ligands_from_settings(settings_ligand_pred,combination = FALSE)
ligand_target_matrix = construct_ligand_target_matrix(weighted_networks, ligands)
ligand_importances = dplyr::bind_rows(lapply(settings_ligand_pred,get_single_ligand_importances,ligand_target_matrix, known = FALSE))
activity_predictions = model_based_ligand_activity_prediction(ligand_importances, evaluation$model,"median")
print(head(activity_predictions))

## End(Not run)


saeyslab/nichenetr documentation built on March 26, 2024, 9:22 a.m.