[marf-cvs] marf/src/marf/Classification/NeuralNetwork NeuralNetwork.java,1.6,1.7
Brought to you by:
mokhov
From: <mo...@us...> - 2002-11-23 23:26:08
|
Update of /cvsroot/marf/marf/src/marf/Classification/NeuralNetwork In directory sc8-pr-cvs1:/tmp/cvs-serv12534/marf/Classification/NeuralNetwork Modified Files: NeuralNetwork.java Log Message: The framework made compile at the following price: - Need to work a bit on NN stuff, right now it's commented out. Other changes include: - make install will now "install" the framework into the speaker ident app dir - a kludge but makes the app to compile--- will be extended soon - Result object has more stuff in it - Few fixes in MARF where LpC was listed in thre classif. section - Others Aftre this commit it is compilable by make in /src Index: NeuralNetwork.java =================================================================== RCS file: /cvsroot/marf/marf/src/marf/Classification/NeuralNetwork/NeuralNetwork.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** NeuralNetwork.java 23 Nov 2002 16:46:56 -0000 1.6 --- NeuralNetwork.java 23 Nov 2002 23:26:05 -0000 1.7 *************** *** 1,16 **** package marf.Classification.NeuralNetwork; ! import marf.Classification.Classification; import marf.FeatureExtraction.FeatureExtraction; import marf.Storage.*; 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.*; --- 1,18 ---- package marf.Classification.NeuralNetwork; ! import marf.Classification.*; import marf.FeatureExtraction.FeatureExtraction; import marf.Storage.*; 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.*; *************** *** 21,25 **** * <p>$Header$ */ ! public class NeuralNetwork extends Classification { --- 23,27 ---- * <p>$Header$ */ ! public class NeuralNetwork extends Classification implements StorageManager { *************** *** 39,43 **** /** Constants used for JAXP 1.2 */ ! static final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final String W3C_XML_SCHEMA = --- 41,45 ---- /** Constants used for JAXP 1.2 */ ! /* static final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final String W3C_XML_SCHEMA = *************** *** 45,49 **** static final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; ! public NeuralNetwork(FeatureExtraction poFeatureExtraction) --- 47,51 ---- static final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; ! */ public NeuralNetwork(FeatureExtraction poFeatureExtraction) *************** *** 52,58 **** } public boolean classify() throws ClassificationException { ! double [] adFeatures = oFeatureExtraction.getFeatures(); if(adFeatures.length != inputs.size()) --- 54,65 ---- } + public boolean train() throws ClassificationException + { + return false; + } + public boolean classify() throws ClassificationException { ! double [] adFeatures = oFeatureExtraction.getFeaturesArray(); if(adFeatures.length != inputs.size()) *************** *** 90,94 **** public void initialize(String filename, boolean dtd) throws ClassificationException { ! System.out.println("Initializing XML parser..."); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); --- 97,101 ---- public void initialize(String filename, boolean dtd) throws ClassificationException { ! /* System.out.println("Initializing XML parser..."); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); *************** *** 232,239 **** buildNNet(child); } ! } //DOM tree traversal -- create input and output links ! private void createLinks(Node n) throws ClassificationException { int type = n.getNodeType(); --- 239,246 ---- buildNNet(child); } ! */ } //DOM tree traversal -- create input and output links ! /* private void createLinks(Node n) throws ClassificationException { int type = n.getNodeType(); *************** *** 370,375 **** createLinks(child); } - } //----------- Methods for Outputting the NNet ----------------- --- 377,383 ---- createLinks(child); } + } + */ //----------- Methods for Outputting the NNet ----------------- *************** *** 381,385 **** public void dumpXML() { ! System.out.println("<?xml version=\"1.0\"?>"); System.out.println("<net>"); --- 389,393 ---- public void dumpXML() { ! /* System.out.println("<?xml version=\"1.0\"?>"); System.out.println("<net>"); *************** *** 425,429 **** return ret; ! } //----------- Method for Training the NNet ----------------- --- 433,437 ---- return ret; ! */ } //----------- Method for Training the NNet ----------------- *************** *** 431,435 **** public void train(double [] in, double [] expected, double trainconst) throws ClassificationException { ! if(trainconst <= 0.0) throw new ClassificationException("Training constant must be >= 0.0"); --- 439,443 ---- public void train(double [] in, double [] expected, double trainconst) throws ClassificationException { ! /* if(trainconst <= 0.0) throw new ClassificationException("Training constant must be >= 0.0"); *************** *** 469,478 **** ((Neuron)tmp.get(j)).commit(); } ! } /* From Storage Manager */ ! public void dump() throws IOException { //throw new NotImplementedException("NeuralNetwork.dump()"); --- 477,486 ---- ((Neuron)tmp.get(j)).commit(); } ! */ } /* From Storage Manager */ ! public void dump() throws java.io.IOException { //throw new NotImplementedException("NeuralNetwork.dump()"); *************** *** 480,484 **** } ! public void restore() throws IOException { throw new NotImplementedException("NeuralNetwork.restore()"); --- 488,492 ---- } ! public void restore() throws java.io.IOException { throw new NotImplementedException("NeuralNetwork.restore()"); *************** *** 487,495 **** //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) { --- 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) { *************** *** 500,504 **** * Returns a string describing parse exception details */ ! private String getParseExceptionInfo(SAXParseException spe) { String systemId = spe.getSystemId(); if (systemId == null) { --- 508,512 ---- * Returns a string describing parse exception details */ ! /* private String getParseExceptionInfo(SAXParseException spe) { String systemId = spe.getSystemId(); if (systemId == null) { *************** *** 528,532 **** } } ! } --- 536,540 ---- } } ! */ } |