Example #1
0
def get_algorithm_result(algorithm_class, algorithm_args):
    runner = create_runner(
        algorithm_class,
        num_workers=1,
        algorithm_args=algorithm_args,
    )
    result = capture_stdout(runner.run)()
    result = json.loads(result)
    return result
Example #2
0
def get_algorithm_result(algorithm_class, test_input, num_workers=1):
    alg_args = sum([["-" + p["name"], p["value"]] for p in test_input], [])
    runner = create_runner(
        algorithm_class,
        num_workers=num_workers,
        algorithm_args=alg_args,
    )
    result = capture_stdout(runner.run)()
    result = json.loads(result)["result"][0]["data"]
    return result
if __name__ == "__main__":
    import time

    algorithm_args = [
        "-x",
        "lefthippocampus",
        "-y",
        "alzheimerbroadcategory",
        "-pathology",
        "dementia",
        "-dataset",
        "adni",
        "-filter",
        "",
        "-formula",
        "",
        "-positive_level",
        "AD",
        "-negative_level",
        "CN",
    ]
    runner = create_runner(
        LogisticRegression,
        num_workers=10,
        algorithm_args=algorithm_args,
    )
    start = time.time()
    runner.run()
    end = time.time()
    print("Completed in ", end - start)
Example #4
0
                    continue
                counter = self.fetch("model__" + "counter_" + categorical +
                                     "_" + dataset)
                raw_out["model"][dataset]["data"][categorical] = dict(counter)
        self.result = AlgorithmResult(raw_data=raw_out)


if __name__ == "__main__":
    import time
    from mipframework import create_runner

    algorithm_args = [
        "-y",
        "rightphgparahippocampalgyrus, gender, alzheimerbroadcategory, rs10498633_t",
        "-pathology",
        "dementia",
        "-dataset",
        "lille_simulation, lille_simulation1",
        "-filter",
        "",
    ]
    runner = create_runner(
        DescriptiveStats,
        algorithm_args=algorithm_args,
        num_workers=2,
    )
    start = time.time()
    runner.run()
    end = time.time()
    print("Completed in ", end - start)
Example #5
0
    import time
    from mipframework import create_runner

    algorithm_args = [
        "-x",
        # "lefthippocampus,righthippocampus,leftaccumbensarea",
        # "gender,apoe4,agegroup",
        "lefthippocampus,righthippocampus,leftaccumbensarea,gender,apoe4,agegroup",
        "-y",
        "alzheimerbroadcategory",
        "-alpha",
        "1",
        "-k",
        "10",
        "-pathology",
        "dementia",
        "-dataset",
        "adni",
        "-filter",
        "",
    ]
    runner = create_runner(
        NaiveBayes,
        algorithm_args=algorithm_args,
        num_workers=3,
    )
    start = time.time()
    runner.run()
    end = time.time()
    # print("Completed in ", end - start)
Example #6
0
if __name__ == "__main__":
    import time
    from mipframework import create_runner

    algorithm_args = [
        "-x",
        "rightioginferioroccipitalgyrus,rightmfcmedialfrontalcortex",
        "-y",
        "subjectage,rightventraldc,rightaccumbensarea",
        "-pathology",
        "dementia, leftaccumbensarea",
        "-dataset",
        "adni",
        "-filter",
        "",
        "-formula",
        "",
        "-coding",
        "",
    ]
    runner = create_runner(
        Pearson,
        algorithm_args=algorithm_args,
        num_workers=3,
    )
    start = time.time()
    runner.run()
    end = time.time()
    print("Completed in ", end - start)
Example #7
0
        "-y",
        "lefthippocampus, righthippocampus, leftcaudate",
        "-x",
        "gender, agegroup",
        "-pathology",
        "dementia",
        "-dataset",
        "edsd, ppmi",
        "-filter",
        "",
        "-dx",
        "alzheimerbroadcategory",
        "-c2_feature_selection_method",
        "RF",
        "-c2_num_clusters_method",
        "Euclidean",
        "-c2_num_clusters",
        "6",
        "-c2_clustering_method",
        "Euclidean",
        "-c3_feature_selection_method",
        "RF",
        "-c3_classification_method",
        "RF",
    ]
    runner = create_runner(ThreeC, algorithm_args=algorithm_args, num_workers=1,)
    start = time.time()
    runner.run()
    end = time.time()
    print("Completed in ", end - start)
Example #8
0
        "-y",
        "hospOutcomeLatest_RIC10",
        "-devel",
        "internal",
        "-max_deg",
        "4",
        "-confLevels",
        "0.80, 0.95",
        "-thres",
        "0.95",
        "-num_points",
        "200",
        "-pathology",
        "dementia",
        "-dataset",
        "cb_data",
        "-filter",
        "",
        "-formula",
        "",
    ]
    runner = create_runner(
        algorithm_class=CalibrationBelt,
        num_workers=1,
        algorithm_args=algorithm_args,
    )
    start = time.time()
    runner.run()
    end = time.time()
    print("Completed in ", end - start)
Example #9
0
        tukey_row["t_stat"] = row["t value"]
        tukey_row["p_tukey"] = row["Pr(>|t|)"]
        tukey_dict.append(tukey_row)
    return tukey_dict


if __name__ == "__main__":
    import time
    from mipframework import create_runner

    algorithm_args = [
        "-y",
        "rightmprgprecentralgyrusmedialsegment",
        "-x",
        "alzheimerbroadcategory",
        "-pathology",
        "dementia",
        "-dataset",
        "ppmi,adni",
        "-filter",
        "",
    ]
    runner = create_runner(
        Anova,
        algorithm_args=algorithm_args,
        num_workers=3,
    )
    start = time.time()
    runner.run()
    end = time.time()
Example #10
0
                    "field":"alzheimerbroadcategory",
                    "type":"string",
                    "input":"select",
                    "operator":"equal",
                    "value":"AD"
                },
                {
                    "id":"alzheimerbroadcategory",
                    "field":"alzheimerbroadcategory",
                    "type":"string",
                    "input":"select",
                    "operator":"equal",
                    "value":"MCI"
                }
            ],
            "valid":true
        }
        """,
        "-outcome_pos",
        "MCI",
        "-outcome_neg",
        "AD",
        "-total_duration",
        "1100",
    ]
    runner = create_runner(KaplanMeier, algorithm_args=algorithm_args, num_workers=1,)
    start = time.time()
    runner.run()
    end = time.time()
    print("Completed in ", end - start)
Example #11
0
    idx = eigenvalues.argsort()[::-1]
    eigenvalues = eigenvalues[idx]
    eigenvectors = eigenvectors[:, idx]
    eigenvectors = eigenvectors.T
    return eigenvalues, eigenvectors


if __name__ == "__main__":
    import time
    from mipframework import create_runner

    algorithm_args = [
        "-y",
        "pib",
        "-pathology",
        "dementia",
        "-dataset",
        "adni",
        "-filter",
        "",
    ]
    runner = create_runner(
        PCA,
        algorithm_args=algorithm_args,
        num_workers=1,
    )
    start = time.time()
    runner.run()
    end = time.time()
    print("Completed in ", end - start)