25 template<
typename AFloat>
34 auto f = [&dataY, &dataOutput, &temp](
UInt_t workerID)
36 AFloat dy = dataY[workerID] - dataOutput[workerID];
37 temp[workerID] = dy * dy;
41 auto reduction = [](AFloat sum1, AFloat sum2)
51 template<
typename AFloat>
63 auto f = [&dataDY, &dataY, &dataOutput,
norm](
UInt_t workerID)
65 dataDY[workerID] = - 2.0 * norm * (dataY[workerID] - dataOutput[workerID]);
73 template<
typename AFloat>
82 auto f = [&dataY, &dataOutput, &temp](
UInt_t workerID)
84 AFloat
y = dataY[workerID];
85 AFloat sig = 1.0 / (1.0 +
exp(- dataOutput[workerID]));
86 temp[workerID] = - (y *
log(sig) + (1.0 -
y) *
log(1.0 - sig));
90 auto reduction = [](AFloat sum1, AFloat sum2)
100 template<
typename AFloat>
111 auto f = [&dataDY, &dataY, &dataOutput,
norm](
UInt_t workerID)
113 AFloat
y = dataY[workerID];
114 AFloat sig = 1.0 / (1.0 +
exp(- dataOutput[workerID]));
115 dataDY[workerID] = norm * (sig -
y);
static Scalar_t MeanSquaredError(const TCpuMatrix< Scalar_t > &Y, const TCpuMatrix< Scalar_t > &output)
ROOT::TThreadExecutor & GetThreadExecutor() const
static void CrossEntropyGradients(TCpuMatrix< Scalar_t > &dY, const TCpuMatrix< Scalar_t > &Y, const TCpuMatrix< Scalar_t > &output)
static void MeanSquaredErrorGradients(TCpuMatrix< Scalar_t > &dY, const TCpuMatrix< Scalar_t > &Y, const TCpuMatrix< Scalar_t > &output)
AFloat * GetRawDataPointer()
Return raw pointer to the elements stored contiguously in column-major order.
size_t GetNElements() const
A pseudo container class which is a generator of indices.
Abstract ClassifierFactory template that handles arbitrary types.
static void output(int code)
double norm(double *x, double *p)
static Scalar_t CrossEntropy(const TCpuMatrix< Scalar_t > &Y, const TCpuMatrix< Scalar_t > &output)
Sigmoid transformation is implicitly applied, thus output should hold the linear activations of the l...