return false; if ((t.getType() & PURE_INPUT) == PURE_INPUT) { return false; //target is an input node. if ((s.getType() & PURE_OUTPUT) == PURE_OUTPUT) { return false; //source is an output node if ((s.getType() & PURE_INPUT) == PURE_INPUT && (t.getType() & PURE_OUTPUT) == PURE_OUTPUT) { return false; //there is no actual working node in use if ((t.getType() & PURE_OUTPUT) == PURE_OUTPUT && t.getNumInputs() > 0) { return false; //more than 1 node is trying to feed a particular output if ((t.getType() & PURE_OUTPUT) == PURE_OUTPUT && (s.getType() & OUTPUT) == OUTPUT) { return false; //an output node already feeding out a final answer if ((s.getType() & PURE_INPUT) == PURE_INPUT) { t.setType(t.getType() | INPUT); else if ((t.getType() & PURE_OUTPUT) == PURE_OUTPUT) { s.setType(s.getType() | OUTPUT); t.setType(t.getType() | CONNECTED); s.setType(s.getType() | CONNECTED); return true;
/** * This will go through all the nodes and check if they are connected to a * pure output unit. If so they will be set to be linear units. If not they * will be set to be sigmoid units. */ private void setEndsToLinear() { for (NeuralConnection m_neuralNode : m_neuralNodes) { if ((m_neuralNode.getType() & NeuralConnection.OUTPUT) == NeuralConnection.OUTPUT) { ((NeuralNode) m_neuralNode).setMethod(m_linearUnit); } else { ((NeuralNode) m_neuralNode).setMethod(m_sigmoidUnit); } } }
return false; if ((t.getType() & PURE_INPUT) == PURE_INPUT) { return false; //target is an input node. if ((s.getType() & PURE_OUTPUT) == PURE_OUTPUT) { return false; //source is an output node if ((s.getType() & PURE_INPUT) == PURE_INPUT && (t.getType() & PURE_OUTPUT) == PURE_OUTPUT) { return false; //there is no actual working node in use if ((t.getType() & PURE_OUTPUT) == PURE_OUTPUT && t.getNumInputs() > 0) { return false; //more than 1 node is trying to feed a particular output if ((t.getType() & PURE_OUTPUT) == PURE_OUTPUT && (s.getType() & OUTPUT) == OUTPUT) { return false; //an output node already feeding out a final answer if ((s.getType() & PURE_INPUT) == PURE_INPUT) { t.setType(t.getType() | INPUT); else if ((t.getType() & PURE_OUTPUT) == PURE_OUTPUT) { s.setType(s.getType() | OUTPUT); t.setType(t.getType() | CONNECTED); s.setType(s.getType() | CONNECTED); return true;
/** * This will go through all the nodes and check if they are connected to a * pure output unit. If so they will be set to be linear units. If not they * will be set to be sigmoid units. */ private void setEndsToLinear() { for (NeuralConnection m_neuralNode : m_neuralNodes) { if ((m_neuralNode.getType() & NeuralConnection.OUTPUT) == NeuralConnection.OUTPUT) { ((NeuralNode) m_neuralNode).setMethod(m_linearUnit); } else { ((NeuralNode) m_neuralNode).setMethod(m_sigmoidUnit); } } }
/** * This function will remove all the inputs to this unit. * In doing so it will also terminate the connections at the other end. */ public void removeAllInputs() { for (int noa = 0; noa < m_numInputs; noa++) { //this command will simply remove any connections this node has //with the other in 1 go, rather than seperately. m_inputList[noa].disconnectOutput(this, -1); } //now reset the inputs. m_inputList = new NeuralConnection[0]; setType(getType() & (~INPUT)); if (getNumOutputs() == 0) { setType(getType() & (~CONNECTED)); } m_inputNums = new int[0]; m_numInputs = 0; }
/** * This function will remove all outputs to this unit. * In doing so it will also terminate the connections at the other end. */ public void removeAllOutputs() { for (int noa = 0; noa < m_numOutputs; noa++) { //this command will simply remove any connections this node has //with the other in 1 go, rather than seperately. m_outputList[noa].disconnectInput(this, -1); } //now reset the inputs. m_outputList = new NeuralConnection[0]; m_outputNums = new int[0]; setType(getType() & (~OUTPUT)); if (getNumInputs() == 0) { setType(getType() & (~CONNECTED)); } m_numOutputs = 0; }
/** * This function will remove all outputs to this unit. * In doing so it will also terminate the connections at the other end. */ public void removeAllOutputs() { for (int noa = 0; noa < m_numOutputs; noa++) { //this command will simply remove any connections this node has //with the other in 1 go, rather than seperately. m_outputList[noa].disconnectInput(this, -1); } //now reset the inputs. m_outputList = new NeuralConnection[0]; m_outputNums = new int[0]; setType(getType() & (~OUTPUT)); if (getNumInputs() == 0) { setType(getType() & (~CONNECTED)); } m_numOutputs = 0; }
/** * This function will remove all the inputs to this unit. * In doing so it will also terminate the connections at the other end. */ public void removeAllInputs() { for (int noa = 0; noa < m_numInputs; noa++) { //this command will simply remove any connections this node has //with the other in 1 go, rather than seperately. m_inputList[noa].disconnectOutput(this, -1); } //now reset the inputs. m_inputList = new NeuralConnection[0]; setType(getType() & (~INPUT)); if (getNumOutputs() == 0) { setType(getType() & (~CONNECTED)); } m_inputNums = new int[0]; m_numInputs = 0; }
boolean stat2 = t.disconnectInput(s, -1); if (stat1 && stat2) { if ((s.getType() & PURE_INPUT) == PURE_INPUT) { t.setType(t.getType() & (~INPUT)); else if ((t.getType() & (PURE_OUTPUT)) == PURE_OUTPUT) { s.setType(s.getType() & (~OUTPUT)); s.setType(s.getType() & (~CONNECTED)); t.setType(t.getType() & (~CONNECTED));
boolean stat2 = t.disconnectInput(s, -1); if (stat1 && stat2) { if ((s.getType() & PURE_INPUT) == PURE_INPUT) { t.setType(t.getType() & (~INPUT)); else if ((t.getType() & (PURE_OUTPUT)) == PURE_OUTPUT) { s.setType(s.getType() & (~OUTPUT)); s.setType(s.getType() & (~CONNECTED)); t.setType(t.getType() & (~CONNECTED));
model.append(" Threshold " + weights[0] + "\n"); for (int nob = 1; nob < con.getNumInputs() + 1; nob++) { if ((inputs[nob - 1].getType() & NeuralConnection.PURE_INPUT) == NeuralConnection.PURE_INPUT) { model.append(" Attrib " + m_instances.attribute(((NeuralEnd) inputs[nob - 1]).getLink()) + "\n Input\n"); for (int nob = 0; nob < m_output.getNumInputs(); nob++) { if ((inputs[nob].getType() & NeuralConnection.PURE_INPUT) == NeuralConnection.PURE_INPUT) { model.append(" Attrib " + m_instances.attribute(((NeuralEnd) inputs[nob]).getLink()).name()
model.append(" Threshold " + weights[0] + "\n"); for (int nob = 1; nob < con.getNumInputs() + 1; nob++) { if ((inputs[nob - 1].getType() & NeuralConnection.PURE_INPUT) == NeuralConnection.PURE_INPUT) { model.append(" Attrib " + m_instances.attribute(((NeuralEnd) inputs[nob - 1]).getLink()) + "\n Input\n"); for (int nob = 0; nob < m_output.getNumInputs(); nob++) { if ((inputs[nob].getType() & NeuralConnection.PURE_INPUT) == NeuralConnection.PURE_INPUT) { model.append(" Attrib " + m_instances.attribute(((NeuralEnd) inputs[nob]).getLink()).name()