OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [mw/] [src/] [demos/] [nxscribble/] [sc.h] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 673 markom
/***********************************************************************
2
 
3
sc.h - creates classifiers from feature vectors of examples, as well as
4
   classifying example feature vectors.
5
 
6
Copyright (C) 1991 Dean Rubine
7
 
8
This program is free software; you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation; either version 1, or (at your option)
11
any later version.
12
 
13
This program is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
GNU General Public License for more details.
17
 
18
You should have received a copy of the GNU General Public License
19
along with this program (in ../COPYING); if not, write to the Free
20
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
 
22
***********************************************************************/
23
 
24
 
25
/*
26
 single path classifier
27
*/
28
 
29
#ifndef _SC_H_
30
 
31
#define _SC_H_
32
 
33
#define MAXSCLASSES     100
34
 
35
typedef struct sclassifier *sClassifier; /* single feature-vector classifier */
36
typedef int                 sClassIndex; /* single feature-vector class index */
37
typedef struct sclassdope  *sClassDope;  /* single feature-vector class dope */
38
 
39
struct sclassdope {
40
        char            *name;
41
        sClassIndex     number;
42
        Vector          average;
43
        Matrix          sumcov;
44
        int             nexamples;
45
};
46
 
47
struct sclassifier {
48
        int             nfeatures;
49
        int             nclasses;
50
        sClassDope      *classdope;
51
 
52
        Vector          cnst;   /* constant term of discrimination function */
53
        Vector          *w;     /* array of coefficient weights */
54
        Matrix          invavgcov; /* inverse covariance matrix */
55
};
56
 
57
sClassifier     sNewClassifier();
58
sClassifier     sRead();                /* FILE *f */
59
void            sWrite();               /* FILE *f; sClassifier sc; */
60
void            sFreeClassifier();      /* sc */
61
void            sAddExample();          /* sc, char *classname; Vector y */
62
void            sRemoveExample();       /* sc, classname, y */
63
void            sDoneAdding();          /* sc */
64
sClassDope      sClassify();            /* sc, y */
65
sClassDope      sClassifyAD();          /* sc, y, double *ap; double *dp */
66
sClassDope      sClassNameLookup();     /* sc, classname */
67
double          MahalanobisDistance();  /* Vector v, u; Matrix sigma */
68
void            FixClassifier();
69
void            sDumpClassifier();
70
void            sDistances();
71
 
72
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.