https://github.com/perdumonocle/neuralnet2cpp
Compute your R 'neuralnet' neural network using cpp code
https://github.com/perdumonocle/neuralnet2cpp
c code-generation code-generator codegen codegenerator compute converter cpp neural-network neuralnet r
Last synced: about 1 month ago
JSON representation
Compute your R 'neuralnet' neural network using cpp code
- Host: GitHub
- URL: https://github.com/perdumonocle/neuralnet2cpp
- Owner: perdumonocle
- License: mit
- Created: 2017-06-12T19:37:03.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-06-13T06:39:50.000Z (almost 8 years ago)
- Last Synced: 2025-01-22T11:47:05.705Z (3 months ago)
- Topics: c, code-generation, code-generator, codegen, codegenerator, compute, converter, cpp, neural-network, neuralnet, r
- Language: R
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# neuralnet2cpp
Compute your R 'neuralnet' neural network using cpp code.You can train you neural network with R:
> library( 'neuralnet' )
> data <- data.frame( i1 = c(1, 2, 4), i2 = c(5, 5, 6), o = c(1, 1, 0) )
> net <- neuralnet( o~i1+i2, hidden = c( 5, 2 ) )Then test your net:
> test <- data.frame( i1 = 5, i2 = 1 )
> res <- compute( net, test )
> res$net.result
[,1]
[1,] -0.08056605515And convert that network into cpp:
> compute.gen.cpp( net, "~/myprojects/subfolder/compute.cpp" )Test your network using compute.cpp:
int main(int argc, char *argv[])
{
const double covariates[2] = { 5, 1 };
double results[1] = { 0 };
neuralnet::compute( &covariates[0], &results[0] );
printf( "%f\n", results[0] ); // -0.080566
return 0;
}