【问题标题】:DeepLearning4j‘s example compiled errorDeepLearning4j 的示例编译错误
【发布时间】:2015-10-05 15:54:19
【问题描述】:

我在使用 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 中心存储库中找不到它,而在源代码中找不到类。

现在我想知道如何获得这些模块,以及在创建可以在 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();

    }

}

【问题讨论】:

标签: java eclipse scala maven deep-learning


【解决方案1】:

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

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

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

【讨论】:

  • 感谢您的回答。我下载了 0.3.2 版、0.3.3 版和 0.3.4 版的这些软件包。我按版本导入它们,但问题仍然存在。我无法解决问题......顺便说一句,我得到了名为“dl4j-spark”的库,它可以帮助我解决其他问题。 :)
  • @suanec 你下载它们是什么意思?你是手动做的吗?您是否在 POM 中添加了依赖项是我的答案,在 Eclipse 中您是否执行了“Maven > 更新项目”?
  • 我是从“oss.sonatype.org/content/repositories/snapshots/org/…”手动下载的。而且我创建了一个普通的scala项目而不是maven项目,所以它没有POM,我无法更新项目,而我只是自己做......我是学生,项目很简单,所以我打包它只是在eclipse中使用EXPORT。
  • @suanec 我的回答就像您使用的是 Maven 项目一样,因为您的问题被标记为 Maven。您应该下载我在回答中提到的 3 个库。
  • 感谢您的帮助。我对学习 dl4j 很满意。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-09-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-09-11
  • 1970-01-01
相关资源
最近更新 更多