root/trunk/api.d

Revision 27, 1.8 kB (checked in by qbert, 5 years ago)

Working 1.1, no serialize.d though

Line 
1 /**
2
3 Author: Charles Sanders
4 Date: 2006.4.28
5
6
7 Main Import File
8
9 Example:
10 --------------------
11
12 // xor data
13
14 const real [] [] inputs  = [
15                 [ 0,0 ],
16                 [ 0,1 ],
17                 [ 1,0 ],
18                 [ 1,1 ]             
19
20 ];
21
22
23 const real [] [] outputs = [
24                 [ 0 ],
25                 [ 1 ],
26                 [ 1 ],
27                 [ 0 ]
28 ];
29
30
31 void main ()
32 {
33
34       IActivationFunction f = new SigmoidActivationFunction;
35
36       Layer input = new Layer(2,0);
37       Layer [] hidden = [ new Layer(2,2,f)  ];
38       Layer output = new Layer(1,2,f) ;
39
40       NeuralNetwork nn = new NeuralNetwork(input,hidden,output );
41       CostFunction cost = new SSE( 0.001 );
42       BackPropagation bp = new BackPropagation(nn,cost);
43
44       bp.epochs = 50_000;
45       bp.learningRate = 0.5;
46       bp.momentum = 0.5;
47
48       void callback( uint currentEpoch, real currentError  )
49     {
50       writefln("Epoch: [ %s ] | Error [ %f ] ",currentEpoch, currentError );
51     }
52
53       bp.setProgressCallback(&callback, 1000 );
54       
55       bp.train(inputs,outputs);
56
57       writefln("%d",bp.actualEpochs);
58       writefln("%f" ,bp.computeOutput(inputs[0])[0]);
59       writefln("%f" ,bp.computeOutput(inputs[1])[0]);
60       writefln("%f" ,bp.computeOutput(inputs[2])[0]);
61       writefln("%f" ,bp.computeOutput(inputs[3])[0]);
62
63 }
64 --------------------
65
66
67 */
68 module and.api;
69
70 public
71 {
72   import and.cost.model.icostfunction;
73   import and.cost.mse;
74   import and.cost.sse;
75
76   import and.activation.model.iactivation;
77   import and.activation.sigmoid;
78   import and.activation.tanh;
79  
80   import and.learning.model.ilearning;
81   import and.learning.backprop;
82
83   import and.network.neuralnetwork;
84   import and.network.neuron;
85   import and.network.serialize;
86   import and.network.layer;
87
88   import and.util;
89
90 }
91
92 const float VERSION  = 0.3; /// version
Note: See TracBrowser for help on using the browser.