Cannot scale data with encog -
currently i'm trying scale data file (train.nn) using encog 3, data file looks (this simplified example, in real file, have 249 features each sample sp):
1,0,1,2,sp 4,5,6,1,sp
and code scaling:
file rawfile = new file(mydir, "train.nn"); file scaledfile = new file(mydir, "scaledtrain.nn"); encoganalyst analyst = new encoganalyst(); analystnormalizecsv norm = new analystnormalizecsv(); norm.analyze(rawfile, true, csvformat.english, analyst); norm.setproduceoutputheaders(false); norm.normalize(scaledfile);
but got error:
exception in thread "main" org.encog.app.analyst.analysterror: multiple fields named: 1 @ org.encog.app.analyst.util.csvheaders.validatesamename(csvheaders.java:292) @ org.encog.app.analyst.util.csvheaders.init(csvheaders.java:270) @ org.encog.app.analyst.util.csvheaders.<init>(csvheaders.java:146) @ org.encog.app.analyst.csv.normalize.analystnormalizecsv.analyze(analystnormalizecsv.java:147)
i don't know why complained this.... can show me did wrong here?
thank much.
p/s: looked @ this tutorial . not handy me since defined each field (feature) manually, bad, since in case have 249 features each sample.
you can set loop this:
int fieldcount = 249; inputfieldcsv[] infields = new inputfieldcsv[fieldcount]; int = 0; while (i < fieldcount) { norm.addinputfield(infields[i] = new inputfieldcsv(true, rawfile, i)); i++; }
then set further loops rest of code see same line repeated over. (code not tested...)
Comments
Post a Comment