51 for (i = 0, p = lex.
head(); p!=0; p = p->
next(), ++i)
55 cerr <<
"Item " << name <<
" not found in word list\n";
70 if ((n != -1) && (m != -1))
71 a(m, n) = a(m, n) + 1;
91 for (i = 0; i < n; ++i)
94 for (j = 0; j < n; ++j)
95 row_total[i] += a(i, j);
98 for (j = 0; j < n; ++j)
101 for (i = 0; i < n; ++i)
102 col_total[j] += a(i, j);
105 for (i = 0; i < n; ++i)
107 float rt = row_total(i);
111 correct[i] = 100.0 * a(i, i) / rt;
114 for (p = lex.
head(); p != 0; p = p->
next())
118 cout << lex(p).before(3) <<
" ";
122 for (p = lex.
head(), i = 0; i < n; ++i, p = p->
next())
126 for (j = 0; j < n; ++j)
131 cout.setf(ios::fixed, ios::floatfield);
132 cout << ( (
int) a(i, j) ) <<
" ";
135 cout << (
int)row_total(i) <<
" ";
138 cout <<
"[" << ((
int)a(i, i)) <<
"/" << ((
int)row_total(i)) <<
"]";
146 cout << correct(i) << endl;
149 for (j = 0; j < n; ++j)
152 cout << ((
int)col_total(j)) <<
" ";
168 cout <<
"total " << ((
int)t) <<
" correct " << s <<
" " EST_FMatrix diagonalise(const EST_FMatrix &a)
extract leading diagonal as a matrix
const K & key(EST_Litem *ptr, int m=1) const
find key, reference by ptr
A vector class for floating point numbers. EST_FVector x should be used instead of float *x wherever ...
void print_confusion(const EST_FMatrix &a, EST_StrStr_KVL &list, EST_StrList &lex)
STATIC void right(STATUS Change)
int nth(EST_String name, EST_TList< EST_String > &lex)
ssize_t num_rows() const
return number of rows
EST_TList< EST_TKVI< K, V > > list
Linked list of key-val pairs. Don't use this as it will be made private in the future.
Templated Key-Value list. Objects of type EST_TKVL contain lists which are accessed by a key of type ...
const V & val(const K &rkey, bool m=0) const
return value according to key (const)
EST_FMatrix confusion(EST_StrStr_KVL &list, EST_StrList &lex)
float sum(const EST_FMatrix &a)
sum of elements