Пример #1
0
def main(random_state=100):
    data_type = 'payload'  # header, header_payload
    X_train, y_train, X_test, y_test = load_flow_data(
        random_state=random_state, data_type=data_type)
    in_dim = len(X_train[0][0])
    rnn = RNN(n_epochs=100,
              in_dim=in_dim,
              out_dim=10,
              n_layers=1,
              lr=1e-3,
              bias=False,
              random_state=random_state)

    rnn.train(X_train=X_train,
              y_train=y_train,
              X_val=X_test,
              y_val=y_test,
              split=True)

    #计算test运行时间
    begin_time = time()

    rnn.test(X_test=X_test, y_test=y_test, split=True)

    end_time = time()
    run_time = end_time - begin_time
    print("test time:", run_time)
Пример #2
0
def main(random_state=100):
    data_type = 'payload'  # header, header_payload
    X_train, y_train, X_test, y_test = load_flow_data(random_state=random_state, data_type=data_type)
    in_dim = len(X_train[0][0])
    rnn = RNN(n_epochs=100, in_dim=in_dim, out_dim=10, n_layers=1, lr=1e-3, bias=False, random_state=random_state)

    rnn.train(X_train=X_train, y_train=y_train, X_val=X_test, y_val=y_test, split=True)

    rnn.test(X_test=X_test, y_test=y_test, split=True)