File: neuralnet.h

package info (click to toggle)
gnubg 0.90%2B20091206-4
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 23,660 kB
  • ctags: 7,575
  • sloc: ansic: 92,588; xml: 13,661; sh: 1,058; makefile: 473; python: 429; yacc: 295; sql: 237; lex: 221; php: 103; cs: 81; awk: 25
file content (69 lines) | stat: -rw-r--r-- 2,140 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 3 or later of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * neuralnet.h
 *
 * by Gary Wong, 1998
 * $Id: neuralnet.h,v 1.23 2009/06/30 10:30:40 Superfly_Jon Exp $
 */

#ifndef _NEURALNET_H_
#define _NEURALNET_H_

#include <stdio.h>
#include "common.h"

typedef struct _neuralnet {
	unsigned int cInput;
	unsigned int cHidden;
	unsigned int cOutput;
	unsigned int fDirect;
	int nTrained;
	float rBetaHidden;
	float rBetaOutput;
	float *arHiddenWeight;
	float *arOutputWeight;
	float *arHiddenThreshold;
	float *arOutputThreshold;
} neuralnet;

typedef enum {
	NNEVAL_NONE,
	NNEVAL_SAVE,
	NNEVAL_FROMBASE
} NNEvalType;

typedef enum {
	NNSTATE_NONE = -1,
	NNSTATE_INCREMENTAL,
	NNSTATE_DONE
} NNStateType;

typedef struct _NNState {
	NNStateType state;
	float *savedBase;
	float *savedIBase;
} NNState;

extern int NeuralNetCreate(neuralnet *pnn, unsigned int cInput, unsigned int cHidden, unsigned int cOutput, float rBetaHidden, float rBetaOutput);
extern void NeuralNetDestroy(neuralnet *pnn);
extern int NeuralNetEvaluate(const neuralnet *pnn, float arInput[], float arOutput[], NNState *pnState);
extern int NeuralNetEvaluate128(const neuralnet *pnn, float arInput[], float arOutput[], NNState *pnState);
extern int NeuralNetResize(neuralnet *pnn, unsigned int cInput, unsigned int cHidden, unsigned int cOutput);
extern int NeuralNetLoad(neuralnet *pnn, FILE *pf);
extern int NeuralNetLoadBinary(neuralnet *pnn, FILE *pf);
extern int NeuralNetSaveBinary(const neuralnet *pnn, FILE *pf);
extern int SSE_Supported(void);

#endif