8 #include "../../../util/utils.h"
23 for (
int i = 0;
i <
arity[
'f'];
i++) {
35 ArrayXf x1 = state.
pop<
float>();
36 ArrayXf x2 = state.
pop<
float>();
39 + pow(
W[1]*(x2 - x2.mean()), 2)/
variance(x2)))));
49 state.copy_to_host(x1.data(), (state.idx[
'f']-1)*state.N);
50 state.copy_to_host(x2.data(), (state.idx[
'f']-2)*state.N);
52 float x1mean = x1.mean();
53 float x2mean = x2.mean();
59 (
float)x1mean, (
float)x1var,
60 (
float)x2mean, (
float)x2var,
61 (
float)
W[0], (
float)
W[1], state.N);
68 state.
push<
float>(
"gauss2d(" +state.
popStr<
float>()+
"," +state.
popStr<
float>()+
")");
73 ArrayXf& x = state.
get<
float>()[state.
size<
float>()-1];
77 return -2 *
W[0] * pow(x, 2) * exp(-pow(
W[0] * x, 2));
80 return -2 * pow(
W[0], 2) * x * exp(-pow(
W[0] * x, 2));
data holding X, y, and Z data
Node2dGaussian * clone_impl() const override
Node2dGaussian * rnd_clone_impl() const override
Node2dGaussian(vector< float > W0=vector< float >())
void evaluate(const Data &data, State &state)
Evaluates the node and updates the state states.
ArrayXf getDerivative(Trace &state, int loc)
void eval_eqn(State &state)
Evaluates the node symbolically.
std::map< char, unsigned int > arity
arity of the operator
ArrayXf limited(ArrayXf x)
limits node output to be between MIN_FLT and MAX_FLT
int complexity
complexity of node
float rnd_dbl(float min=0.0, float max=1.0)
void GPU_Gaussian2D(float *x, size_t idx, float x1mean, float x1var, float x2mean, float x2var, float W0, float W1, size_t N)
float variance(const ArrayXf &v, float mean)
calculate variance when mean provided
contains various types of State actually used by feat
Eigen::Array< T, Eigen::Dynamic, 1 > pop()
void push(Eigen::Array< T, Eigen::Dynamic, 1 > value)
used for tracing stack outputs for backprop algorithm.
vector< Eigen::Array< T, Eigen::Dynamic, 1 > > & get()