简体   繁体   中英

DeepLearning4j‘s example compiled error

I got a few problems while programming with DeepLearning4j.

When I open and compile the example MnistMultiThreadedExample in Eclipse, these problems occured.

import org.deeplearning4j.datasets.iterator.impl.MnistDataSetIterator;
import org.deeplearning4j.datasets.test.TestDataSetIterator;
import org.deeplearning4j.iterativereduce.actor.multilayer.ActorNetworkRunner;**(error)**
import org.deeplearning4j.models.classifiers.dbn.DBN;**(error)**
import org.deeplearning4j.nn.conf.NeuralNetConfiguration;
import org.deeplearning4j.scaleout.conf.Conf;**(error)**

It is saying these package are not in the target package. And I couldn't find these modules in the package and couldn't find it in Maven Center Repository while I couldn't find the Class in Source Code.

Now I want to know how I get these modules and what should I do before creating a AutoEncoder which could running on Spark.

The example code is shown below:

import org.deeplearning4j.datasets.iterator.impl.MnistDataSetIterator;
import org.deeplearning4j.datasets.test.TestDataSetIterator;
import org.deeplearning4j.iterativereduce.actor.multilayer.ActorNetworkRunner;
import org.deeplearning4j.models.classifiers.dbn.DBN;
import org.deeplearning4j.nn.conf.NeuralNetConfiguration;
import org.deeplearning4j.scaleout.conf.Conf;

public class MnistMultiThreadedExample {
    public static void main(String[] args) throws Exception {
        //5 batches of 100: 20 each
        MnistDataSetIterator mnist = new MnistDataSetIterator(20, 60000);
        TestDataSetIterator iter = new TestDataSetIterator(mnist);
        ActorNetworkRunner runner = new ActorNetworkRunner(iter);


        NeuralNetConfiguration conf2 = new NeuralNetConfiguration.Builder()
            .nIn(784).nOut(10).build();

        Conf conf = new Conf();
        conf.setConf(conf2);
        conf.getConf().setFinetuneEpochs(1000);
        conf.setLayerSizes(new int[]{500,250,100});
        conf.setMultiLayerClazz(DBN.class);
        conf.getConf().setnOut(10);
        conf.getConf().setFinetuneLearningRate(0.0001f);
        conf.getConf().setnIn(784);
        conf.getConf().setL2(0.001f);
        conf.getConf().setMomentum(0.5f);
        conf.setSplit(10);
        conf.getConf().setUseRegularization(false);
        conf.setDeepLearningParams(new Object[]{1,0.0001,1000});
        runner.setup(conf);

        runner.train();

    }

}

You should add the following dependency to your POM:

<dependency>
    <groupId>org.deeplearning4j</groupId>
    <artifactId>deeplearning4j-scaleout-akka</artifactId>
    <version>0.0.3.3</version>
</dependency>

This will add as transitive dependencies deeplearning4j-scaleout-api and deeplearning4j-core . Those three dependencies will provide you the imports you are missing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM