Skip to content

Commit

Permalink
Merge pull request #6 from jpbarbosa/master
Browse files Browse the repository at this point in the history
fann_get_MSE method added
  • Loading branch information
rlidwka committed Aug 1, 2013
2 parents 269a06a + 373271a commit ce4a85d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/fann-accs.cc
Expand Up @@ -178,6 +178,15 @@ Handle<Value> NNet::ActivationFunctionOutput(const Arguments &args)
}
}

Handle<Value> NNet::GetMse(const Arguments &args)
{
HandleScope scope;
NNet *net = ObjectWrap::Unwrap<NNet>(args.This());

float ret = fann_get_MSE(net->FANN);
return scope.Close(Number::New(ret));
}

Handle<Value> NNet::GetNumInput(const Arguments &args)
{
HandleScope scope;
Expand Down
3 changes: 2 additions & 1 deletion src/fann.cc
Expand Up @@ -32,6 +32,7 @@ void NNet::PrototypeInit(Local<FunctionTemplate> t)
NODE_SET_PROTOTYPE_METHOD(t, "activation_function_hidden", ActivationFunctionHidden);
NODE_SET_PROTOTYPE_METHOD(t, "activation_function_output", ActivationFunctionOutput);
NODE_SET_PROTOTYPE_METHOD(t, "get_num_input", GetNumInput);
NODE_SET_PROTOTYPE_METHOD(t, "get_MSE", GetMse);
NODE_SET_PROTOTYPE_METHOD(t, "get_num_output", GetNumOutput);
NODE_SET_PROTOTYPE_METHOD(t, "get_total_neurons", GetTotalNeurons);
NODE_SET_PROTOTYPE_METHOD(t, "get_total_connections", GetTotalConnections);
Expand Down Expand Up @@ -86,4 +87,4 @@ extern "C" void init (Handle<Object> target)

#ifdef NODE_MODULE
NODE_MODULE(fann, init)
#endif
#endif
1 change: 1 addition & 0 deletions src/node-fann.h
Expand Up @@ -30,6 +30,7 @@ class NNet : public ObjectWrap
static Handle<Value> ActivationFunctionOutput(const Arguments &args);
static Handle<Value> GetNumInput(const Arguments &args);
static Handle<Value> GetNumOutput(const Arguments &args);
static Handle<Value> GetMse(const Arguments &args);
static Handle<Value> GetTotalNeurons(const Arguments &args);
static Handle<Value> GetTotalConnections(const Arguments &args);
static Handle<Value> GetNetworkType(const Arguments &args);
Expand Down

0 comments on commit ce4a85d

Please sign in to comment.