.getScript().getNormalize().countActiveFields() - 1, 1);
resetStatus();
while (csv.next()) {
updateStatus(false);
final LoadedRow row = new LoadedRow(csv, this.outputColumns);
double[] inputArray = AnalystNormalizeCSV.extractFields(analyst,
this.analystHeaders, csv, outputLength, true);
if (this.series.getTotalDepth() > 1) {
inputArray = this.series.process(inputArray);
}
if (inputArray != null) {
final MLData input = new BasicMLData(inputArray);
// evaluation data
if ((method instanceof MLClassification)
&& !(method instanceof MLRegression)) {
// classification only?
output = new BasicMLData(1);
output.setData(0,
((MLClassification) method).classify(input));
} else {
// regression
output = ((MLRegression) method).compute(input);
}
// skip file data
int index = this.fileColumns;
int outputIndex = 0;
String otherOutput = "";
if( method instanceof BayesianNetwork ) {
otherOutput = ((BayesianNetwork)method).getClassificationTargetEvent().getLabel();
}
// display output
for (final AnalystField field : analyst.getScript()
.getNormalize().getNormalizedFields()) {
if (this.analystHeaders.find(field.getName()) != -1) {
if (field.isOutput() || field.getName().equals(otherOutput)) {
if (field.isClassify()) {
// classification
final ClassItem cls = field.determineClass(
outputIndex, output.getData());
outputIndex += field.getColumnsNeeded();
if (cls == null) {
row.getData()[index++] = "?Unknown?";
} else {
row.getData()[index++] = cls.getName();
}
} else {
// regression
double n = output.getData(outputIndex++);
n = field.deNormalize(n);
row.getData()[index++] = getFormat()
.format(n, getPrecision());
}
}
}
}