default=1500) (options, args) = parser.parse_args() ######## trainSize = options.trainSize resultDir = options.resultDir modelName = options.modelName trainFlag = options.trainFlag devFlag = options.devFlag testFlag = options.testFlag numPowerTraces = options.numPowerTraces dataDir = "/xdisk/rlysecky/manojgopale/extra/chipWhisperer_data/trace_key_1500/" moreDataDir = "/xdisk/rlysecky/manojgopale/extra/chipWhisperer_data/trace_key_1500_1/" trainData, devData, testData = classify_general.getData( dataDir, moreDataDir, trainSize, trainFlag, devFlag, testFlag) x_train, y_train_oh = trainData x_dev, y_dev_oh = devData x_test, y_test_oh = testData ## Instantiate the model and test, dev and training sets ##resultDir = "/extra/manojgopale/AES_data/config3p1_15ktraining/result_new" ##modelName = "m_newscript" np.random.seed() numHiddenLayers = 4 actList = ['elu', 'tanh', 'relu', 'relu'] dropList = [0.3, 0.2, 0.5, 0.25] batchNorm = [1, 0, 0, 1] batchSize = 16000
default=1500) (options, args) = parser.parse_args() ######## trainSize = options.trainSize resultDir = options.resultDir modelName = options.modelName configName = options.configName trainFlag = options.trainFlag devFlag = options.devFlag testFlag = options.testFlag numPowerTraces = options.numPowerTraces dataDir = "/xdisk/rlysecky/manojgopale/xdisk/gem5DataCollection/csvResult/" trainData, devData, testData = classify_general.getData( dataDir, configName, trainSize, trainFlag, devFlag, testFlag) x_train, y_train_oh = trainData x_dev, y_dev_oh = devData x_test, y_test_oh = testData ## Instantiate the model and test, dev and training sets ##resultDir = "/extra/manojgopale/AES_data/config3p1_15ktraining/result_new" ##modelName = "m_newscript" np.random.seed() numAllHiddenLayers = [3, 4, 5, 6, 7, 8, 9, 10] hiddenLayerDict = { "num": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], "factor": [10, 100, 1000] }
modelDir = options.modelDir devDataDir = options.devDataDir trainFlag = options.trainFlag devFlag = options.devFlag testFlag = options.testFlag count = options.count ######## ### TODO: ### 1. Load dev data ### 2. Load models one-by-one and evaluate ### 3. Create csv/tsv files and run error_analysis on it devDir = devDataDir + devDataConfig + "/" _, devData, _ = classify_general.getData(devDataDir, devDataConfig, trainSize, trainFlag, devFlag, testFlag) x_dev, y_dev_oh = devData modelDict = OrderedDict() modelDict = {\ "config3p1": "rerun_cw_run_177_4HL_11epochs_100p00_acc_.h5",\ "config3p2": "rerun_cw_run_config3p2_177_4HL_11epochs_98p05_acc_.h5",\ "config3p3": "rerun_cw_run_177_4HL_11epochs_98p05_acc_.h5",\ "config3p4": "rerun_cw_run_config3p4_177_4HL_17epochs_100p00_acc_.h5",\ "config4p1": "rerun_cw_run_177_4HL_11epochs_97p66_acc_.h5",\ "config4p2": "rerun_cw_run_177_4HL_11epochs_97p66_acc_.h5",\ "config4p3": "rerun_cw_run_config4p3_177_4HL_17epochs_100p00_acc_.h5",\ "config4p4": "rerun_cw_run_177_4HL_11epochs_98p05_acc_.h5",\ "config5p1": "rerun_cw_run_177_4HL_18epochs_100p00_acc_.h5",\ "config5p2": "rerun_cw_run_config5p2_177_4HL_18epochs_100p00_acc_.h5",\ "config5p3": "rerun_cw_run_177_4HL_11epochs_97p66_acc_.h5",\
"config3p1_1_4HL_8epochs_97p86_acc_.h5", "config3p2_1_4HL_7epochs_99p99_acc_.h5", "config3p3_1_4HL_6epochs_99p98_acc_.h5", "config3p4_1_4HL_7epochs_99p97_acc_.h5", "config4p1_1_4HL_12epochs_99p99_acc_.h5", "config4p2_1_4HL_11epochs_100p00_acc_.h5", "config4p3_1_4HL_7epochs_99p99_acc_.h5", "config4p4_1_4HL_8epochs_99p94_acc_.h5", "config5p1_17_4HL_6epochs_100p00_acc_.h5", "config5p2_17_4HL_7epochs_98p38_acc_.h5", "config5p3_17_4HL_6epochs_100p00_acc_.h5", "config5p4_17_4HL_13epochs_70p49_acc_.h5" ] if (devFlag): _, devData, _ = classify_general.getData(testDir, testConfig, trainSize, trainFlag, devFlag, testFlag) x_dev, y_dev_oh = devData for index, modelName in enumerate(modelList): modelPath = modelDir + "/" + configList[count] + "/" + modelList[count] print("Loading model \n%s\n" % (modelPath)) model = load_model(modelPath) print("Finished loading model \n%s\n" % (modelPath)) ## Evaluate the performance of model on testData model_score = model.evaluate(x_dev, y_dev_oh, batch_size=2048) print("\nmodel= %s score on %s is: %s\n" % (configList[count], testConfig, model_score[1])) ## Convert from one-hot to numerical prediction y_pred = np.argmax(model.predict(x_dev, batch_size=2048), axis=1)