9#include <mva/interface/Dataset.h>
10#include <framework/utilities/TestHelpers.h>
12#include <gtest/gtest.h>
26 m_input = {1.0, 2.0, 3.0, 4.0, 5.0};
35 void loadEvent(
unsigned int iEvent)
override
37 auto f =
static_cast<float>(iEvent);
38 m_input = {f + 1, f + 2, f + 3, f + 4, f + 5};
39 m_spectators = {f + 6, f + 7};
42 std::vector<float>
getFeature(
unsigned int iFeature)
override
44 std::vector<float> a(20, 0.0);
45 std::iota(a.begin(), a.end(), iFeature + 1);
48 std::vector<float>
getSpectator(
unsigned int iSpectator)
override
50 std::vector<float> a(20, 0.0);
51 std::iota(a.begin(), a.end(), iSpectator + 6);
57 TEST(DatasetTest, SingleDataset)
61 general_options.m_variables = {
"a",
"b",
"c"};
62 general_options.m_spectators = {
"e",
"f"};
63 general_options.m_signal_class = 2;
64 std::vector<float> input = {1.0, 2.0, 3.0};
65 std::vector<float> spectators = {4.0, 5.0};
69 EXPECT_EQ(x.getNumberOfFeatures(), 3);
70 EXPECT_EQ(x.getNumberOfSpectators(), 2);
71 EXPECT_EQ(x.getNumberOfEvents(), 1);
73 EXPECT_EQ(x.getFeatureIndex(
"a"), 0);
74 EXPECT_EQ(x.getFeatureIndex(
"b"), 1);
75 EXPECT_EQ(x.getFeatureIndex(
"c"), 2);
76 EXPECT_B2ERROR(x.getFeatureIndex(
"bla"));
78 EXPECT_EQ(x.getSpectatorIndex(
"e"), 0);
79 EXPECT_EQ(x.getSpectatorIndex(
"f"), 1);
80 EXPECT_B2ERROR(x.getSpectatorIndex(
"bla"));
85 EXPECT_EQ(x.m_input.size(), 3);
86 EXPECT_FLOAT_EQ(x.m_input[0], 1.0);
87 EXPECT_FLOAT_EQ(x.m_input[1], 2.0);
88 EXPECT_FLOAT_EQ(x.m_input[2], 3.0);
90 EXPECT_EQ(x.m_spectators.size(), 2);
91 EXPECT_FLOAT_EQ(x.m_spectators[0], 4.0);
92 EXPECT_FLOAT_EQ(x.m_spectators[1], 5.0);
94 EXPECT_FLOAT_EQ(x.m_weight, 1.0);
95 EXPECT_FLOAT_EQ(x.m_target, 2.0);
96 EXPECT_EQ(x.m_isSignal,
true);
98 EXPECT_FLOAT_EQ(x.getSignalFraction(), 1.0);
100 auto feature = x.getFeature(1);
101 EXPECT_EQ(feature.size(), 1);
102 EXPECT_FLOAT_EQ(feature[0], 2.0);
104 auto spectator = x.getSpectator(1);
105 EXPECT_EQ(spectator.size(), 1);
106 EXPECT_FLOAT_EQ(spectator[0], 5.0);
109 feature = x.Dataset::getFeature(1);
110 EXPECT_EQ(feature.size(), 1);
111 EXPECT_FLOAT_EQ(feature[0], 2.0);
115 TEST(DatasetTest, MultiDataset)
119 general_options.m_variables = {
"a",
"b",
"c"};
120 general_options.m_spectators = {
"e",
"f"};
121 general_options.m_signal_class = 2;
122 std::vector<std::vector<float>> matrix = {{1.0, 2.0, 3.0}, {4.0, 5.0, 6.0}, {7.0, 8.0, 9.0}};
123 std::vector<std::vector<float>> spectator_matrix = {{12.0, 13.0}, {15.0, 16.0}, {18.0, 19.0}};
124 std::vector<float> targets = {2.0, 0.0, 2.0};
125 std::vector<float> weights = {1.0, 2.0, 3.0};
127 EXPECT_B2ERROR(
MVA::MultiDataset(general_options, matrix, spectator_matrix, {1.0}, weights));
129 EXPECT_B2ERROR(
MVA::MultiDataset(general_options, matrix, spectator_matrix, targets, {1.0}));
131 MVA::MultiDataset x(general_options, matrix, spectator_matrix, targets, weights);
133 EXPECT_EQ(x.getNumberOfFeatures(), 3);
134 EXPECT_EQ(x.getNumberOfEvents(), 3);
139 EXPECT_EQ(x.m_input.size(), 3);
140 EXPECT_FLOAT_EQ(x.m_input[0], 1.0);
141 EXPECT_FLOAT_EQ(x.m_input[1], 2.0);
142 EXPECT_FLOAT_EQ(x.m_input[2], 3.0);
144 EXPECT_EQ(x.m_spectators.size(), 2);
145 EXPECT_FLOAT_EQ(x.m_spectators[0], 12.0);
146 EXPECT_FLOAT_EQ(x.m_spectators[1], 13.0);
148 EXPECT_FLOAT_EQ(x.m_weight, 1.0);
149 EXPECT_FLOAT_EQ(x.m_target, 2.0);
150 EXPECT_EQ(x.m_isSignal,
true);
155 EXPECT_EQ(x.m_input.size(), 3);
156 EXPECT_FLOAT_EQ(x.m_input[0], 4.0);
157 EXPECT_FLOAT_EQ(x.m_input[1], 5.0);
158 EXPECT_FLOAT_EQ(x.m_input[2], 6.0);
160 EXPECT_EQ(x.m_spectators.size(), 2);
161 EXPECT_FLOAT_EQ(x.m_spectators[0], 15.0);
162 EXPECT_FLOAT_EQ(x.m_spectators[1], 16.0);
164 EXPECT_FLOAT_EQ(x.m_weight, 2.0);
165 EXPECT_FLOAT_EQ(x.m_target, 0.0);
166 EXPECT_EQ(x.m_isSignal,
false);
171 EXPECT_EQ(x.m_input.size(), 3);
172 EXPECT_FLOAT_EQ(x.m_input[0], 7.0);
173 EXPECT_FLOAT_EQ(x.m_input[1], 8.0);
174 EXPECT_FLOAT_EQ(x.m_input[2], 9.0);
176 EXPECT_EQ(x.m_spectators.size(), 2);
177 EXPECT_FLOAT_EQ(x.m_spectators[0], 18.0);
178 EXPECT_FLOAT_EQ(x.m_spectators[1], 19.0);
180 EXPECT_FLOAT_EQ(x.m_weight, 3.0);
181 EXPECT_FLOAT_EQ(x.m_target, 2.0);
182 EXPECT_EQ(x.m_isSignal,
true);
184 EXPECT_FLOAT_EQ(x.getSignalFraction(), 4.0 / 6.0);
186 auto feature = x.getFeature(1);
187 EXPECT_EQ(feature.size(), 3);
188 EXPECT_FLOAT_EQ(feature[0], 2.0);
189 EXPECT_FLOAT_EQ(feature[1], 5.0);
190 EXPECT_FLOAT_EQ(feature[2], 8.0);
192 auto spectator = x.getSpectator(1);
193 EXPECT_EQ(spectator.size(), 3);
194 EXPECT_FLOAT_EQ(spectator[0], 13.0);
195 EXPECT_FLOAT_EQ(spectator[1], 16.0);
196 EXPECT_FLOAT_EQ(spectator[2], 19.0);
201 TEST(DatasetTest, SubDataset)
205 general_options.m_signal_class = 3;
206 general_options.m_variables = {
"a",
"b",
"c",
"d",
"e"};
207 general_options.m_spectators = {
"f",
"g"};
208 TestDataset test_dataset(general_options);
210 general_options.m_variables = {
"a",
"d",
"e"};
211 general_options.m_spectators = {
"g"};
212 std::vector<bool> events = {
true,
false,
true,
false,
true,
false,
true,
false,
true,
false,
213 true,
false,
true,
false,
true,
false,
true,
false,
true,
false
217 EXPECT_EQ(x.getNumberOfFeatures(), 3);
218 EXPECT_EQ(x.getNumberOfEvents(), 10);
223 EXPECT_EQ(x.m_input.size(), 3);
224 EXPECT_FLOAT_EQ(x.m_input[0], 1.0);
225 EXPECT_FLOAT_EQ(x.m_input[1], 4.0);
226 EXPECT_FLOAT_EQ(x.m_input[2], 5.0);
228 EXPECT_EQ(x.m_spectators.size(), 1);
229 EXPECT_FLOAT_EQ(x.m_spectators[0], 7.0);
231 EXPECT_FLOAT_EQ(x.m_weight, -3.0);
232 EXPECT_FLOAT_EQ(x.m_target, 3.0);
233 EXPECT_EQ(x.m_isSignal,
true);
235 EXPECT_FLOAT_EQ(x.getSignalFraction(), 1);
237 auto feature = x.getFeature(1);
238 EXPECT_EQ(feature.size(), 10);
239 for (
unsigned int iEvent = 0; iEvent < 10; ++iEvent) {
240 EXPECT_FLOAT_EQ(feature[iEvent], iEvent * 2 + 4);
243 auto spectator = x.getSpectator(0);
244 EXPECT_EQ(spectator.size(), 10);
245 for (
unsigned int iEvent = 0; iEvent < 10; ++iEvent) {
246 EXPECT_FLOAT_EQ(spectator[iEvent], iEvent * 2 + 7);
250 feature = x.Dataset::getFeature(1);
251 EXPECT_EQ(feature.size(), 10);
252 for (
unsigned int iEvent = 0; iEvent < 10; ++iEvent) {
253 EXPECT_FLOAT_EQ(feature[iEvent], iEvent * 2 + 4);
256 spectator = x.Dataset::getSpectator(0);
257 EXPECT_EQ(spectator.size(), 10);
258 for (
unsigned int iEvent = 0; iEvent < 10; ++iEvent) {
259 EXPECT_FLOAT_EQ(spectator[iEvent], iEvent * 2 + 7);
264 feature = y.getFeature(1);
265 EXPECT_EQ(feature.size(), 20);
266 for (
unsigned int iEvent = 0; iEvent < 20; ++iEvent) {
267 EXPECT_FLOAT_EQ(feature[iEvent], iEvent + 4);
270 spectator = y.getSpectator(0);
271 EXPECT_EQ(spectator.size(), 20);
272 for (
unsigned int iEvent = 0; iEvent < 20; ++iEvent) {
273 EXPECT_FLOAT_EQ(spectator[iEvent], iEvent + 7);
277 feature = y.Dataset::getFeature(1);
278 EXPECT_EQ(feature.size(), 20);
279 for (
unsigned int iEvent = 0; iEvent < 20; ++iEvent) {
280 EXPECT_FLOAT_EQ(feature[iEvent], iEvent + 4);
283 spectator = y.Dataset::getSpectator(0);
284 EXPECT_EQ(spectator.size(), 20);
285 for (
unsigned int iEvent = 0; iEvent < 20; ++iEvent) {
286 EXPECT_FLOAT_EQ(spectator[iEvent], iEvent + 7);
289 general_options.m_variables = {
"a",
"d",
"e",
"DOESNOTEXIST"};
291 EXPECT_B2ERROR(
MVA::SubDataset(general_options, events, test_dataset));
295 EXPECT_THROW(
MVA::SubDataset(general_options, events, test_dataset), std::runtime_error);
297 general_options.m_variables = {
"a",
"d",
"e"};
298 general_options.m_spectators = {
"DOESNOTEXIST"};
300 EXPECT_B2ERROR(
MVA::SubDataset(general_options, events, test_dataset));
304 EXPECT_THROW(
MVA::SubDataset(general_options, events, test_dataset), std::runtime_error);
308 TEST(DatasetTest, CombinedDataset)
312 general_options.m_signal_class = 1;
313 general_options.m_variables = {
"a",
"b",
"c",
"d",
"e"};
314 general_options.m_spectators = {
"f",
"g"};
315 TestDataset signal_dataset(general_options);
316 TestDataset bckgrd_dataset(general_options);
320 EXPECT_EQ(x.getNumberOfFeatures(), 5);
321 EXPECT_EQ(x.getNumberOfEvents(), 40);
326 EXPECT_EQ(x.m_input.size(), 5);
327 EXPECT_FLOAT_EQ(x.m_input[0], 1.0);
328 EXPECT_FLOAT_EQ(x.m_input[1], 2.0);
329 EXPECT_FLOAT_EQ(x.m_input[2], 3.0);
330 EXPECT_FLOAT_EQ(x.m_input[3], 4.0);
331 EXPECT_FLOAT_EQ(x.m_input[4], 5.0);
333 EXPECT_EQ(x.m_spectators.size(), 2);
334 EXPECT_FLOAT_EQ(x.m_spectators[0], 6.0);
335 EXPECT_FLOAT_EQ(x.m_spectators[1], 7.0);
337 EXPECT_FLOAT_EQ(x.m_weight, -3.0);
338 EXPECT_FLOAT_EQ(x.m_target, 1.0);
339 EXPECT_EQ(x.m_isSignal,
true);
341 EXPECT_FLOAT_EQ(x.getSignalFraction(), 0.5);
343 auto feature = x.getFeature(1);
344 EXPECT_EQ(feature.size(), 40);
345 for (
unsigned int iEvent = 0; iEvent < 40; ++iEvent) {
346 EXPECT_FLOAT_EQ(feature[iEvent], (iEvent % 20) + 2);
349 auto spectator = x.getSpectator(0);
350 EXPECT_EQ(spectator.size(), 40);
351 for (
unsigned int iEvent = 0; iEvent < 40; ++iEvent) {
352 EXPECT_FLOAT_EQ(spectator[iEvent], (iEvent % 20) + 6);
356 feature = x.Dataset::getFeature(1);
357 EXPECT_EQ(feature.size(), 40);
358 for (
unsigned int iEvent = 0; iEvent < 40; ++iEvent) {
359 EXPECT_FLOAT_EQ(feature[iEvent], (iEvent % 20) + 2);
362 spectator = x.Dataset::getSpectator(0);
363 EXPECT_EQ(spectator.size(), 40);
364 for (
unsigned int iEvent = 0; iEvent < 40; ++iEvent) {
365 EXPECT_FLOAT_EQ(spectator[iEvent], (iEvent % 20) + 6);
368 for (
unsigned int iEvent = 0; iEvent < 40; ++iEvent) {
370 EXPECT_EQ(x.m_isSignal, iEvent < 20);
371 EXPECT_FLOAT_EQ(x.m_target, iEvent < 20 ? 1.0 : 0.0);
376 TEST(DatasetTest, ROOTDataset)
380 TFile file(
"datafile.root",
"RECREATE");
382 TTree tree(
"tree",
"TreeTitle");
383 float a, b, c, d, e, f, v, w = 0;
385 tree.Branch(
"a", &a);
386 tree.Branch(
"b", &b);
387 tree.Branch(
"c", &c);
388 tree.Branch(
"d", &d);
389 tree.Branch(
"e__bo__bc", &e);
390 tree.Branch(
"f__bo__bc", &f);
391 tree.Branch(
"g", &target);
392 tree.Branch(
"__weight__", &c);
393 tree.Branch(
"v__bo__bc", &v);
394 tree.Branch(
"w", &w);
396 for (
unsigned int i = 0; i < 5; ++i) {
403 target = (i % 2 == 0);
413 general_options.m_variables = {
"a",
"b",
"e__bo__bc",
"f()"};
414 general_options.m_spectators = {
"w",
"v()"};
415 general_options.m_signal_class = 1;
416 general_options.m_datafiles = {
"datafile.root"};
417 general_options.m_treename =
"tree";
418 general_options.m_target_variable =
"g";
419 general_options.m_weight_variable =
"c";
422 EXPECT_EQ(x.getNumberOfFeatures(), 4);
423 EXPECT_EQ(x.getNumberOfSpectators(), 2);
424 EXPECT_EQ(x.getNumberOfEvents(), 5);
428 EXPECT_EQ(x.m_input.size(), 4);
429 EXPECT_FLOAT_EQ(x.m_input[0], 1.0);
430 EXPECT_FLOAT_EQ(x.m_input[1], 1.1);
431 EXPECT_FLOAT_EQ(x.m_input[2], 1.4);
432 EXPECT_FLOAT_EQ(x.m_input[3], 1.5);
433 EXPECT_EQ(x.m_spectators.size(), 2);
434 EXPECT_FLOAT_EQ(x.m_spectators[0], 1.6);
435 EXPECT_FLOAT_EQ(x.m_spectators[1], 1.7);
436 EXPECT_FLOAT_EQ(x.m_weight, 1.2);
437 EXPECT_EQ(x.m_target,
true);
438 EXPECT_EQ(x.m_isSignal,
true);
441 EXPECT_EQ(x.m_input.size(), 4);
442 EXPECT_FLOAT_EQ(x.m_input[0], 2.0);
443 EXPECT_FLOAT_EQ(x.m_input[1], 2.1);
444 EXPECT_FLOAT_EQ(x.m_input[2], 2.4);
445 EXPECT_FLOAT_EQ(x.m_input[3], 2.5);
446 EXPECT_EQ(x.m_spectators.size(), 2);
447 EXPECT_FLOAT_EQ(x.m_spectators[0], 2.6);
448 EXPECT_FLOAT_EQ(x.m_spectators[1], 2.7);
449 EXPECT_FLOAT_EQ(x.m_weight, 2.2);
450 EXPECT_EQ(x.m_target,
false);
451 EXPECT_EQ(x.m_isSignal,
false);
454 EXPECT_EQ(x.m_input.size(), 4);
455 EXPECT_FLOAT_EQ(x.m_input[0], 3.0);
456 EXPECT_FLOAT_EQ(x.m_input[1], 3.1);
457 EXPECT_FLOAT_EQ(x.m_input[2], 3.4);
458 EXPECT_FLOAT_EQ(x.m_input[3], 3.5);
459 EXPECT_EQ(x.m_spectators.size(), 2);
460 EXPECT_FLOAT_EQ(x.m_spectators[0], 3.6);
461 EXPECT_FLOAT_EQ(x.m_spectators[1], 3.7);
462 EXPECT_FLOAT_EQ(x.m_weight, 3.2);
463 EXPECT_EQ(x.m_target,
true);
464 EXPECT_EQ(x.m_isSignal,
true);
467 EXPECT_EQ(x.m_input.size(), 4);
468 EXPECT_FLOAT_EQ(x.m_input[0], 4.0);
469 EXPECT_FLOAT_EQ(x.m_input[1], 4.1);
470 EXPECT_FLOAT_EQ(x.m_input[2], 4.4);
471 EXPECT_FLOAT_EQ(x.m_input[3], 4.5);
472 EXPECT_EQ(x.m_spectators.size(), 2);
473 EXPECT_FLOAT_EQ(x.m_spectators[0], 4.6);
474 EXPECT_FLOAT_EQ(x.m_spectators[1], 4.7);
475 EXPECT_FLOAT_EQ(x.m_weight, 4.2);
476 EXPECT_EQ(x.m_target,
false);
477 EXPECT_EQ(x.m_isSignal,
false);
480 EXPECT_EQ(x.m_input.size(), 4);
481 EXPECT_FLOAT_EQ(x.m_input[0], 5.0);
482 EXPECT_FLOAT_EQ(x.m_input[1], 5.1);
483 EXPECT_FLOAT_EQ(x.m_input[2], 5.4);
484 EXPECT_FLOAT_EQ(x.m_input[3], 5.5);
485 EXPECT_EQ(x.m_spectators.size(), 2);
486 EXPECT_FLOAT_EQ(x.m_spectators[0], 5.6);
487 EXPECT_FLOAT_EQ(x.m_spectators[1], 5.7);
488 EXPECT_FLOAT_EQ(x.m_weight, 5.2);
489 EXPECT_EQ(x.m_target,
true);
490 EXPECT_EQ(x.m_isSignal,
true);
492 EXPECT_FLOAT_EQ(x.getSignalFraction(), 0.6);
494 auto feature = x.getFeature(1);
495 EXPECT_EQ(feature.size(), 5);
496 EXPECT_FLOAT_EQ(feature[0], 1.1);
497 EXPECT_FLOAT_EQ(feature[1], 2.1);
498 EXPECT_FLOAT_EQ(feature[2], 3.1);
499 EXPECT_FLOAT_EQ(feature[3], 4.1);
500 EXPECT_FLOAT_EQ(feature[4], 5.1);
503 feature = x.Dataset::getFeature(1);
504 EXPECT_EQ(feature.size(), 5);
505 EXPECT_FLOAT_EQ(feature[0], 1.1);
506 EXPECT_FLOAT_EQ(feature[1], 2.1);
507 EXPECT_FLOAT_EQ(feature[2], 3.1);
508 EXPECT_FLOAT_EQ(feature[3], 4.1);
509 EXPECT_FLOAT_EQ(feature[4], 5.1);
511 auto spectator = x.getSpectator(1);
512 EXPECT_EQ(spectator.size(), 5);
513 EXPECT_FLOAT_EQ(spectator[0], 1.7);
514 EXPECT_FLOAT_EQ(spectator[1], 2.7);
515 EXPECT_FLOAT_EQ(spectator[2], 3.7);
516 EXPECT_FLOAT_EQ(spectator[3], 4.7);
517 EXPECT_FLOAT_EQ(spectator[4], 5.7);
520 spectator = x.Dataset::getSpectator(1);
521 EXPECT_EQ(spectator.size(), 5);
522 EXPECT_FLOAT_EQ(spectator[0], 1.7);
523 EXPECT_FLOAT_EQ(spectator[1], 2.7);
524 EXPECT_FLOAT_EQ(spectator[2], 3.7);
525 EXPECT_FLOAT_EQ(spectator[3], 4.7);
526 EXPECT_FLOAT_EQ(spectator[4], 5.7);
528 auto weights = x.getWeights();
529 EXPECT_EQ(weights.size(), 5);
530 EXPECT_FLOAT_EQ(weights[0], 1.2);
531 EXPECT_FLOAT_EQ(weights[1], 2.2);
532 EXPECT_FLOAT_EQ(weights[2], 3.2);
533 EXPECT_FLOAT_EQ(weights[3], 4.2);
534 EXPECT_FLOAT_EQ(weights[4], 5.2);
537 weights = x.Dataset::getWeights();
538 EXPECT_EQ(weights.size(), 5);
539 EXPECT_FLOAT_EQ(weights[0], 1.2);
540 EXPECT_FLOAT_EQ(weights[1], 2.2);
541 EXPECT_FLOAT_EQ(weights[2], 3.2);
542 EXPECT_FLOAT_EQ(weights[3], 4.2);
543 EXPECT_FLOAT_EQ(weights[4], 5.2);
545 auto targets = x.getTargets();
546 EXPECT_EQ(targets.size(), 5);
547 EXPECT_EQ(targets[0],
true);
548 EXPECT_EQ(targets[1],
false);
549 EXPECT_EQ(targets[2],
true);
550 EXPECT_EQ(targets[3],
false);
551 EXPECT_EQ(targets[4],
true);
553 auto signals = x.getSignals();
554 EXPECT_EQ(signals.size(), 5);
555 EXPECT_EQ(signals[0],
true);
556 EXPECT_EQ(signals[1],
false);
557 EXPECT_EQ(signals[2],
true);
558 EXPECT_EQ(signals[3],
false);
559 EXPECT_EQ(signals[4],
true);
565 general_options.m_weight_variable =
"__weight__";
568 weights = y.getWeights();
569 EXPECT_EQ(weights.size(), 5);
570 EXPECT_FLOAT_EQ(weights[0], 1.2);
571 EXPECT_FLOAT_EQ(weights[1], 2.2);
572 EXPECT_FLOAT_EQ(weights[2], 3.2);
573 EXPECT_FLOAT_EQ(weights[3], 4.2);
574 EXPECT_FLOAT_EQ(weights[4], 5.2);
577 general_options.m_datafiles = {
"datafile*.root"};
580 EXPECT_EQ(chain_test.getNumberOfEvents(), 5);
582 std::filesystem::copy_file(
"datafile.root",
"datafile2.root");
585 EXPECT_EQ(chain_test.getNumberOfEvents(), 10);
587 std::filesystem::copy_file(
"datafile.root",
"datafile3.root");
590 EXPECT_EQ(chain_test.getNumberOfEvents(), 15);
594 general_options.m_max_events = 10;
596 EXPECT_EQ(chain_test.getNumberOfEvents(), 10);
597 general_options.m_max_events = 0;
601 general_options.m_treename =
"missing tree";
610 general_options.m_treename =
"tree";
611 general_options.m_variables = {
"a",
"b",
"e",
"f",
"missing branch"};
620 general_options.m_treename =
"tree";
621 general_options.m_variables = {
"a",
"b",
"e",
"f"};
622 general_options.m_spectators = {
"missing branch"};
631 general_options.m_spectators = {};
632 general_options.m_datafiles = {
"DOESNOTEXIST.root"};
633 general_options.m_treename =
"tree";
642 general_options.m_datafiles = {
"ISNotAValidROOTFile"};
643 general_options.m_treename =
"tree";
646 std::ofstream(general_options.m_datafiles[0]);
648 EXPECT_TRUE(std::filesystem::exists(general_options.m_datafiles[0]));
659 TEST(DatasetTest, ROOTDatasetMixedTypes)
663 TFile file(
"datafile.root",
"RECREATE");
665 TTree tree(
"tree",
"TreeTitle");
666 double a, c, d, g, v, w = 0;
670 tree.Branch(
"a", &a,
"a/D");
671 tree.Branch(
"b", &b,
"b/F");
672 tree.Branch(
"c", &c,
"c/D");
673 tree.Branch(
"d", &d,
"d/D");
674 tree.Branch(
"e__bo__bc", &e,
"e__bo__bc/I");
675 tree.Branch(
"f__bo__bc", &f,
"f__bo__bc/O");
676 tree.Branch(
"g", &g,
"g/D");
677 tree.Branch(
"__weight__", &c,
"__weight__/D");
678 tree.Branch(
"v__bo__bc", &v,
"v__bo__bc/D");
679 tree.Branch(
"w", &w,
"w/D");
681 for (
unsigned int i = 0; i < 5; ++i) {
688 g = float(i % 2 == 0);
698 general_options.m_variables = {
"a",
"b",
"e__bo__bc",
"f()"};
699 general_options.m_spectators = {
"w",
"v()"};
700 general_options.m_signal_class = 1;
701 general_options.m_datafiles = {
"datafile.root"};
702 general_options.m_treename =
"tree";
703 general_options.m_target_variable =
"g";
704 general_options.m_weight_variable =
"c";
707 EXPECT_EQ(x.getNumberOfFeatures(), 4);
708 EXPECT_EQ(x.getNumberOfSpectators(), 2);
709 EXPECT_EQ(x.getNumberOfEvents(), 5);
713 EXPECT_EQ(x.m_input.size(), 4);
714 EXPECT_FLOAT_EQ(x.m_input[0], 1.0);
715 EXPECT_FLOAT_EQ(x.m_input[1], 1.1);
716 EXPECT_EQ(x.m_input[2], 1);
717 EXPECT_EQ(x.m_input[3],
true);
718 EXPECT_EQ(x.m_spectators.size(), 2);
719 EXPECT_FLOAT_EQ(x.m_spectators[0], 1.6);
720 EXPECT_FLOAT_EQ(x.m_spectators[1], 1.7);
721 EXPECT_FLOAT_EQ(x.m_weight, 1.2);
722 EXPECT_FLOAT_EQ(x.m_target, 1.0);
723 EXPECT_EQ(x.m_isSignal,
true);
726 EXPECT_EQ(x.m_input.size(), 4);
727 EXPECT_FLOAT_EQ(x.m_input[0], 2.0);
728 EXPECT_FLOAT_EQ(x.m_input[1], 2.1);
729 EXPECT_EQ(x.m_input[2], 2);
730 EXPECT_EQ(x.m_input[3],
false);
731 EXPECT_EQ(x.m_spectators.size(), 2);
732 EXPECT_FLOAT_EQ(x.m_spectators[0], 2.6);
733 EXPECT_FLOAT_EQ(x.m_spectators[1], 2.7);
734 EXPECT_FLOAT_EQ(x.m_weight, 2.2);
735 EXPECT_FLOAT_EQ(x.m_target, 0.0);
736 EXPECT_EQ(x.m_isSignal,
false);
739 EXPECT_EQ(x.m_input.size(), 4);
740 EXPECT_FLOAT_EQ(x.m_input[0], 3.0);
741 EXPECT_FLOAT_EQ(x.m_input[1], 3.1);
742 EXPECT_EQ(x.m_input[2], 3);
743 EXPECT_EQ(x.m_input[3],
true);
744 EXPECT_EQ(x.m_spectators.size(), 2);
745 EXPECT_FLOAT_EQ(x.m_spectators[0], 3.6);
746 EXPECT_FLOAT_EQ(x.m_spectators[1], 3.7);
747 EXPECT_FLOAT_EQ(x.m_weight, 3.2);
748 EXPECT_FLOAT_EQ(x.m_target, 1.0);
749 EXPECT_EQ(x.m_isSignal,
true);
752 EXPECT_EQ(x.m_input.size(), 4);
753 EXPECT_FLOAT_EQ(x.m_input[0], 4.0);
754 EXPECT_FLOAT_EQ(x.m_input[1], 4.1);
755 EXPECT_EQ(x.m_input[2], 4);
756 EXPECT_EQ(x.m_input[3],
false);
757 EXPECT_EQ(x.m_spectators.size(), 2);
758 EXPECT_FLOAT_EQ(x.m_spectators[0], 4.6);
759 EXPECT_FLOAT_EQ(x.m_spectators[1], 4.7);
760 EXPECT_FLOAT_EQ(x.m_weight, 4.2);
761 EXPECT_FLOAT_EQ(x.m_target, 0.0);
762 EXPECT_EQ(x.m_isSignal,
false);
765 EXPECT_EQ(x.m_input.size(), 4);
766 EXPECT_FLOAT_EQ(x.m_input[0], 5.0);
767 EXPECT_FLOAT_EQ(x.m_input[1], 5.1);
768 EXPECT_EQ(x.m_input[2], 5);
769 EXPECT_EQ(x.m_input[3],
true);
770 EXPECT_EQ(x.m_spectators.size(), 2);
771 EXPECT_FLOAT_EQ(x.m_spectators[0], 5.6);
772 EXPECT_FLOAT_EQ(x.m_spectators[1], 5.7);
773 EXPECT_FLOAT_EQ(x.m_weight, 5.2);
774 EXPECT_FLOAT_EQ(x.m_target, 1.0);
775 EXPECT_EQ(x.m_isSignal,
true);
777 EXPECT_FLOAT_EQ(x.getSignalFraction(), 0.6);
779 auto feature = x.getFeature(1);
780 EXPECT_EQ(feature.size(), 5);
781 EXPECT_FLOAT_EQ(feature[0], 1.1);
782 EXPECT_FLOAT_EQ(feature[1], 2.1);
783 EXPECT_FLOAT_EQ(feature[2], 3.1);
784 EXPECT_FLOAT_EQ(feature[3], 4.1);
785 EXPECT_FLOAT_EQ(feature[4], 5.1);
788 feature = x.Dataset::getFeature(1);
789 EXPECT_EQ(feature.size(), 5);
790 EXPECT_FLOAT_EQ(feature[0], 1.1);
791 EXPECT_FLOAT_EQ(feature[1], 2.1);
792 EXPECT_FLOAT_EQ(feature[2], 3.1);
793 EXPECT_FLOAT_EQ(feature[3], 4.1);
794 EXPECT_FLOAT_EQ(feature[4], 5.1);
796 auto spectator = x.getSpectator(1);
797 EXPECT_EQ(spectator.size(), 5);
798 EXPECT_FLOAT_EQ(spectator[0], 1.7);
799 EXPECT_FLOAT_EQ(spectator[1], 2.7);
800 EXPECT_FLOAT_EQ(spectator[2], 3.7);
801 EXPECT_FLOAT_EQ(spectator[3], 4.7);
802 EXPECT_FLOAT_EQ(spectator[4], 5.7);
805 spectator = x.Dataset::getSpectator(1);
806 EXPECT_EQ(spectator.size(), 5);
807 EXPECT_FLOAT_EQ(spectator[0], 1.7);
808 EXPECT_FLOAT_EQ(spectator[1], 2.7);
809 EXPECT_FLOAT_EQ(spectator[2], 3.7);
810 EXPECT_FLOAT_EQ(spectator[3], 4.7);
811 EXPECT_FLOAT_EQ(spectator[4], 5.7);
813 auto weights = x.getWeights();
814 EXPECT_EQ(weights.size(), 5);
815 EXPECT_FLOAT_EQ(weights[0], 1.2);
816 EXPECT_FLOAT_EQ(weights[1], 2.2);
817 EXPECT_FLOAT_EQ(weights[2], 3.2);
818 EXPECT_FLOAT_EQ(weights[3], 4.2);
819 EXPECT_FLOAT_EQ(weights[4], 5.2);
822 weights = x.Dataset::getWeights();
823 EXPECT_EQ(weights.size(), 5);
824 EXPECT_FLOAT_EQ(weights[0], 1.2);
825 EXPECT_FLOAT_EQ(weights[1], 2.2);
826 EXPECT_FLOAT_EQ(weights[2], 3.2);
827 EXPECT_FLOAT_EQ(weights[3], 4.2);
828 EXPECT_FLOAT_EQ(weights[4], 5.2);
830 auto targets = x.getTargets();
831 EXPECT_EQ(targets.size(), 5);
832 EXPECT_FLOAT_EQ(targets[0], 1.0);
833 EXPECT_FLOAT_EQ(targets[1], 0.0);
834 EXPECT_FLOAT_EQ(targets[2], 1.0);
835 EXPECT_FLOAT_EQ(targets[3], 0.0);
836 EXPECT_FLOAT_EQ(targets[4], 1.0);
838 auto signals = x.getSignals();
839 EXPECT_EQ(signals.size(), 5);
840 EXPECT_EQ(signals[0],
true);
841 EXPECT_EQ(signals[1],
false);
842 EXPECT_EQ(signals[2],
true);
843 EXPECT_EQ(signals[3],
false);
844 EXPECT_EQ(signals[4],
true);
850 general_options.m_weight_variable =
"__weight__";
853 weights = y.getWeights();
854 EXPECT_EQ(weights.size(), 5);
855 EXPECT_FLOAT_EQ(weights[0], 1.2);
856 EXPECT_FLOAT_EQ(weights[1], 2.2);
857 EXPECT_FLOAT_EQ(weights[2], 3.2);
858 EXPECT_FLOAT_EQ(weights[3], 4.2);
859 EXPECT_FLOAT_EQ(weights[4], 5.2);
862 general_options.m_datafiles = {
"datafile*.root"};
865 EXPECT_EQ(chain_test.getNumberOfEvents(), 5);
867 std::filesystem::copy_file(
"datafile.root",
"datafile2.root");
870 EXPECT_EQ(chain_test.getNumberOfEvents(), 10);
872 std::filesystem::copy_file(
"datafile.root",
"datafile3.root");
875 EXPECT_EQ(chain_test.getNumberOfEvents(), 15);
879 general_options.m_max_events = 10;
881 EXPECT_EQ(chain_test.getNumberOfEvents(), 10);
882 general_options.m_max_events = 0;
886 general_options.m_treename =
"missing tree";
895 general_options.m_treename =
"tree";
896 general_options.m_variables = {
"a",
"b",
"e",
"f",
"missing branch"};
905 general_options.m_treename =
"tree";
906 general_options.m_variables = {
"a",
"b",
"e",
"f"};
907 general_options.m_spectators = {
"missing branch"};
916 general_options.m_spectators = {};
917 general_options.m_datafiles = {
"DOESNOTEXIST.root"};
918 general_options.m_treename =
"tree";
927 general_options.m_datafiles = {
"ISNotAValidROOTFile"};
928 general_options.m_treename =
"tree";
931 std::ofstream(general_options.m_datafiles[0]);
933 EXPECT_TRUE(std::filesystem::exists(general_options.m_datafiles[0]));
943 TEST(DatasetTest, ROOTMultiDataset)
947 TFile file(
"datafile.root",
"RECREATE");
949 TTree tree(
"tree",
"TreeTitle");
950 double a, b, c, d, e, f, v, w = 0;
952 tree.Branch(
"a", &a);
953 tree.Branch(
"b", &b);
954 tree.Branch(
"c", &c);
955 tree.Branch(
"d", &d);
956 tree.Branch(
"e__bo__bc", &e);
957 tree.Branch(
"f__bo__bc", &f);
958 tree.Branch(
"g", &target);
959 tree.Branch(
"__weight__", &c);
960 tree.Branch(
"v__bo__bc", &v);
961 tree.Branch(
"w", &w);
963 for (
unsigned int i = 0; i < 5; ++i) {
970 target = (i % 2 == 0);
978 TFile file2(
"datafile2.root",
"RECREATE");
980 TTree tree2(
"tree",
"TreeTitle");
981 tree2.Branch(
"a", &a);
982 tree2.Branch(
"b", &b);
983 tree2.Branch(
"c", &c);
984 tree2.Branch(
"d", &d);
985 tree2.Branch(
"e__bo__bc", &e);
986 tree2.Branch(
"f__bo__bc", &f);
987 tree2.Branch(
"g", &target);
988 tree2.Branch(
"__weight__", &c);
989 tree2.Branch(
"v__bo__bc", &v);
990 tree2.Branch(
"w", &w);
992 for (
unsigned int i = 0; i < 5; ++i) {
999 target = (i % 2 == 0);
1005 file2.Write(
"tree");
1009 general_options.m_variables = {
"a",
"b",
"e__bo__bc",
"f()"};
1010 general_options.m_spectators = {
"w",
"v()"};
1011 general_options.m_signal_class = 1;
1012 general_options.m_datafiles = {
"datafile.root",
"datafile2.root"};
1013 general_options.m_treename =
"tree";
1014 general_options.m_target_variable =
"g";
1015 general_options.m_weight_variable =
"c";
1018 EXPECT_EQ(x.getNumberOfFeatures(), 4);
1019 EXPECT_EQ(x.getNumberOfSpectators(), 2);
1020 EXPECT_EQ(x.getNumberOfEvents(), 10);
1024 EXPECT_EQ(x.m_input.size(), 4);
1025 EXPECT_FLOAT_EQ(x.m_input[0], 1.0);
1026 EXPECT_FLOAT_EQ(x.m_input[1], 1.1);
1027 EXPECT_FLOAT_EQ(x.m_input[2], 1.4);
1028 EXPECT_FLOAT_EQ(x.m_input[3], 1.5);
1029 EXPECT_EQ(x.m_spectators.size(), 2);
1030 EXPECT_FLOAT_EQ(x.m_spectators[0], 1.6);
1031 EXPECT_FLOAT_EQ(x.m_spectators[1], 1.7);
1032 EXPECT_FLOAT_EQ(x.m_weight, 1.2);
1033 EXPECT_EQ(x.m_target,
true);
1034 EXPECT_EQ(x.m_isSignal,
true);
1037 EXPECT_EQ(x.m_input.size(), 4);
1038 EXPECT_FLOAT_EQ(x.m_input[0], 1.0);
1039 EXPECT_FLOAT_EQ(x.m_input[1], 1.1);
1040 EXPECT_FLOAT_EQ(x.m_input[2], 1.4);
1041 EXPECT_FLOAT_EQ(x.m_input[3], 1.5);
1042 EXPECT_EQ(x.m_spectators.size(), 2);
1043 EXPECT_FLOAT_EQ(x.m_spectators[0], 1.6);
1044 EXPECT_FLOAT_EQ(x.m_spectators[1], 1.7);
1045 EXPECT_FLOAT_EQ(x.m_weight, 1.2);
1046 EXPECT_EQ(x.m_target,
true);
1047 EXPECT_EQ(x.m_isSignal,
true);
1050 EXPECT_EQ(x.m_input.size(), 4);
1051 EXPECT_FLOAT_EQ(x.m_input[0], 2.0);
1052 EXPECT_FLOAT_EQ(x.m_input[1], 2.1);
1053 EXPECT_FLOAT_EQ(x.m_input[2], 2.4);
1054 EXPECT_FLOAT_EQ(x.m_input[3], 2.5);
1055 EXPECT_EQ(x.m_spectators.size(), 2);
1056 EXPECT_FLOAT_EQ(x.m_spectators[0], 2.6);
1057 EXPECT_FLOAT_EQ(x.m_spectators[1], 2.7);
1058 EXPECT_FLOAT_EQ(x.m_weight, 2.2);
1059 EXPECT_EQ(x.m_target,
false);
1060 EXPECT_EQ(x.m_isSignal,
false);
1063 EXPECT_EQ(x.m_input.size(), 4);
1064 EXPECT_FLOAT_EQ(x.m_input[0], 2.0);
1065 EXPECT_FLOAT_EQ(x.m_input[1], 2.1);
1066 EXPECT_FLOAT_EQ(x.m_input[2], 2.4);
1067 EXPECT_FLOAT_EQ(x.m_input[3], 2.5);
1068 EXPECT_EQ(x.m_spectators.size(), 2);
1069 EXPECT_FLOAT_EQ(x.m_spectators[0], 2.6);
1070 EXPECT_FLOAT_EQ(x.m_spectators[1], 2.7);
1071 EXPECT_FLOAT_EQ(x.m_weight, 2.2);
1072 EXPECT_EQ(x.m_target,
false);
1073 EXPECT_EQ(x.m_isSignal,
false);
1076 EXPECT_EQ(x.m_input.size(), 4);
1077 EXPECT_FLOAT_EQ(x.m_input[0], 3.0);
1078 EXPECT_FLOAT_EQ(x.m_input[1], 3.1);
1079 EXPECT_FLOAT_EQ(x.m_input[2], 3.4);
1080 EXPECT_FLOAT_EQ(x.m_input[3], 3.5);
1081 EXPECT_EQ(x.m_spectators.size(), 2);
1082 EXPECT_FLOAT_EQ(x.m_spectators[0], 3.6);
1083 EXPECT_FLOAT_EQ(x.m_spectators[1], 3.7);
1084 EXPECT_FLOAT_EQ(x.m_weight, 3.2);
1085 EXPECT_EQ(x.m_target,
true);
1086 EXPECT_EQ(x.m_isSignal,
true);
1089 EXPECT_EQ(x.m_input.size(), 4);
1090 EXPECT_FLOAT_EQ(x.m_input[0], 3.0);
1091 EXPECT_FLOAT_EQ(x.m_input[1], 3.1);
1092 EXPECT_FLOAT_EQ(x.m_input[2], 3.4);
1093 EXPECT_FLOAT_EQ(x.m_input[3], 3.5);
1094 EXPECT_EQ(x.m_spectators.size(), 2);
1095 EXPECT_FLOAT_EQ(x.m_spectators[0], 3.6);
1096 EXPECT_FLOAT_EQ(x.m_spectators[1], 3.7);
1097 EXPECT_FLOAT_EQ(x.m_weight, 3.2);
1098 EXPECT_EQ(x.m_target,
true);
1099 EXPECT_EQ(x.m_isSignal,
true);
1102 EXPECT_EQ(x.m_input.size(), 4);
1103 EXPECT_FLOAT_EQ(x.m_input[0], 4.0);
1104 EXPECT_FLOAT_EQ(x.m_input[1], 4.1);
1105 EXPECT_FLOAT_EQ(x.m_input[2], 4.4);
1106 EXPECT_FLOAT_EQ(x.m_input[3], 4.5);
1107 EXPECT_EQ(x.m_spectators.size(), 2);
1108 EXPECT_FLOAT_EQ(x.m_spectators[0], 4.6);
1109 EXPECT_FLOAT_EQ(x.m_spectators[1], 4.7);
1110 EXPECT_FLOAT_EQ(x.m_weight, 4.2);
1111 EXPECT_EQ(x.m_target,
false);
1112 EXPECT_EQ(x.m_isSignal,
false);
1115 EXPECT_EQ(x.m_input.size(), 4);
1116 EXPECT_FLOAT_EQ(x.m_input[0], 4.0);
1117 EXPECT_FLOAT_EQ(x.m_input[1], 4.1);
1118 EXPECT_FLOAT_EQ(x.m_input[2], 4.4);
1119 EXPECT_FLOAT_EQ(x.m_input[3], 4.5);
1120 EXPECT_EQ(x.m_spectators.size(), 2);
1121 EXPECT_FLOAT_EQ(x.m_spectators[0], 4.6);
1122 EXPECT_FLOAT_EQ(x.m_spectators[1], 4.7);
1123 EXPECT_FLOAT_EQ(x.m_weight, 4.2);
1124 EXPECT_EQ(x.m_target,
false);
1125 EXPECT_EQ(x.m_isSignal,
false);
1128 EXPECT_EQ(x.m_input.size(), 4);
1129 EXPECT_FLOAT_EQ(x.m_input[0], 5.0);
1130 EXPECT_FLOAT_EQ(x.m_input[1], 5.1);
1131 EXPECT_FLOAT_EQ(x.m_input[2], 5.4);
1132 EXPECT_FLOAT_EQ(x.m_input[3], 5.5);
1133 EXPECT_EQ(x.m_spectators.size(), 2);
1134 EXPECT_FLOAT_EQ(x.m_spectators[0], 5.6);
1135 EXPECT_FLOAT_EQ(x.m_spectators[1], 5.7);
1136 EXPECT_FLOAT_EQ(x.m_weight, 5.2);
1137 EXPECT_EQ(x.m_target,
true);
1138 EXPECT_EQ(x.m_isSignal,
true);
1141 EXPECT_EQ(x.m_input.size(), 4);
1142 EXPECT_FLOAT_EQ(x.m_input[0], 5.0);
1143 EXPECT_FLOAT_EQ(x.m_input[1], 5.1);
1144 EXPECT_FLOAT_EQ(x.m_input[2], 5.4);
1145 EXPECT_FLOAT_EQ(x.m_input[3], 5.5);
1146 EXPECT_EQ(x.m_spectators.size(), 2);
1147 EXPECT_FLOAT_EQ(x.m_spectators[0], 5.6);
1148 EXPECT_FLOAT_EQ(x.m_spectators[1], 5.7);
1149 EXPECT_FLOAT_EQ(x.m_weight, 5.2);
1150 EXPECT_EQ(x.m_target,
true);
1151 EXPECT_EQ(x.m_isSignal,
true);
1153 EXPECT_FLOAT_EQ(x.getSignalFraction(), 0.6);
1155 auto feature = x.getFeature(1);
1156 EXPECT_EQ(feature.size(), 10);
1157 EXPECT_FLOAT_EQ(feature[0], 1.1);
1158 EXPECT_FLOAT_EQ(feature[1], 2.1);
1159 EXPECT_FLOAT_EQ(feature[2], 3.1);
1160 EXPECT_FLOAT_EQ(feature[3], 4.1);
1161 EXPECT_FLOAT_EQ(feature[4], 5.1);
1162 EXPECT_FLOAT_EQ(feature[5], 1.1);
1163 EXPECT_FLOAT_EQ(feature[6], 2.1);
1164 EXPECT_FLOAT_EQ(feature[7], 3.1);
1165 EXPECT_FLOAT_EQ(feature[8], 4.1);
1166 EXPECT_FLOAT_EQ(feature[9], 5.1);
1169 feature = x.Dataset::getFeature(1);
1170 EXPECT_EQ(feature.size(), 10);
1171 EXPECT_FLOAT_EQ(feature[0], 1.1);
1172 EXPECT_FLOAT_EQ(feature[1], 2.1);
1173 EXPECT_FLOAT_EQ(feature[2], 3.1);
1174 EXPECT_FLOAT_EQ(feature[3], 4.1);
1175 EXPECT_FLOAT_EQ(feature[4], 5.1);
1176 EXPECT_FLOAT_EQ(feature[5], 1.1);
1177 EXPECT_FLOAT_EQ(feature[6], 2.1);
1178 EXPECT_FLOAT_EQ(feature[7], 3.1);
1179 EXPECT_FLOAT_EQ(feature[8], 4.1);
1180 EXPECT_FLOAT_EQ(feature[9], 5.1);
1182 auto spectator = x.getSpectator(1);
1183 EXPECT_EQ(spectator.size(), 10);
1184 EXPECT_FLOAT_EQ(spectator[0], 1.7);
1185 EXPECT_FLOAT_EQ(spectator[1], 2.7);
1186 EXPECT_FLOAT_EQ(spectator[2], 3.7);
1187 EXPECT_FLOAT_EQ(spectator[3], 4.7);
1188 EXPECT_FLOAT_EQ(spectator[4], 5.7);
1189 EXPECT_FLOAT_EQ(spectator[5], 1.7);
1190 EXPECT_FLOAT_EQ(spectator[6], 2.7);
1191 EXPECT_FLOAT_EQ(spectator[7], 3.7);
1192 EXPECT_FLOAT_EQ(spectator[8], 4.7);
1193 EXPECT_FLOAT_EQ(spectator[9], 5.7);
1196 spectator = x.Dataset::getSpectator(1);
1197 EXPECT_EQ(spectator.size(), 10);
1198 EXPECT_FLOAT_EQ(spectator[0], 1.7);
1199 EXPECT_FLOAT_EQ(spectator[1], 2.7);
1200 EXPECT_FLOAT_EQ(spectator[2], 3.7);
1201 EXPECT_FLOAT_EQ(spectator[3], 4.7);
1202 EXPECT_FLOAT_EQ(spectator[4], 5.7);
1203 EXPECT_FLOAT_EQ(spectator[5], 1.7);
1204 EXPECT_FLOAT_EQ(spectator[6], 2.7);
1205 EXPECT_FLOAT_EQ(spectator[7], 3.7);
1206 EXPECT_FLOAT_EQ(spectator[8], 4.7);
1207 EXPECT_FLOAT_EQ(spectator[9], 5.7);
1209 auto weights = x.getWeights();
1210 EXPECT_EQ(weights.size(), 10);
1211 EXPECT_FLOAT_EQ(weights[0], 1.2);
1212 EXPECT_FLOAT_EQ(weights[1], 2.2);
1213 EXPECT_FLOAT_EQ(weights[2], 3.2);
1214 EXPECT_FLOAT_EQ(weights[3], 4.2);
1215 EXPECT_FLOAT_EQ(weights[4], 5.2);
1216 EXPECT_FLOAT_EQ(weights[5], 1.2);
1217 EXPECT_FLOAT_EQ(weights[6], 2.2);
1218 EXPECT_FLOAT_EQ(weights[7], 3.2);
1219 EXPECT_FLOAT_EQ(weights[8], 4.2);
1220 EXPECT_FLOAT_EQ(weights[9], 5.2);
1223 weights = x.Dataset::getWeights();
1224 EXPECT_EQ(weights.size(), 10);
1225 EXPECT_FLOAT_EQ(weights[0], 1.2);
1226 EXPECT_FLOAT_EQ(weights[1], 2.2);
1227 EXPECT_FLOAT_EQ(weights[2], 3.2);
1228 EXPECT_FLOAT_EQ(weights[3], 4.2);
1229 EXPECT_FLOAT_EQ(weights[4], 5.2);
1230 EXPECT_FLOAT_EQ(weights[5], 1.2);
1231 EXPECT_FLOAT_EQ(weights[6], 2.2);
1232 EXPECT_FLOAT_EQ(weights[7], 3.2);
1233 EXPECT_FLOAT_EQ(weights[8], 4.2);
1234 EXPECT_FLOAT_EQ(weights[9], 5.2);
1236 auto targets = x.getTargets();
1237 EXPECT_EQ(targets.size(), 10);
1238 EXPECT_EQ(targets[0],
true);
1239 EXPECT_EQ(targets[1],
false);
1240 EXPECT_EQ(targets[2],
true);
1241 EXPECT_EQ(targets[3],
false);
1242 EXPECT_EQ(targets[4],
true);
1243 EXPECT_EQ(targets[5],
true);
1244 EXPECT_EQ(targets[6],
false);
1245 EXPECT_EQ(targets[7],
true);
1246 EXPECT_EQ(targets[8],
false);
1247 EXPECT_EQ(targets[9],
true);
1249 auto signals = x.getSignals();
1250 EXPECT_EQ(signals.size(), 10);
1251 EXPECT_EQ(signals[0],
true);
1252 EXPECT_EQ(signals[1],
false);
1253 EXPECT_EQ(signals[2],
true);
1254 EXPECT_EQ(signals[3],
false);
1255 EXPECT_EQ(signals[4],
true);
1256 EXPECT_EQ(signals[5],
true);
1257 EXPECT_EQ(signals[6],
false);
1258 EXPECT_EQ(signals[7],
true);
1259 EXPECT_EQ(signals[8],
false);
1260 EXPECT_EQ(signals[9],
true);
1266 general_options.m_weight_variable =
"__weight__";
1269 weights = y.getWeights();
1270 EXPECT_EQ(weights.size(), 10);
1271 EXPECT_FLOAT_EQ(weights[0], 1.2);
1272 EXPECT_FLOAT_EQ(weights[1], 2.2);
1273 EXPECT_FLOAT_EQ(weights[2], 3.2);
1274 EXPECT_FLOAT_EQ(weights[3], 4.2);
1275 EXPECT_FLOAT_EQ(weights[4], 5.2);
1276 EXPECT_FLOAT_EQ(weights[5], 1.2);
1277 EXPECT_FLOAT_EQ(weights[6], 2.2);
1278 EXPECT_FLOAT_EQ(weights[7], 3.2);
1279 EXPECT_FLOAT_EQ(weights[8], 4.2);
1280 EXPECT_FLOAT_EQ(weights[9], 5.2);
1283 general_options.m_datafiles = {
"datafile*.root"};
1286 EXPECT_EQ(chain_test.getNumberOfEvents(), 10);
1288 std::filesystem::copy_file(
"datafile.root",
"datafile3.root");
1291 EXPECT_EQ(chain_test.getNumberOfEvents(), 15);
1293 std::filesystem::copy_file(
"datafile.root",
"datafile4.root");
1296 EXPECT_EQ(chain_test.getNumberOfEvents(), 20);
1300 general_options.m_max_events = 10;
1302 EXPECT_EQ(chain_test.getNumberOfEvents(), 10);
1303 general_options.m_max_events = 0;
1308 std::filesystem::copy_file(
"datafile.root",
"datafile*.root");
1310 general_options.m_max_events = 0;
1312 EXPECT_EQ(chain_test.getNumberOfEvents(), 5);
1316 TEST(DatasetTest, ROOTMultiDatasetDouble)
1320 TFile file(
"datafile.root",
"RECREATE");
1322 TTree tree(
"tree",
"TreeTitle");
1323 double a, b, c, d, e, f, g, v, w = 0;
1324 tree.Branch(
"a", &a,
"a/D");
1325 tree.Branch(
"b", &b,
"b/D");
1326 tree.Branch(
"c", &c,
"c/D");
1327 tree.Branch(
"d", &d,
"d/D");
1328 tree.Branch(
"e__bo__bc", &e,
"e__bo__bc/D");
1329 tree.Branch(
"f__bo__bc", &f,
"f__bo__bc/D");
1330 tree.Branch(
"g", &g,
"g/D");
1331 tree.Branch(
"__weight__", &c,
"__weight__/D");
1332 tree.Branch(
"v__bo__bc", &v,
"v__bo__bc/D");
1333 tree.Branch(
"w", &w,
"w/D");
1335 for (
unsigned int i = 0; i < 5; ++i) {
1342 g = float(i % 2 == 0);
1350 TFile file2(
"datafile2.root",
"RECREATE");
1352 TTree tree2(
"tree",
"TreeTitle");
1353 tree2.Branch(
"a", &a);
1354 tree2.Branch(
"b", &b);
1355 tree2.Branch(
"c", &c);
1356 tree2.Branch(
"d", &d);
1357 tree2.Branch(
"e__bo__bc", &e);
1358 tree2.Branch(
"f__bo__bc", &f);
1359 tree2.Branch(
"g", &g);
1360 tree2.Branch(
"__weight__", &c);
1361 tree2.Branch(
"v__bo__bc", &v);
1362 tree2.Branch(
"w", &w);
1364 for (
unsigned int i = 0; i < 5; ++i) {
1371 g = float(i % 2 == 0);
1377 file2.Write(
"tree");
1381 general_options.m_variables = {
"a",
"b",
"e__bo__bc",
"f()"};
1382 general_options.m_spectators = {
"w",
"v()"};
1383 general_options.m_signal_class = 1;
1384 general_options.m_datafiles = {
"datafile.root",
"datafile2.root"};
1385 general_options.m_treename =
"tree";
1386 general_options.m_target_variable =
"g";
1387 general_options.m_weight_variable =
"c";
1390 EXPECT_EQ(x.getNumberOfFeatures(), 4);
1391 EXPECT_EQ(x.getNumberOfSpectators(), 2);
1392 EXPECT_EQ(x.getNumberOfEvents(), 10);
1396 EXPECT_EQ(x.m_input.size(), 4);
1397 EXPECT_FLOAT_EQ(x.m_input[0], 1.0);
1398 EXPECT_FLOAT_EQ(x.m_input[1], 1.1);
1399 EXPECT_FLOAT_EQ(x.m_input[2], 1.4);
1400 EXPECT_FLOAT_EQ(x.m_input[3], 1.5);
1401 EXPECT_EQ(x.m_spectators.size(), 2);
1402 EXPECT_FLOAT_EQ(x.m_spectators[0], 1.6);
1403 EXPECT_FLOAT_EQ(x.m_spectators[1], 1.7);
1404 EXPECT_FLOAT_EQ(x.m_weight, 1.2);
1405 EXPECT_FLOAT_EQ(x.m_target, 1.0);
1406 EXPECT_EQ(x.m_isSignal,
true);
1409 EXPECT_EQ(x.m_input.size(), 4);
1410 EXPECT_FLOAT_EQ(x.m_input[0], 1.0);
1411 EXPECT_FLOAT_EQ(x.m_input[1], 1.1);
1412 EXPECT_FLOAT_EQ(x.m_input[2], 1.4);
1413 EXPECT_FLOAT_EQ(x.m_input[3], 1.5);
1414 EXPECT_EQ(x.m_spectators.size(), 2);
1415 EXPECT_FLOAT_EQ(x.m_spectators[0], 1.6);
1416 EXPECT_FLOAT_EQ(x.m_spectators[1], 1.7);
1417 EXPECT_FLOAT_EQ(x.m_weight, 1.2);
1418 EXPECT_FLOAT_EQ(x.m_target, 1.0);
1419 EXPECT_EQ(x.m_isSignal,
true);
1422 EXPECT_EQ(x.m_input.size(), 4);
1423 EXPECT_FLOAT_EQ(x.m_input[0], 2.0);
1424 EXPECT_FLOAT_EQ(x.m_input[1], 2.1);
1425 EXPECT_FLOAT_EQ(x.m_input[2], 2.4);
1426 EXPECT_FLOAT_EQ(x.m_input[3], 2.5);
1427 EXPECT_EQ(x.m_spectators.size(), 2);
1428 EXPECT_FLOAT_EQ(x.m_spectators[0], 2.6);
1429 EXPECT_FLOAT_EQ(x.m_spectators[1], 2.7);
1430 EXPECT_FLOAT_EQ(x.m_weight, 2.2);
1431 EXPECT_FLOAT_EQ(x.m_target, 0.0);
1432 EXPECT_EQ(x.m_isSignal,
false);
1435 EXPECT_EQ(x.m_input.size(), 4);
1436 EXPECT_FLOAT_EQ(x.m_input[0], 2.0);
1437 EXPECT_FLOAT_EQ(x.m_input[1], 2.1);
1438 EXPECT_FLOAT_EQ(x.m_input[2], 2.4);
1439 EXPECT_FLOAT_EQ(x.m_input[3], 2.5);
1440 EXPECT_EQ(x.m_spectators.size(), 2);
1441 EXPECT_FLOAT_EQ(x.m_spectators[0], 2.6);
1442 EXPECT_FLOAT_EQ(x.m_spectators[1], 2.7);
1443 EXPECT_FLOAT_EQ(x.m_weight, 2.2);
1444 EXPECT_FLOAT_EQ(x.m_target, 0.0);
1445 EXPECT_EQ(x.m_isSignal,
false);
1448 EXPECT_EQ(x.m_input.size(), 4);
1449 EXPECT_FLOAT_EQ(x.m_input[0], 3.0);
1450 EXPECT_FLOAT_EQ(x.m_input[1], 3.1);
1451 EXPECT_FLOAT_EQ(x.m_input[2], 3.4);
1452 EXPECT_FLOAT_EQ(x.m_input[3], 3.5);
1453 EXPECT_EQ(x.m_spectators.size(), 2);
1454 EXPECT_FLOAT_EQ(x.m_spectators[0], 3.6);
1455 EXPECT_FLOAT_EQ(x.m_spectators[1], 3.7);
1456 EXPECT_FLOAT_EQ(x.m_weight, 3.2);
1457 EXPECT_FLOAT_EQ(x.m_target, 1.0);
1458 EXPECT_EQ(x.m_isSignal,
true);
1461 EXPECT_EQ(x.m_input.size(), 4);
1462 EXPECT_FLOAT_EQ(x.m_input[0], 3.0);
1463 EXPECT_FLOAT_EQ(x.m_input[1], 3.1);
1464 EXPECT_FLOAT_EQ(x.m_input[2], 3.4);
1465 EXPECT_FLOAT_EQ(x.m_input[3], 3.5);
1466 EXPECT_EQ(x.m_spectators.size(), 2);
1467 EXPECT_FLOAT_EQ(x.m_spectators[0], 3.6);
1468 EXPECT_FLOAT_EQ(x.m_spectators[1], 3.7);
1469 EXPECT_FLOAT_EQ(x.m_weight, 3.2);
1470 EXPECT_FLOAT_EQ(x.m_target, 1.0);
1471 EXPECT_EQ(x.m_isSignal,
true);
1474 EXPECT_EQ(x.m_input.size(), 4);
1475 EXPECT_FLOAT_EQ(x.m_input[0], 4.0);
1476 EXPECT_FLOAT_EQ(x.m_input[1], 4.1);
1477 EXPECT_FLOAT_EQ(x.m_input[2], 4.4);
1478 EXPECT_FLOAT_EQ(x.m_input[3], 4.5);
1479 EXPECT_EQ(x.m_spectators.size(), 2);
1480 EXPECT_FLOAT_EQ(x.m_spectators[0], 4.6);
1481 EXPECT_FLOAT_EQ(x.m_spectators[1], 4.7);
1482 EXPECT_FLOAT_EQ(x.m_weight, 4.2);
1483 EXPECT_FLOAT_EQ(x.m_target, 0.0);
1484 EXPECT_EQ(x.m_isSignal,
false);
1487 EXPECT_EQ(x.m_input.size(), 4);
1488 EXPECT_FLOAT_EQ(x.m_input[0], 4.0);
1489 EXPECT_FLOAT_EQ(x.m_input[1], 4.1);
1490 EXPECT_FLOAT_EQ(x.m_input[2], 4.4);
1491 EXPECT_FLOAT_EQ(x.m_input[3], 4.5);
1492 EXPECT_EQ(x.m_spectators.size(), 2);
1493 EXPECT_FLOAT_EQ(x.m_spectators[0], 4.6);
1494 EXPECT_FLOAT_EQ(x.m_spectators[1], 4.7);
1495 EXPECT_FLOAT_EQ(x.m_weight, 4.2);
1496 EXPECT_FLOAT_EQ(x.m_target, 0.0);
1497 EXPECT_EQ(x.m_isSignal,
false);
1500 EXPECT_EQ(x.m_input.size(), 4);
1501 EXPECT_FLOAT_EQ(x.m_input[0], 5.0);
1502 EXPECT_FLOAT_EQ(x.m_input[1], 5.1);
1503 EXPECT_FLOAT_EQ(x.m_input[2], 5.4);
1504 EXPECT_FLOAT_EQ(x.m_input[3], 5.5);
1505 EXPECT_EQ(x.m_spectators.size(), 2);
1506 EXPECT_FLOAT_EQ(x.m_spectators[0], 5.6);
1507 EXPECT_FLOAT_EQ(x.m_spectators[1], 5.7);
1508 EXPECT_FLOAT_EQ(x.m_weight, 5.2);
1509 EXPECT_FLOAT_EQ(x.m_target, 1.0);
1510 EXPECT_EQ(x.m_isSignal,
true);
1513 EXPECT_EQ(x.m_input.size(), 4);
1514 EXPECT_FLOAT_EQ(x.m_input[0], 5.0);
1515 EXPECT_FLOAT_EQ(x.m_input[1], 5.1);
1516 EXPECT_FLOAT_EQ(x.m_input[2], 5.4);
1517 EXPECT_FLOAT_EQ(x.m_input[3], 5.5);
1518 EXPECT_EQ(x.m_spectators.size(), 2);
1519 EXPECT_FLOAT_EQ(x.m_spectators[0], 5.6);
1520 EXPECT_FLOAT_EQ(x.m_spectators[1], 5.7);
1521 EXPECT_FLOAT_EQ(x.m_weight, 5.2);
1522 EXPECT_FLOAT_EQ(x.m_target, 1.0);
1523 EXPECT_EQ(x.m_isSignal,
true);
1525 EXPECT_FLOAT_EQ(x.getSignalFraction(), 0.6);
1527 auto feature = x.getFeature(1);
1528 EXPECT_EQ(feature.size(), 10);
1529 EXPECT_FLOAT_EQ(feature[0], 1.1);
1530 EXPECT_FLOAT_EQ(feature[1], 2.1);
1531 EXPECT_FLOAT_EQ(feature[2], 3.1);
1532 EXPECT_FLOAT_EQ(feature[3], 4.1);
1533 EXPECT_FLOAT_EQ(feature[4], 5.1);
1534 EXPECT_FLOAT_EQ(feature[5], 1.1);
1535 EXPECT_FLOAT_EQ(feature[6], 2.1);
1536 EXPECT_FLOAT_EQ(feature[7], 3.1);
1537 EXPECT_FLOAT_EQ(feature[8], 4.1);
1538 EXPECT_FLOAT_EQ(feature[9], 5.1);
1541 feature = x.Dataset::getFeature(1);
1542 EXPECT_EQ(feature.size(), 10);
1543 EXPECT_FLOAT_EQ(feature[0], 1.1);
1544 EXPECT_FLOAT_EQ(feature[1], 2.1);
1545 EXPECT_FLOAT_EQ(feature[2], 3.1);
1546 EXPECT_FLOAT_EQ(feature[3], 4.1);
1547 EXPECT_FLOAT_EQ(feature[4], 5.1);
1548 EXPECT_FLOAT_EQ(feature[5], 1.1);
1549 EXPECT_FLOAT_EQ(feature[6], 2.1);
1550 EXPECT_FLOAT_EQ(feature[7], 3.1);
1551 EXPECT_FLOAT_EQ(feature[8], 4.1);
1552 EXPECT_FLOAT_EQ(feature[9], 5.1);
1554 auto spectator = x.getSpectator(1);
1555 EXPECT_EQ(spectator.size(), 10);
1556 EXPECT_FLOAT_EQ(spectator[0], 1.7);
1557 EXPECT_FLOAT_EQ(spectator[1], 2.7);
1558 EXPECT_FLOAT_EQ(spectator[2], 3.7);
1559 EXPECT_FLOAT_EQ(spectator[3], 4.7);
1560 EXPECT_FLOAT_EQ(spectator[4], 5.7);
1561 EXPECT_FLOAT_EQ(spectator[5], 1.7);
1562 EXPECT_FLOAT_EQ(spectator[6], 2.7);
1563 EXPECT_FLOAT_EQ(spectator[7], 3.7);
1564 EXPECT_FLOAT_EQ(spectator[8], 4.7);
1565 EXPECT_FLOAT_EQ(spectator[9], 5.7);
1568 spectator = x.Dataset::getSpectator(1);
1569 EXPECT_EQ(spectator.size(), 10);
1570 EXPECT_FLOAT_EQ(spectator[0], 1.7);
1571 EXPECT_FLOAT_EQ(spectator[1], 2.7);
1572 EXPECT_FLOAT_EQ(spectator[2], 3.7);
1573 EXPECT_FLOAT_EQ(spectator[3], 4.7);
1574 EXPECT_FLOAT_EQ(spectator[4], 5.7);
1575 EXPECT_FLOAT_EQ(spectator[5], 1.7);
1576 EXPECT_FLOAT_EQ(spectator[6], 2.7);
1577 EXPECT_FLOAT_EQ(spectator[7], 3.7);
1578 EXPECT_FLOAT_EQ(spectator[8], 4.7);
1579 EXPECT_FLOAT_EQ(spectator[9], 5.7);
1581 auto weights = x.getWeights();
1582 EXPECT_EQ(weights.size(), 10);
1583 EXPECT_FLOAT_EQ(weights[0], 1.2);
1584 EXPECT_FLOAT_EQ(weights[1], 2.2);
1585 EXPECT_FLOAT_EQ(weights[2], 3.2);
1586 EXPECT_FLOAT_EQ(weights[3], 4.2);
1587 EXPECT_FLOAT_EQ(weights[4], 5.2);
1588 EXPECT_FLOAT_EQ(weights[5], 1.2);
1589 EXPECT_FLOAT_EQ(weights[6], 2.2);
1590 EXPECT_FLOAT_EQ(weights[7], 3.2);
1591 EXPECT_FLOAT_EQ(weights[8], 4.2);
1592 EXPECT_FLOAT_EQ(weights[9], 5.2);
1595 weights = x.Dataset::getWeights();
1596 EXPECT_EQ(weights.size(), 10);
1597 EXPECT_FLOAT_EQ(weights[0], 1.2);
1598 EXPECT_FLOAT_EQ(weights[1], 2.2);
1599 EXPECT_FLOAT_EQ(weights[2], 3.2);
1600 EXPECT_FLOAT_EQ(weights[3], 4.2);
1601 EXPECT_FLOAT_EQ(weights[4], 5.2);
1602 EXPECT_FLOAT_EQ(weights[5], 1.2);
1603 EXPECT_FLOAT_EQ(weights[6], 2.2);
1604 EXPECT_FLOAT_EQ(weights[7], 3.2);
1605 EXPECT_FLOAT_EQ(weights[8], 4.2);
1606 EXPECT_FLOAT_EQ(weights[9], 5.2);
1608 auto targets = x.getTargets();
1609 EXPECT_EQ(targets.size(), 10);
1610 EXPECT_FLOAT_EQ(targets[0], 1.0);
1611 EXPECT_FLOAT_EQ(targets[1], 0.0);
1612 EXPECT_FLOAT_EQ(targets[2], 1.0);
1613 EXPECT_FLOAT_EQ(targets[3], 0.0);
1614 EXPECT_FLOAT_EQ(targets[4], 1.0);
1615 EXPECT_FLOAT_EQ(targets[5], 1.0);
1616 EXPECT_FLOAT_EQ(targets[6], 0.0);
1617 EXPECT_FLOAT_EQ(targets[7], 1.0);
1618 EXPECT_FLOAT_EQ(targets[8], 0.0);
1619 EXPECT_FLOAT_EQ(targets[9], 1.0);
1621 auto signals = x.getSignals();
1622 EXPECT_EQ(signals.size(), 10);
1623 EXPECT_EQ(signals[0],
true);
1624 EXPECT_EQ(signals[1],
false);
1625 EXPECT_EQ(signals[2],
true);
1626 EXPECT_EQ(signals[3],
false);
1627 EXPECT_EQ(signals[4],
true);
1628 EXPECT_EQ(signals[5],
true);
1629 EXPECT_EQ(signals[6],
false);
1630 EXPECT_EQ(signals[7],
true);
1631 EXPECT_EQ(signals[8],
false);
1632 EXPECT_EQ(signals[9],
true);
1638 general_options.m_weight_variable =
"__weight__";
1641 weights = y.getWeights();
1642 EXPECT_EQ(weights.size(), 10);
1643 EXPECT_FLOAT_EQ(weights[0], 1.2);
1644 EXPECT_FLOAT_EQ(weights[1], 2.2);
1645 EXPECT_FLOAT_EQ(weights[2], 3.2);
1646 EXPECT_FLOAT_EQ(weights[3], 4.2);
1647 EXPECT_FLOAT_EQ(weights[4], 5.2);
1648 EXPECT_FLOAT_EQ(weights[5], 1.2);
1649 EXPECT_FLOAT_EQ(weights[6], 2.2);
1650 EXPECT_FLOAT_EQ(weights[7], 3.2);
1651 EXPECT_FLOAT_EQ(weights[8], 4.2);
1652 EXPECT_FLOAT_EQ(weights[9], 5.2);
1655 general_options.m_datafiles = {
"datafile*.root"};
1658 EXPECT_EQ(chain_test.getNumberOfEvents(), 10);
1660 std::filesystem::copy_file(
"datafile.root",
"datafile3.root");
1663 EXPECT_EQ(chain_test.getNumberOfEvents(), 15);
1665 std::filesystem::copy_file(
"datafile.root",
"datafile4.root");
1668 EXPECT_EQ(chain_test.getNumberOfEvents(), 20);
1672 general_options.m_max_events = 10;
1674 EXPECT_EQ(chain_test.getNumberOfEvents(), 10);
1675 general_options.m_max_events = 0;
1680 std::filesystem::copy_file(
"datafile.root",
"datafile*.root");
1682 general_options.m_max_events = 0;
1684 EXPECT_EQ(chain_test.getNumberOfEvents(), 5);
Wraps two other Datasets, one containing signal, the other background events Used by the reweighting ...
Abstract base class of all Datasets given to the MVA interface The current event can always be access...
virtual unsigned int getNumberOfEvents() const =0
Returns the number of events in this dataset.
virtual unsigned int getNumberOfSpectators() const =0
Returns the number of spectators in this dataset.
virtual unsigned int getNumberOfFeatures() const =0
Returns the number of features in this dataset.
virtual std::vector< float > getSpectator(unsigned int iSpectator)
Returns all values of one spectator in a std::vector<float>
virtual void loadEvent(unsigned int iEvent)=0
Load the event number iEvent.
virtual std::vector< float > getFeature(unsigned int iFeature)
Returns all values of one feature in a std::vector<float>
virtual float getSignalFraction()
Returns the signal fraction of the whole sample.
General options which are shared by all MVA trainings.
Wraps the data of a multiple event into a Dataset.
Proivdes a dataset from a ROOT file This is the usually used dataset providing training data to the m...
Wraps the data of a single event into a Dataset.
Wraps another Dataset and provides a view to a subset of its features and events.
changes working directory into a newly created directory, and removes it (and contents) on destructio...
Abstract base class for different kinds of events.