~/NeuroTIC$ make create
Error: The workspace directory is not empty.
Do you want to remove all files in the workspace directory? (y/n): y
Workspace cleared.
Enter the new project name: test
Author name (default: whoami): whoami
Brief project description: testing
Available header packs:
basic
complete
Enter the header pack to use: complete
Project created successfully at workspace/test.c
#include "test.h"
#include "ntcomplete.h"
#define NETWORK_NAME test
#define OUTPUT_DIR "./test_net.ntic"
#define INPUTS 1
#define NEURONS_PER_LAYER 1
#define ACTIVATION_FUNCTIONS NTACT_SIGMOID
#define TRAINING_SAMPLES 1
#define LEARNING_RATE 0.1
#define TOLERANCE 0.0
#define MAX_ATTEMPTS 1
int main( void ){
for( layer_t i= 0 ; i < NETWORK_NAME.layers ; i++ ) for( uint16_t j= 0 ; j < NETWORK_NAME.neurons[i] ; j++ )
NETWORK_NAME.nn[i][j].fn= ACTIVATION_FUNCTIONS;
.max_attempts= MAX_ATTEMPTS,
.samples= TRAINING_SAMPLES,
};
size_t sample;
printf( "Select test: " );
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
scanf( "%zu" , &sample );
#pragma GCC diagnostic pop
printf( "SAMPLE INPUTS: " );
for( input_t i= 0 ; i < NETWORK_NAME.inputs ; i++ ) printf(
"%f " , data.
in[sample][i] );
printf( "\nEXPECTED OUTPUTS: " );
for( uint16_t i= 0 ; i < NETWORK_NAME.neurons[NETWORK_NAME.layers-1] ; i++ ) printf(
"%f " , data.
results[sample][i] );
data_t inputs[NETWORK_NAME.inputs];
for( input_t i= 0 ; i < NETWORK_NAME.inputs ; i++ ) NETWORK_NAME.in[i]= &inputs[i];
memcpy( inputs , data.
in[sample] , NETWORK_NAME.inputs *
sizeof( data_t ) );
printf( "\n\nNETWORK INPUTS: " );
for( input_t i= 0 ; i < NETWORK_NAME.inputs ; i++ ) printf( "%f " , *NETWORK_NAME.in[i] );
printf( "\nNETWORK OUTPUTS: " );
for( uint16_t i= 0 ; i < NETWORK_NAME.neurons[NETWORK_NAME.layers-1] ; i++ ) printf( "%f " , *NETWORK_NAME.out[i] );
savenet( &NETWORK_NAME , OUTPUT_DIR );
putchar( '\n' );
return 0;
}
#define CREATE_NET_FEEDFORWARD(network, i, neurons)
Convenience macro to create and build a feedforward network.
Definition ntbuilder.h:38
data_t * feedforward(net_s *net)
Executes full feedforward propagation.
Definition ntcalculate.c:44
unsigned char savenet(net_s *net, const char *name)
Saves a network to a binary file with extension .ntic.
Definition ntfile.c:115
void randnet(net_s *net)
Randomly initializes network weights.
Definition ntinitialize.c:25
attempts_t backpropagation(net_s *net, traindata_t *train_data)
Trains a network using backpropagation.
Definition nttrain.c:46
void newtraindata(traindata_t *train_data, net_s *net)
Allocates memory for training data arrays.
Definition nttrain.c:26
data_t precision_t
Definition nttrain.h:14
Structure to hold training dataset and parameters.
Definition nttrain.h:21
precision_t learning_rate
Definition nttrain.h:23
data_t ** results
Definition nttrain.h:27
data_t ** in
Definition nttrain.h:26