ROOT
master
Reference Guide
Loading...
Searching...
No Matches
tmva002_RDataFrameAsTensor.C
Go to the documentation of this file.
1
/// \file
2
/// \ingroup tutorial_ml
3
/// \notebook -nodraw
4
/// This tutorial shows how the content of an RDataFrame can be converted to an
5
/// RTensor object.
6
///
7
/// \macro_code
8
/// \macro_output
9
///
10
/// \date December 2018
11
/// \author Stefan Wunsch
12
13
using namespace
TMVA::Experimental
;
14
15
void
tmva002_RDataFrameAsTensor
()
16
{
17
// Creation of an RDataFrame with five entries filled with ascending numbers
18
ROOT::RDataFrame
df(5);
19
auto
df2
= df.Define(
"x"
,
"1.f*rdfentry_"
).Define(
"y"
,
"-1.f*rdfentry_"
);
20
21
// Convert content of columns to an RTensor object
22
auto
x
=
AsTensor<float>
(
df2
);
23
24
std::cout <<
"RTensor from an RDataFrame:\n"
<<
x
<<
"\n\n"
;
25
26
// The utility also supports reading only a part of the RDataFrame and different
27
// memory layouts.
28
auto
x2
=
AsTensor<float>
(
df2
, {
"x"
}, MemoryLayout::ColumnMajor);
29
30
std::cout <<
"RTensor from a single column of the RDataFrame:\n"
<<
x2
<<
"\n\n"
;
31
}
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:358
x2
Option_t Option_t TPoint TPoint const char x2
Definition
TGWin32VirtualXProxy.cxx:70
ROOT::Detail::TRangeCast
Definition
TCollection.h:311
ROOT::RDataFrame
ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree ,...
Definition
RDataFrame.hxx:41
x
Double_t x[n]
Definition
legend1.C:17
TMVA::Experimental
Definition
RModelParser_Keras.h:40
df101_h1Analysis.df
df
Definition
df101_h1Analysis.py:115
tutorials
machine_learning
tmva002_RDataFrameAsTensor.C
ROOT master - Reference Guide Generated on Thu Sep 4 2025 04:29:33 (GVA Time) using Doxygen 1.10.0