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))
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))
def get_data_iter(path, extra=[], batch_size=128, **kwargs): dset = HybridSet(path=path, extra=extra) data_iter = DataIterator(dset, batch_size=batch_size, **kwargs) return data_iter
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))
def get_data_iter(path, seq_maxlen, extra=[], batch_size=128, **kwargs): dset = PIDOneHotSet(path=path, seq_maxlen=seq_maxlen, extra=extra) data_iter = DataIterator(dset, batch_size=batch_size, **kwargs) return data_iter
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))
def get_data_iter(self, path, batch_size, cycle, fit_generator_mode): dataset = self.get_dataset(path) data_iter = DataIterator( dataset, batch_size=batch_size, cycle=cycle, fit_generator_mode=fit_generator_mode) return data_iter
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))
def get_data_iter(path, batch_size=128, full_info=False, extra=[], **kwargs): dset = BDTVarSet(path=path, full_info=full_info, extra=extra) data_iter = DataIterator(dset, batch_size=batch_size, **kwargs) return data_iter
def get_data_iter(path, prep_path=None, batch_size=128, extra=[], **kwargs): dset = C10Set(path=path, prep_path=prep_path, extra=extra) data_iter = DataIterator(dset, batch_size=batch_size, **kwargs) return data_iter