NoClassDefFoundError: org/encog/engine/data/E

Help
richard
2011-02-24
2012-12-24
  • richard
    richard
    2011-02-24

    i would like to build a mlp-network to classify spectra in the vis-area. however when i try to train the network, i get the following error message:

    Exception in thread "main" java.lang.NoClassDefFoundError: org/encog/engine/data/EngineData
            at java.lang.ClassLoader.defineClass1(Native Method)
            at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
            at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
            at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
            at playground.ANNTest.main(ANNTest.java:51)
    Caused by: java.lang.ClassNotFoundException: org.encog.engine.data.EngineData
            at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
            ... 13 more
    Java Result: 1
    

    im using netbeans and i guess i have correctly added the neuroph library. does neuroph actually use encog code, or why is this class missing?

    my sample code:

    /**
         * creates and trains a MLP with the provided training spectra
         *
         * @param trainingInputs array of training spectra
         * @param trainingOutputs array with mixture ratios if training spectra
         * @param numInputs pixels of spectral data
         * @param numHidden hidden layers for network
         * @param numOutput number of mixture components
         * @param maxIt maxiumum learning iteration
         * @param maxError maximum error
         * @param rate learning rate
         * @param name path of network
         */
        public static void createNetwork(Spectrum [] trainingInputs, double [][] trainingOutputs, int numInputs, int numHidden, int numOutput, int maxIt, double maxError, double rate, String name)
        {
            //create network
            NeuralNetwork myNet = new MultiLayerPerceptron(TransferFunctionType.SIGMOID, numInputs, numHidden, numOutput);
            //set learning iteration thresholds
            ((LMS) myNet.getLearningRule()).setMaxError(maxError);
            ((LMS) myNet.getLearningRule()).setLearningRate(rate);
            ((LMS) myNet.getLearningRule()).setMaxIterations(maxIt);
            //build up training set
            TrainingSet calibrationData = new TrainingSet();
            for(int i=0;i<trainingInputs.length;i++)
            {
                calibrationData.addElement(new SupervisedTrainingElement(trainingInputs[i].getSpectrumArray(), trainingOutputs[i]));
            }
            //train network
            myNet.learnInSameThread(calibrationData);
            //save network
            myNet.save(name);
        }
    

    thx!

     
  • Zoran Sevarac
    Zoran Sevarac
    2011-02-24

    Hi,

    Add the references to all libraries from the lib folder to ypur project. As of v2.5 neuroph supports integration with Encog engine and thats why it complains. Thanks for pointing this out!

    Zoran

     
  • Zoran Sevarac
    Zoran Sevarac
    2011-02-24

    PS. All required libraries are located In lib folder from downloaded neuroph package.

     
  • fl0g
    fl0g
    2012-01-22

    2richardbumann
    In my project I needs to classification spectrum. Can you show source code of your mlp-network?