}
protected Node createNode(ConfigResult prop, String name) {
try {
NEFEnsembleFactory ef = new NEFEnsembleFactoryImpl();
Integer numOfNeurons = (Integer) prop.getValue(pNumOfNodes);
Integer dimensions = (Integer) prop.getValue(pDim);
/*
* Advanced properties, these may not necessarily be configued, so
*/
ApproximatorFactory approxFactory = (ApproximatorFactory) prop.getValue(pApproximator);
NodeFactory nodeFactory = (NodeFactory) prop.getValue(pNodeFactory);
Sign encodingSign = (Sign) prop.getValue(pEncodingSign);
Float encodingDistribution = (Float) prop.getValue(pEncodingDistribution);
Float radius = (Float) prop.getValue(pRadius);
Float noise = (Float) prop.getValue(pNoise);
if (nodeFactory != null) {
ef.setNodeFactory(nodeFactory);
}
if (approxFactory != null) {
ef.setApproximatorFactory(approxFactory);
}
if (noise != null) {
ApproximatorFactory f=ef.getApproximatorFactory();
if (f instanceof WeightedCostApproximator.Factory) {
((WeightedCostApproximator.Factory)f).setNoise(noise);
}
}
if (encodingSign != null) {
if (encodingDistribution == null) {
encodingDistribution = 0f;
}
VectorGenerator vectorGen = new RandomHypersphereVG(true, 1, encodingDistribution);
if (encodingSign == Sign.Positive) {
vectorGen = new Rectifier(vectorGen, true);
} else if (encodingSign == Sign.Negative) {
vectorGen = new Rectifier(vectorGen, false);
}
ef.setEncoderFactory(vectorGen);
}
if (radius==null) {
NEFEnsemble ensemble = ef.make(name, numOfNeurons, dimensions);
return ensemble;
} else {
float[] radii=new float[dimensions];
for (int i=0; i<dimensions; i++) {
radii[i]=radius.floatValue();
}
NEFEnsemble ensemble = ef.make(name, numOfNeurons, radii);
return ensemble;
}
} catch (StructuralException e) {
Util.debugMsg("StructuralException: " + e.toString());