Example #1
0
def run_neural_network_using_cross_validation(
        data,
        data_with_features_with_dict,
        k_fold,
        split_by_node,
        show_only_average_result=False,
        save_report_performance=None,
        report_performance_file_path=None,
        task=None,
        splitted_edges_dir=None):
    if task == 'link_prediction':
        # splitted_edges_dir = r'C:\Users\Anak\PycharmProjects\recreate_gene_disease\Data\processed\LinkPrediction\GeneDiseaseProject\copd\PhenotypeGeneDisease\PGDP\Node2Vec\UnweightedEdges\NoAddedEdges\\'
        # if not split_by_node:
        #     splitted_edges_dir = splitted_edges_dir + f'SplitByEdge\\'
        # else:
        #     splitted_edges_dir = splitted_edges_dir + f'SplitByNode\\'
        splitted_edges_file_path = splitted_edges_dir + f'\KFold={k_fold}\\splitted_edges.bin'

        # TODO code below run_clf_using_cross_validation has been moved to cross_validation()
        run_clf_using_cross_validation(
            data,
            data_with_features_with_dict,
            k_fold,
            # show_only_average_result=show_only_average_result,
            show_only_average_result=False,
            save_report_performance=save_report_performance,
            report_performance_file_path=report_performance_file_path,
            run_clf_for_each_fold=run_neural_network_for_each_fold,
            task=task,
            edges_as_data=True,
            splitted_edges_dir=splitted_edges_dir,
            split_by_node=split_by_node)
    else:
        raise ValueError('NN is only implemented for link_prediction')
Example #2
0
def run_lr_using_cross_validation(data,
                                  data_with_features,
                                  k_fold,
                                  show_only_average_result=False,
                                  save_report_performance=None,
                                  report_performance_file_path=None,
                                  task=None,
                                  split_by_node=None):
    """

    @param X: numpy
    @param y: numpy
    @return:
    """

    # TODO code below run_clf_using_cross_validation has been moved to cross_validation()
    run_clf_using_cross_validation(
        data,
        data_with_features,
        k_fold,
        show_only_average_result=show_only_average_result,
        save_report_performance=save_report_performance,
        report_performance_file_path=report_performance_file_path,
        run_clf_for_each_fold=run_lr_for_each_fold,
        task=task,
        edges_as_data=False,
        split_by_node=split_by_node)