getInputLayerNeurons method
Gets the input layer neurons by excluding the provided class attribute className.
This method removes the attribute with the name className from the attributesList
and creates a Neuron for each remaining attribute. If the attribute type is 'nominal',
it creates a neuron for each nominal value. Otherwise, it creates a neuron with the
attribute name. Throws OutputLayerNameError if an error occurs.
-
Parameters:
- className: The name of the class attribute to exclude.
-
Returns: A list of Neurons representing the input layer.
Implementation
List<Neuron> getInputLayerNeurons({required String className}) {
try {
List<Neuron> neurons = [];
List<ARFFAttributes> attributes = [];
attributes.addAll(attributesList);
attributes.removeWhere((attr) => attr.name == className);
for (ARFFAttributes attribute in attributes) {
if (attribute.type == 'nominal') {
for (String name in attribute.nominalValues!) {
neurons.add(Neuron(name: name));
}
} else {
neurons.add(Neuron(name: attribute.name));
}
}
return neurons;
} catch (exception) {
throw OutputLayerNameError();
}
}