Update of /cvsroot/marf/marf/src/marf/Classification/NeuralNetwork
In directory sc8-pr-cvs1:/tmp/cvs-serv23673/marf/Classification/NeuralNetwork
Modified Files:
NeuralNetwork.java
Log Message:
- NN was made compilable within the framework
but requires lot more work
Index: NeuralNetwork.java
===================================================================
RCS file: /cvsroot/marf/marf/src/marf/Classification/NeuralNetwork/NeuralNetwork.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** NeuralNetwork.java 24 Nov 2002 16:16:22 -0000 1.8
--- NeuralNetwork.java 25 Nov 2002 07:01:16 -0000 1.9
***************
*** 6,18 ****
import marf.util.*;
- /*
import javax.xml.parsers.*;
- */
import java.util.ArrayList;
! /*
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import org.w3c.dom.*;
! */
import java.io.*;
--- 6,16 ----
import marf.util.*;
import javax.xml.parsers.*;
import java.util.ArrayList;
!
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import org.w3c.dom.*;
!
import java.io.*;
***************
*** 40,44 ****
static final String outputEncoding = "UTF-8";
! /** Constants used for JAXP 1.2 */
static final String JAXP_SCHEMA_LANGUAGE =
"http://java.sun.com/xml/jaxp/properties/schemaLanguage";
--- 38,42 ----
static final String outputEncoding = "UTF-8";
! /* Constants used for JAXP 1.2 */
static final String JAXP_SCHEMA_LANGUAGE =
"http://java.sun.com/xml/jaxp/properties/schemaLanguage";
***************
*** 97,101 ****
public void initialize(String filename, boolean dtd) throws ClassificationException
{
! /*
System.out.println("Initializing XML parser...");
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
--- 95,99 ----
public void initialize(String filename, boolean dtd) throws ClassificationException
{
!
System.out.println("Initializing XML parser...");
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
***************
*** 239,246 ****
buildNNet(child);
}
! */ }
//DOM tree traversal -- create input and output links
! /* private void createLinks(Node n) throws ClassificationException
{
int type = n.getNodeType();
--- 237,244 ----
buildNNet(child);
}
! }
//DOM tree traversal -- create input and output links
! private void createLinks(Node n) throws ClassificationException
{
int type = n.getNodeType();
***************
*** 379,383 ****
}
! */
//----------- Methods for Outputting the NNet -----------------
--- 377,381 ----
}
!
//----------- Methods for Outputting the NNet -----------------
***************
*** 389,393 ****
public void dumpXML() {
! /*
System.out.println("<?xml version=\"1.0\"?>");
System.out.println("<net>");
--- 387,391 ----
public void dumpXML() {
!
System.out.println("<?xml version=\"1.0\"?>");
System.out.println("<net>");
***************
*** 433,437 ****
return ret;
! */ }
//----------- Method for Training the NNet -----------------
--- 431,435 ----
return ret;
! }
//----------- Method for Training the NNet -----------------
***************
*** 439,447 ****
public void train(double [] in, double [] expected, double trainconst) throws ClassificationException
{
! /* if(trainconst <= 0.0)
throw new ClassificationException("Training constant must be >= 0.0");
//Setup NNet with training data.
! try {
//Must setup the input data...
//setInputs(in);
--- 437,445 ----
public void train(double [] in, double [] expected, double trainconst) throws ClassificationException
{
! if(trainconst <= 0.0)
throw new ClassificationException("Training constant must be >= 0.0");
//Setup NNet with training data.
! /* try {
//Must setup the input data...
//setInputs(in);
***************
*** 451,455 ****
throw new ClassificationException(n.getMessage());
}
!
if(expected.length != outputs.size())
throw new ClassificationException("Expected array size not consistent with output layer.");
--- 449,453 ----
throw new ClassificationException(n.getMessage());
}
! */
if(expected.length != outputs.size())
throw new ClassificationException("Expected array size not consistent with output layer.");
***************
*** 477,481 ****
((Neuron)tmp.get(j)).commit();
}
! */ }
--- 475,479 ----
((Neuron)tmp.get(j)).commit();
}
! }
***************
*** 495,503 ****
//iclement: This may need revision:
//mokhov: i guess so
! /*
// Error handler to report errors and warnings
private static class MyErrorHandler implements ErrorHandler {
/** Error handler output goes here */
! /* private PrintWriter out;
MyErrorHandler(PrintWriter out) {
--- 493,501 ----
//iclement: This may need revision:
//mokhov: i guess so
!
// Error handler to report errors and warnings
private static class MyErrorHandler implements ErrorHandler {
/** Error handler output goes here */
! private PrintWriter out;
MyErrorHandler(PrintWriter out) {
***************
*** 508,512 ****
* Returns a string describing parse exception details
*/
! /* private String getParseExceptionInfo(SAXParseException spe) {
String systemId = spe.getSystemId();
if (systemId == null) {
--- 506,510 ----
* Returns a string describing parse exception details
*/
! private String getParseExceptionInfo(SAXParseException spe) {
String systemId = spe.getSystemId();
if (systemId == null) {
***************
*** 536,540 ****
}
}
! */
}
--- 534,538 ----
}
}
!
}
|