// Copyright (C) 1999 Jean-Marc Valin #include "RBF.h" #include "ObjectParser.h" #include "misc.h" using namespace std; namespace FD { DECLARE_TYPE(RBF) //@implements VQ void RBF::train (int codeSize, const vector &data/*, const vector &data_out*/, int len, bool binary) { KMeans::train (codeSize, data, len, binary); covar.resize(nbClasses()); vector counts(covar.size(), 0); for (int i=0;i" << endl; out << "" << endl; out << "" << endl; out << ">\n"; } void RBF::readFrom (istream &in) { string tag; while (1) { char ch; in >> ch; if (ch == '>') break; else if (ch != '<') throw new ParsingException ("RBF::readFrom : Parse error: '<' expected"); in >> tag; if (tag == "length") in >> length; else if (tag == "covar") in >> covar; else if (tag == "means") in >> means; else throw new ParsingException ("RBF::readFrom : unknown argument: " + tag); if (!in) throw new ParsingException ("RBF::readFrom : Parse error trying to build " + tag); in >> tag; if (tag != ">") throw new ParsingException ("RBF::readFrom : Parse error: '>' expected "); } } istream &operator >> (istream &in, RBF &mdl) { if (!isValidType(in, "RBF")) return in; mdl.readFrom(in); return in; } }//namespace FD