Exemple #1
0
            output_filename = os.path.join(self.HOME_DIR, "output",
                                           "conciseness_valid.predict")
        else:
            output_filename = os.path.join(self.HOME_DIR, "output",
                                           "clarity_valid.predict")
        np.savetxt(output_filename,
                   df_test["predictions_proba"],
                   fmt='%1.10f',
                   delimiter="\n")


#=======================================================================================
if __name__ == '__main__':

    dp = DataPreparation()
    dp.build_combination(processing_mode=1,
                         out_filename="data_all_conciseness.csv")
    dp.clean_data(target_column="conciseness")
    feature_man = FeatureManagement()

    phase = 1
    flags = [True, False]

    if flags[0]:
        features = feature_man.get_basic_features() + \
                   feature_man.get_text_features(mode=0, type=0) + \
                   feature_man.get_text_features(mode=0, type=1)
        print("Total number of training features {}".format(len(features)))
        print(feature_man.get_basic_features())

        no_models = 20
        no_rounds = 500
            both_predictions = both_predictions / num_of_models

        both_filename = os.path.join(self.HOME_DIR, "output",
                                     "both_test.predict")
        np.savetxt(both_filename,
                   both_predictions,
                   fmt='%1.10f',
                   delimiter="\n")


#=======================================================================================
if __name__ == '__main__':

    dp = DataPreparation()
    dp.build_combination(processing_mode=0,
                         out_filename="data_all_clarity.csv")
    dp.clean_data(target_column="clarity")

    feature_man = FeatureManagement()
    phase = 2
    flags = [False, True]

    if flags[0]:

        features = feature_man.get_basic_features(is_clarity=True) + \
                   feature_man.get_text_features(mode=0, type=0) + \
                   feature_man.get_text_features(mode=0, type=1)
        print("Total number of training features {}".format(len(features)))

        no_models = 20
        no_rounds = 500