DeepLearning4j的示例编译错误

时间:2015-10-05 15:54:19

标签: java eclipse scala maven deep-learning

使用DeepLearning4j进行编程时遇到了一些问题。

当我在Eclipse中打开并编译示例MnistMultiThreadedExample时,会出现这些问题。

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)**

据说这些包不在目标包中。而且我无法在包中找到这些模块,而在Maven Center Repository中找不到这些模块,而我却无法在源代码中找到类。

现在我想知道如何获得这些模块,以及在创建可以在Spark上运行的AutoEncoder之前我应该​​怎么做。

示例代码如下所示:

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();

    }

}

1 个答案:

答案 0 :(得分:1)

您应该将以下依赖项添加到您的POM:

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

这将添加为传递依赖deeplearning4j-scaleout-apideeplearning4j-core。这三个依赖项将为您提供缺少的导入。