Ejemplo n.º 1
0
    def three_models_combined(self):

        hypertension_features = [
            'trait1', 'trait2', 'lot1', 'PCL1', 'PCL2', 'phq2',
             'active_coping1',  'self_blame1',
              'HL_MAOA', 'HML_FKBP5', 'highschool_diploma', 'T1Acc1n', 'T1Acc1t',
             'q6.15_CONC_pcl1', 'q6.2_DREAM_pcl2',
             'hypertention_pcl1', 'hypertention_pcl2', 'avoidance_pcl2', 'intrusion_pcl1', 'depression_pcl2'
                ]
        avoidance_features =  ['q6.1_INTRU_pcl1', 'q6.2_DREAM_pcl2', 'q6.3_FLASH_pcl2','q6.3_FLASH_pcl1',
             'q6.4_UPSET_pcl1', 'q6.14_ANGER_pcl1', 'q6.7_AVSIT_pcl1', 'q6.7_AVSIT_pcl2',
             'q6.11_NUMB_pcl1', 'q6.12_FUTRE_pcl2', 'q6.14_ANGER_pcl1',
             'avoidance_pcl1', 'avoidance_pcl2', 'depression_pcl1', 'intrusion_pcl1',
             'PCL_Broad2', 'PCL_Strict1','trait2'
             ]

        intrusion_features = ['trait1', 'q6.5_PHYS_pcl1', 'q6.14_ANGER_pcl2', 'state1', 'PCL1', 'phq1', 'self_distraction1',
                    'hypertention_pcl2', 'venting1', 'PCL2', 'self_distraction2', 'behavioral_disengagement2',
                    'q6.17_STRTL_pcl2', 'substance_use1',  'HML_NPY', 'venting2', 'behavioral_disengagement1',
             'ADHD', 'cd_risc1']
        regression_features = [
            'q6.11_NUMB_pcl2', 'q6.13_SLEEP_pcl1', 'intrusion_pcl2', 'phq2',
            'q6.1_INTRU_pcl2', 'PCL_Broad1', 'q6.14_ANGER_pcl2',
            'phq1', 'q6.5_PHYS_pcl1', 'denial2'
        ]
        depression_features= ['q6.1_INTRU_pcl1', 'q6.2_DREAM_pcl2', 'q6.3_FLASH_pcl2', 'q6.3_FLASH_pcl1',
         'q6.4_UPSET_pcl1', 'q6.14_ANGER_pcl1', 'q6.7_AVSIT_pcl1', 'q6.7_AVSIT_pcl2',
         'q6.11_NUMB_pcl1', 'q6.12_FUTRE_pcl2', 'q6.14_ANGER_pcl1',
         'avoidance_pcl1', 'avoidance_pcl2', 'depression_pcl1', 'intrusion_pcl1',
         'PCL_Broad2', 'PCL_Strict1', 'trait2'
         ]
        target = "PCL_Strict3"
        multiple_features_eda = EDAMultiFeatureBackend(self.df, self.features, target)
        multiple_features_eda.three_models_combined(intrusion_features, avoidance_features, hypertension_features,
                                                    regression_features, depression_features)
Ejemplo n.º 2
0
    def test_algorithms_for_target_regression(self):
        print("\n\n\n regression_cutoff \n")
        f = ['q6.11_NUMB_pcl2', 'q6.13_SLEEP_pcl1', 'intrusion_pcl2', 'phq2',
                    'q6.1_INTRU_pcl2', 'PCL_Broad1', 'q6.14_ANGER_pcl2',
                    'phq1', 'q6.5_PHYS_pcl1', 'denial2']  # 20

        target = "PCL3"
        multiple_features_eda = EDAMultiFeatureBackend(self.df, f, target)
        multiple_features_eda.regression_model()
Ejemplo n.º 3
0
    def test_algorithms_for_target_regression(self):
        print("\n\n\n regression_cutoff \n")
        f = [
            'q6.11_NUMB_pcl2', 'q6.13_SLEEP_pcl1', 'intrusion_pcl2', 'phq2',
            'q6.1_INTRU_pcl2', 'PCL_Broad1', 'q6.14_ANGER_pcl2', 'phq1',
            'q6.5_PHYS_pcl1', 'denial2'
        ]  # 20

        target = "PCL3"
        multiple_features_eda = EDAMultiFeatureBackend(self.df, f, target)
        multiple_features_eda.regression_model()
Ejemplo n.º 4
0
 def test_models_with_LOO(self):
     targets = {
         'intrusion_cutoff': 1,
         'avoidance_cutoff': 1,
         'hypertention_cutoff': 1,
         'depression_cutoff': 1,
         'only_avoidance_cutoff': 1,
         'diagnosis': 1,
         'regression_cutoff_33': 1,
         'regression_cutoff_50': 1,
         'tred_cutoff': 1
     }
     targets_list = [i for i in targets if targets[i] == 1]
     for target in targets_list:
         print(f"\n\n\n\t\b{target}\n")
         multiple_features_eda = EDAMultiFeatureBackend(self.df, self.features + self.features_2, target)
         multiple_features_eda.model_selection_by_grid_search_loo()
Ejemplo n.º 5
0
    def three_models_combined(self):

        hypertension_features = [
            'trait1', 'trait2', 'lot1', 'PCL1', 'PCL2', 'phq2',
            'active_coping1', 'self_blame1', 'HL_MAOA', 'HML_FKBP5',
            'highschool_diploma', 'T1Acc1n', 'T1Acc1t', 'q6.15_CONC_pcl1',
            'q6.2_DREAM_pcl2', 'hypertention_pcl1', 'hypertention_pcl2',
            'avoidance_pcl2', 'intrusion_pcl1', 'depression_pcl2'
        ]
        avoidance_features = [
            'q6.1_INTRU_pcl1', 'q6.2_DREAM_pcl2', 'q6.3_FLASH_pcl2',
            'q6.3_FLASH_pcl1', 'q6.4_UPSET_pcl1', 'q6.14_ANGER_pcl1',
            'q6.7_AVSIT_pcl1', 'q6.7_AVSIT_pcl2', 'q6.11_NUMB_pcl1',
            'q6.12_FUTRE_pcl2', 'q6.14_ANGER_pcl1', 'avoidance_pcl1',
            'avoidance_pcl2', 'depression_pcl1', 'intrusion_pcl1',
            'PCL_Broad2', 'PCL_Strict1', 'trait2'
        ]

        intrusion_features = [
            'trait1', 'q6.5_PHYS_pcl1', 'q6.14_ANGER_pcl2', 'state1', 'PCL1',
            'phq1', 'self_distraction1', 'hypertention_pcl2', 'venting1',
            'PCL2', 'self_distraction2', 'behavioral_disengagement2',
            'q6.17_STRTL_pcl2', 'substance_use1', 'HML_NPY', 'venting2',
            'behavioral_disengagement1', 'ADHD', 'cd_risc1'
        ]
        regression_features = [
            'q6.11_NUMB_pcl2', 'q6.13_SLEEP_pcl1', 'intrusion_pcl2', 'phq2',
            'q6.1_INTRU_pcl2', 'PCL_Broad1', 'q6.14_ANGER_pcl2', 'phq1',
            'q6.5_PHYS_pcl1', 'denial2'
        ]
        depression_features = [
            'q6.1_INTRU_pcl1', 'q6.2_DREAM_pcl2', 'q6.3_FLASH_pcl2',
            'q6.3_FLASH_pcl1', 'q6.4_UPSET_pcl1', 'q6.14_ANGER_pcl1',
            'q6.7_AVSIT_pcl1', 'q6.7_AVSIT_pcl2', 'q6.11_NUMB_pcl1',
            'q6.12_FUTRE_pcl2', 'q6.14_ANGER_pcl1', 'avoidance_pcl1',
            'avoidance_pcl2', 'depression_pcl1', 'intrusion_pcl1',
            'PCL_Broad2', 'PCL_Strict1', 'trait2'
        ]
        target = "PCL_Strict3"
        multiple_features_eda = EDAMultiFeatureBackend(self.df, self.features,
                                                       target)
        multiple_features_eda.three_models_combined(intrusion_features,
                                                    avoidance_features,
                                                    hypertension_features,
                                                    regression_features,
                                                    depression_features)
Ejemplo n.º 6
0
 def test_models_with_LOO(self):
     targets = {
         'intrusion_cutoff': 1,
         'avoidance_cutoff': 1,
         'hypertention_cutoff': 1,
         'depression_cutoff': 1,
         'only_avoidance_cutoff': 1,
         'diagnosis': 1,
         'regression_cutoff_33': 1,
         'regression_cutoff_50': 1,
         'tred_cutoff': 1
     }
     targets_list = [i for i in targets if targets[i] == 1]
     for target in targets_list:
         print(f"\n\n\n\t\b{target}\n")
         multiple_features_eda = EDAMultiFeatureBackend(
             self.df, self.features + self.features_2, target)
         multiple_features_eda.model_selection_by_grid_search_loo()
Ejemplo n.º 7
0
    def test_algorithms_for_target_tred_cutoff(self):
        print("precision score")
        print("\n\n\n tred_cutoff \n")
        target = "tred_cutoff"
        multiple_features_eda = EDAMultiFeatureBackend(
            self.df, self.features + self.features_2, target)
        print("\n tred_cutoff with resample\nn=10")
        #multiple_features_eda.model_checking(10, scoring='precision')
        print("\n tred_cutoff without resample\nn=10")
        #multiple_features_eda.model_checking_without_resampling(10, scoring='precision')

        print("\n tred_cutoff with resample\nn=20")
        #multiple_features_eda.model_checking(20, scoring='precision')
        print("\n tred_cutoff without resample\nn=20")
        #multiple_features_eda.model_checking_without_resampling(20, scoring='precision')

        print("\n tred_cutoff with resample\nn=30")
        #multiple_features_eda.model_checking(30, scoring='precision')
        print("\n tred_cutoff without resample\nn=30")
        #multiple_features_eda.model_checking_without_resampling(30, scoring='precision')

        print("tred_cutoff logreg f1 score")
        multiple_features_eda.logistic_regression_grid_search()
        print("tred_cutoff logreg precision score")
        multiple_features_eda.logistic_regression_grid_search(
            scoring='precision')
Ejemplo n.º 8
0
    def test_algorithms_for_target_tred_cutoff(self):
        print("precision score")
        print("\n\n\n tred_cutoff \n")
        target = "tred_cutoff"
        multiple_features_eda = EDAMultiFeatureBackend(self.df, self.features + self.features_2, target)
        print("\n tred_cutoff with resample\nn=10")
        #multiple_features_eda.model_checking(10, scoring='precision')
        print("\n tred_cutoff without resample\nn=10")
        #multiple_features_eda.model_checking_without_resampling(10, scoring='precision')

        print("\n tred_cutoff with resample\nn=20")
        #multiple_features_eda.model_checking(20, scoring='precision')
        print("\n tred_cutoff without resample\nn=20")
        #multiple_features_eda.model_checking_without_resampling(20, scoring='precision')

        print("\n tred_cutoff with resample\nn=30")
        #multiple_features_eda.model_checking(30, scoring='precision')
        print("\n tred_cutoff without resample\nn=30")
        #multiple_features_eda.model_checking_without_resampling(30, scoring='precision')

        print("tred_cutoff logreg f1 score")
        multiple_features_eda.logistic_regression_grid_search()
        print("tred_cutoff logreg precision score")
        multiple_features_eda.logistic_regression_grid_search(scoring='precision')
Ejemplo n.º 9
0
    def test_algorithms_for_target_diagnosis(self):
        print("precision score")
        print("\n\n\n diagnosis \n")
        target = "diagnosis"
        multiple_features_eda = EDAMultiFeatureBackend(self.df, self.features + self.features_2, target)
        print("\n diagnosis with resample\nn=10")
        multiple_features_eda.model_checking(10, scoring='precision')
        print("\n diagnosis without resample\nn=10")
        multiple_features_eda.model_checking_without_resampling(10, scoring='precision')

        print("\n diagnosis with resample\nn=20")
        multiple_features_eda.model_checking(20, scoring='precision')
        print("\n diagnosis without resample\nn=20")
        multiple_features_eda.model_checking_without_resampling(20, scoring='precision')

        print("\n diagnosis with resample\nn=30")
        multiple_features_eda.model_checking(30, scoring='precision')
        print("\n diagnosis without resample\nn=30")
        multiple_features_eda.model_checking_without_resampling(30, scoring='precision')
Ejemplo n.º 10
0
    def test_algorithms_for_target_diagnosis(self):
        print("precision score")
        print("\n\n\n diagnosis \n")
        target = "diagnosis"
        multiple_features_eda = EDAMultiFeatureBackend(
            self.df, self.features + self.features_2, target)
        print("\n diagnosis with resample\nn=10")
        multiple_features_eda.model_checking(10, scoring='precision')
        print("\n diagnosis without resample\nn=10")
        multiple_features_eda.model_checking_without_resampling(
            10, scoring='precision')

        print("\n diagnosis with resample\nn=20")
        multiple_features_eda.model_checking(20, scoring='precision')
        print("\n diagnosis without resample\nn=20")
        multiple_features_eda.model_checking_without_resampling(
            20, scoring='precision')

        print("\n diagnosis with resample\nn=30")
        multiple_features_eda.model_checking(30, scoring='precision')
        print("\n diagnosis without resample\nn=30")
        multiple_features_eda.model_checking_without_resampling(
            30, scoring='precision')