Ejemplo n.º 1
0
def _test():
    from keras4hep.projects.qgjets.utils import get_dataset_paths
    path = get_dataset_paths(min_pt=100)["training"]

    dset = JetSeqSet(path,
                     extra=["pt", "eta"],
                     seq_maxlen={
                         "x_kin": 50,
                         "x_pid": 50
                     })
    data_iter = DataIterator(dset, batch_size=128)

    batch = data_iter.next()
    for key, value in batch.iteritems():
        print(key, value.shape)

    print(data_iter.get_shape("x_pid", False))
    print(data_iter.get_shape("x_kin", True))

    data_iter.fit_generator_input = {"x": ["x_kin", "x_pid"], "y": ["y"]}
    data_iter.fit_generator_mode = True
    for idx, (x, y) in enumerate(data_iter):
        if idx == 3:
            break

        print(len(x))
        for each in x:
            print("x: {}".format(each.shape))
Ejemplo n.º 2
0
def _test():
    path = "/store/slowmoyang/QGJets/dijet_100_110/dijet_100_110_test.root"
    dset = BDTVarSet(path, extra=["pt", "eta"])
    data_iter = DataIterator(dset, batch_size=128)

    batch = data_iter.next()
    for key, value in batch.iteritems():
        print(key, value.shape)

    print(data_iter._dataset[:1]["x"].shape[1:])

    print(data_iter.get_shape("x", False))
    print(data_iter.get_shape("x", True))
Ejemplo n.º 3
0
def _test():
    from dataset import C10Set
    from keras4hep.data import DataIterator
    path = "/store/slowmoyang/QGJets/dijet_100_110/dijet_100_110_test.root"
    dset = C10Set(path)
    data_iter = DataIterator(dset, batch_size=128)

    batch = data_iter.next()
    x_shape = data_iter.get_shape("x", batch_shape=False)

    model = build_a_model(x_shape)

    logits = model.predict_on_batch(batch.x)
    print("logits: {}".format(logits.shape))
Ejemplo n.º 4
0
def _test():
    from keras4hep.data import DataIterator
    from dataset import JetSeqSet

    path = "/store/slowmoyang/QGJets/dijet_100_110/dijet_100_110_test.root"
    prep_path = "./logs/dijet_100_110_training.npz"
    dset = JetSeqSet(path, extra=["pt", "eta"],
                     seq_maxlen={"x": 50})
    data_iter = DataIterator(dset, batch_size=128)

    batch = data_iter.next()
    x_shape = data_iter.get_shape("x", batch_shape=False)

    model = build_a_model(x_shape)

    y_score = model.predict_on_batch([batch.x])
    print("y_score: {}".format(y_score.shape))
Ejemplo n.º 5
0
def _test():
    path = "/store/slowmoyang/QGJets/dijet_100_110/dijet_100_110_test.root"
    dset = JetSeqSet(path, extra=["pt", "eta"], seq_maxlen={"x": 50})
    data_iter = DataIterator(dset, batch_size=128)

    batch = data_iter.next()
    for key, value in batch.iteritems():
        print(key, value.shape)

    print(data_iter.get_shape("x", False))
    print(data_iter.get_shape("x", True))

    data_iter.fit_generator_input = {"x": ["x"], "y": ["y"]}
    data_iter.fit_generator_mode = True
    for idx, (x, y) in enumerate(data_iter):
        if idx == 3:
            break

        print(len(x))
        for each in x:
            print("x: {}".format(each.shape))