gpt4 book ai didi

java - DeepLearning4j的示例编译错误

转载 作者:行者123 更新时间:2023-11-30 07:53:56 25 4
gpt4 key购买 nike

我在使用 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();

}

}

最佳答案

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

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

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

关于java - DeepLearning4j的示例编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32952742/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com