예제 #1
0
def main():
    try:
        # get parameters from tuner
        RECEIVED_PARAMS = nni.get_next_parameter()
        LOG.debug(RECEIVED_PARAMS)
        PARAMS = default_params()
        PARAMS.update(RECEIVED_PARAMS)
        LOG.debug(PARAMS)
        method = sys.argv[1]
        path = sys.argv[2]
        r = sys.argv[3]
        eps_heavy = str(float(sys.argv[4]))
        eps_light = str(float(sys.argv[5]))
       # s_path = '/home/haipeng/Documents/dataset/selected/'+method + '/' + method + '_video_bin_'+path+'_kb.csv'
       # print('score_path: '+ s_path)
       # selected_f = pd.read_csv(s_path,header=None)
        # score_list = selected_f.sort_values(selected_f.columns[1], ascending=False)
        # selected_col = score_list.iloc[:PARAMS['data_dim'],0]
        # selected_col = sorted(selected_col)
       # cols = [i for i in range(500,3000)]
        # X_train, y_train, X_test, y_test, num_classes = su.load_data('/home/haipeng/Documents/dataset/Video_dataset/KB/video_bin_'+path+'_kb.csv', PARAMS['data_dim'])
        root_p = '/home/haipeng/Documents/dataset/Video_dataset/'
        X_train, y_train, X_test, y_test, num_classes = su.load_data(root_p + 'KB/lap_weight/' + method + '_' + str(path) +'_video_bin_dp_' + r + '_' + eps_heavy +'_'+eps_light+ '.csv', PARAMS['data_dim'])
        print('num_classes is ' + str(num_classes))
        X_train=np.expand_dims(X_train, axis=2)
        X_test=np.expand_dims(X_test, axis=2)
        model=built_and_compile(PARAMS, num_classes)
        m=train(model, PARAMS, X_train, y_train, X_test, y_test)
        test(PARAMS, m, X_test, y_test, num_classes, path, method, r, eps_heavy, eps_light)
    except Exception as exception:
        LOG.exception(exception)
        raise
예제 #2
0
def main(step, dim):
    selected_col = [i for i in range(1, 401)]
    data_path = sys.argv[3]
    model_path = sys.argv[4]
    X_train, y_train, X_test, y_test, num_classes = su.load_data(
        '/home/haipeng/Documents/dataset/Video_dataset/KB/video_bin_' + path +
        '_kb.csv', dim)
    permutation(X_test, y_test, step, dim, model_path)
예제 #3
0
def main():
    # method = sys.argv[1]
    method = 'mrmr'
    model_path = '/home/lhp/PycharmProjects/dl_models/cnn_video_bin.h5'
    model = load_model(model_path)
    # path = '/home/lhp/PycharmProjects/dataset/Alexa_dataset/numeric_class.csv'
    # selected_f = pd.read_csv(path,header=None)

    # selected_col = selected_f.iloc[:,0]
    # selected_col = sorted(selected_col)
    selected_col = [i for i in range(1, 721)]
    X_train, y_train, X_test, y_test, num_classes = su.load_data(
        'video_bin_dp_5e-5_720.csv', selected_col)

    # PARAMS = default_params()
    # test(PARAMS, X_test, y_test, num_classes)

    X_test = np.expand_dims(X_test, axis=2)
    score, acc = model.evaluate(X_test, y_test, batch_size=100)
    print(f"Model Performance: {score, acc}")
예제 #4
0
def main():
    try:
        # get parameters from tuner
        RECEIVED_PARAMS = nni.get_next_parameter()
        LOG.debug(RECEIVED_PARAMS)
        PARAMS = default_params()
        PARAMS.update(RECEIVED_PARAMS)
        LOG.debug(PARAMS)
        # cols = [i for i in range(500,3000)]
        X_train, y_train, X_test, y_test, num_classes = su.load_data(
            '/home/haipeng/Documents/dataset/cache_dataset/linux_tor.csv',
            PARAMS['data_dim'])
        #X_train, y_train, X_test, y_test, num_classes = su.load_sel_data(
        #   '/home/haipeng/Documents/dataset/'+path, cols)
        print('num_classes is ' + str(num_classes))
        X_train = np.expand_dims(X_train, axis=2)
        X_test = np.expand_dims(X_test, axis=2)
        model = built_and_compile(PARAMS, num_classes)
        m = train(model, PARAMS, X_train, y_train, X_test, y_test)
        test(PARAMS, m, X_test, y_test, num_classes)
    except Exception as exception:
        LOG.exception(exception)
        raise
예제 #5
0
def main():
    selected_col = [i for i in range(1, 401)]
    X_train, y_train, X_test, y_test, num_classes = su.load_data(
        '/home/lhp/PycharmProjects/dataset/Alexa_dataset/generic_class.csv',
        selected_col)
    permutation(X_test, y_test)