Beispiel #1
0
                                "," + str(rq2_recall) + "," + str(rq2_f1) +
                                "," + str(rq2_average_precision) + "," +
                                str(elapsed_time) + "\n")
                            write_result(rq1_outfile, rq1_result_str)
                            write_result(rq2_outfile, rq2_result_str)
                            gc.collect()
                        except Exception as ex:
                            print(
                                "Skipping combination layer: {}, emb_output: {}, lstm_units: {}, epoch: {}"
                                .format(layer, emb_output, lstm_units, epoch))
                            print(ex)
                        cur_iter += 1


if __name__ == "__main__":
    smell_list = {
        "ComplexMethod", "EmptyCatchBlock", "MagicNumber",
        "MultifacetedAbstraction"
    }
    # smell_list = {"ComplexMethod"}

    for smell in smell_list:
        # data_path is for both training and rq1_evaluation
        data_path = os.path.join(
            os.path.join(TRAINING_TOKENIZER_OUT_PATH, smell), DIM)
        rq2_eval_data_path = os.path.join(
            os.path.join(EVAL_TOKENIZER_OUT_PATH, smell), DIM)
        inputs.preprocess_data(data_path)
        inputs.preprocess_data(rq2_eval_data_path)
        main(data_path, rq2_eval_data_path, smell)
Beispiel #2
0
import os
import rq1_rnn_emb_lstm as rnn
import inputs

# --- Parameters --
DIM = "1d"

# TOKENIZER_OUT_PATH = "../../data/tokenizer_out_cs/"
TOKENIZER_OUT_PATH = "/users/pa18/tushar/smellDetectionML/data/tokenizer_out_cs/"
# ---

smell = "MultifacetedAbstraction"
data_path = os.path.join(os.path.join(TOKENIZER_OUT_PATH, smell), DIM)
inputs.preprocess_data(data_path)
rnn.main(data_path, smell)
                                          str(accuracy) + "," +
                                          str(precision) + "," + str(recall) +
                                          "," + str(f1) + "," +
                                          str(average_precision) + "," +
                                          str(elapsed_time) + "\n")

                            write_result(outfile, result_str)
                        except Exception as ex:
                            print(
                                "Skipping combination layer: {}, emb_output: {}, lstm_units: {}, epoch: {}"
                                .format(layer, emb_output, lstm_units, epoch))
                            print(ex)
                        cur_iter += 1
                        gc.collect()


if __name__ == "__main__":
    smell_list = {
        "ComplexMethod", "EmptyCatchBlock", "MagicNumber",
        "MultifacetedAbstraction"
    }
    # smell_list = {"ComplexMethod"}
    for smell in smell_list:
        training_data_path = os.path.join(
            os.path.join(TRAINING_TOKENIZER_OUT_PATH, smell), DIM)
        eval_data_path = os.path.join(
            os.path.join(EVAL_TOKENIZER_OUT_PATH, smell), DIM)
        inputs.preprocess_data(training_data_path)
        inputs.preprocess_data(eval_data_path)
        main()