public void addElement(TrainingElement el)
throws VectorSizeMismatchException {
// check input vector size if it is predefined
if ((this.inputVectorSize != 0)
&& (el.getInput().length != this.inputVectorSize)) {
throw new VectorSizeMismatchException(
"Input vector size does not match training set!");
}
// check output vector size if it is predefined
if (el instanceof SupervisedTrainingElement) {
SupervisedTrainingElement sel = (SupervisedTrainingElement) el;
if ((this.outputVectorSize != 0)
&& (sel.getDesiredOutput().length != this.outputVectorSize)) {
throw new VectorSizeMismatchException(
"Output vector size does not match training set!");
}
}
// if everything went ok add training element
this.elements.add(el);