Git Product home page Git Product logo

deeplearning4j / deeplearning4j Goto Github PK

View Code? Open in Web Editor NEW
13.4K 769.0 3.8K 730.94 MB

Suite of tools for deploying and training deep learning models using the JVM. Highlights include model import for keras, tensorflow, and onnx/pytorch, a modular and tiny c++ library for running math code and a java based math library on top of the core c++ library. Also includes samediff: a pytorch/tensorflow like library for running deep learning using automatic differentiation.

Home Page: http://deeplearning4j.konduit.ai

License: Apache License 2.0

Java 65.63% Shell 0.15% JavaScript 0.45% CSS 0.02% FreeMarker 0.12% TypeScript 0.12% Ruby 0.01% HTML 0.03% Python 0.12% CMake 0.19% C++ 26.37% Cuda 3.37% C 0.26% Smarty 0.01% PureBasic 0.02% Starlark 0.01% Kotlin 3.11% Cython 0.02%
java gpu deeplearning neural-nets deeplearning4j dl4j hadoop spark intellij artificial-intelligence

deeplearning4j's Introduction

Documentation Get help at the community forum javadoc javadoc License GitHub commit activity

The Eclipse Deeplearning4J (DL4J) ecosystem is a set of projects intended to support all the needs of a JVM based deep learning application. This means starting with the raw data, loading and preprocessing it from wherever and whatever format it is in to building and tuning a wide variety of simple and complex deep learning networks.

Because Deeplearning4J runs on the JVM you can use it with a wide variety of JVM based languages other than Java, like Scala, Kotlin, Clojure and many more.

The DL4J stack comprises of:

  • DL4J: High level API to build MultiLayerNetworks and ComputationGraphs with a variety of layers, including custom ones. Supports importing Keras models from h5, including tf.keras models (as of 1.0.0-beta7) and also supports distributed training on Apache Spark
  • ND4J: General purpose linear algebra library with over 500 mathematical, linear algebra and deep learning operations. ND4J is based on the highly-optimized C++ codebase LibND4J that provides CPU (AVX2/512) and GPU (CUDA) support and acceleration by libraries such as OpenBLAS, OneDNN (MKL-DNN), cuDNN, cuBLAS, etc
  • SameDiff : Part of the ND4J library, SameDiff is our automatic differentiation / deep learning framework. SameDiff uses a graph-based (define then run) approach, similar to TensorFlow graph mode. Eager graph (TensorFlow 2.x eager/PyTorch) graph execution is planned. SameDiff supports importing TensorFlow frozen model format .pb (protobuf) models. Import for ONNX, TensorFlow SavedModel and Keras models are planned. Deeplearning4j also has full SameDiff support for easily writing custom layers and loss functions.
  • DataVec: ETL for machine learning data in a wide variety of formats and files (HDFS, Spark, Images, Video, Audio, CSV, Excel etc)
  • LibND4J : C++ library that underpins everything. For more information on how the JVM acceses native arrays and operations refer to JavaCPP
  • Python4J: Bundled cpython execution for the JVM

All projects in the DL4J ecosystem support Windows, Linux and macOS. Hardware support includes CUDA GPUs (10.0, 10.1, 10.2 except OSX), x86 CPU (x86_64, avx2, avx512), ARM CPU (arm, arm64, armhf) and PowerPC (ppc64le).

Community Support

For support for the project, please go over to https://community.konduit.ai/

Using Eclipse Deeplearning4J in your project

Deeplearning4J has quite a few dependencies. For this reason we only support usage with a build tool.

<dependencies>
  <dependency>
      <groupId>org.deeplearning4j</groupId>
      <artifactId>deeplearning4j-core</artifactId>
      <version>1.0.0-M2.1</version>
  </dependency>
  <dependency>
      <groupId>org.nd4j</groupId>
      <artifactId>nd4j-native-platform</artifactId>
      <version>1.0.0-M2.1</version>
  </dependency>
</dependencies>

Add these dependencies to your pom.xml file to use Deeplearning4J with the CPU backend. A full standalone project example is available in the example repository, if you want to start a new Maven project from scratch.

Code samples

Due to DL4J being a multi faceted project with several modules in the mono repo, we recommend looking at the examples for a taste of different usages of the different modules. Below we'll link to examples for each module.

  1. ND4J: https://github.com/deeplearning4j/deeplearning4j-examples/tree/master/nd4j-ndarray-examples
  2. DL4J: https://github.com/deeplearning4j/deeplearning4j-examples/tree/master/dl4j-examples
  3. Samediff: https://github.com/deeplearning4j/deeplearning4j-examples/tree/master/samediff-examples
  4. Datavec: https://github.com/deeplearning4j/deeplearning4j-examples/tree/master/data-pipeline-examples
  5. Python4j: https://deeplearning4j.konduit.ai/python4j/tutorials/quickstart

For users looking for being able to run models from other frameworks, see:

  1. Onnx: https://github.com/deeplearning4j/deeplearning4j-examples/tree/master/onnx-import-examples
  2. Tensorflow/Keras: https://github.com/deeplearning4j/deeplearning4j-examples/tree/master/tensorflow-keras-import-examples

Documentation, Guides and Tutorials

You can find the official documentation for Deeplearning4J and the other libraries of its ecosystem at http://deeplearning4j.konduit.ai/.

Want some examples?

We have separate repository with various examples available: https://github.com/eclipse/deeplearning4j-examples

Building from source

It is preferred to use the official pre-compiled releases (see above). But if you want to build from source, first take a look at the prerequisites for building from source here: https://deeplearning4j.konduit.ai/multi-project/how-to-guides/build-from-source. Various instructions for cpu and gpu builds can be found there. Please go to our forums for further help.

Running tests

In order to run tests, please see the platform-tests module. This module only runs on jdk 11 (mostly due to spark and bugs with older scala versions + JDK 17)

platform-tests allows you to run dl4j for different backends. There are a few properties you can specify on the command line:

  1. backend.artifactId: this defaults to nd4j-native and will run tests on cpu,you can specify other backends like nd4j-cuda-11.6
  2. dl4j.version: You can change the dl4j version that the tests run against. This defaults to 1.0.0-SNAPSHOT.

More parameters can be found here:

<platform.classifier>${javacpp.platform}</platform.classifier>

Running project in Intellij IDEA:

  1. Ensure you follow https://stackoverflow.com/questions/45370178/exporting-a-package-from-system-module-is-not-allowed-with-release on jdk 9 or later
  2. Ignore all nd4j-shade submodules. Right click on each folder and click: Maven -> Ignore project

License

Apache License 2.0

Commercial Support

Deeplearning4J is actively developed by the team at Konduit K.K..

[If you need any commercial support feel free to reach out to us. at [email protected]

deeplearning4j's People

Contributors

aboulang2002 avatar agibsonccc avatar ahmed-mahran avatar alexanderst avatar alexdblack avatar atuzhykov avatar bam4d avatar basedrhys avatar dariuszzbyrad avatar eraly avatar farizrahman4u avatar foorcee avatar hosuaby avatar jljljl avatar jxtps avatar kolyaivankov avatar maxpumperla avatar olegsemeniv avatar printomi avatar pza94 avatar quickwritereader avatar raver119 avatar robaltena avatar saudet avatar shamsulazeem avatar shugeo avatar shyrma avatar sshepel avatar totolastro avatar treo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deeplearning4j's Issues

print config

print configurations for neural network debugging

Incompatible operand types Object and char

Hi,

There is an error when I try to compile the source of deeplearning4j-core.
The bug is found at files ComplexNDArray.java and NDArray.java

Object[] copy = ...
if(copy[i] == ':')
...

Since object 'copy' is an array which contains the objects of type 'Object', so it is unable to compare 'copy[i]' to a char directly.
Shall we change if(copy[i] == ':') to if((char)copy[i] == ':') ?
Could you please fix this bug ?

Best regards,
Kai

Stemmer exception when training word2vec with the supplied tweets_clean.txt file!

Hi,

I've tried to run the word2vec (using the supplied Uima tokenizer) and I keep getting this error for many of the words in the sentences. Are you aware of this bug?

It seems to happen in the find_among_b method in "org.tartarus.snowball.SnowballProgram", for some reason it accesses an out of the range index.

The exception is catched in some catch{} expression and the program continues to run, but I'm almost sure it doesn't learn anything...

14:24:25,274 ERROR ~ org.apache.uima.analysis_engine.AnalysisEngineProcessException: Annotator processing failed.
java.lang.RuntimeException: org.apache.uima.analysis_engine.AnalysisEngineProcessException: Annotator processing failed.
at org.deeplearning4j.text.tokenizer.UimaTokenizer.(UimaTokenizer.java:60)
at org.deeplearning4j.text.tokenizerfactory.UimaTokenizerFactory.create(UimaTokenizerFactory.java:48)
at org.deeplearning4j.word2vec.Word2Vec.trainSentence(Word2Vec.java:430)
at org.deeplearning4j.word2vec.Word2Vec.processSentence(Word2Vec.java:415)
at org.deeplearning4j.word2vec.Word2Vec$2.call(Word2Vec.java:361)
at org.deeplearning4j.word2vec.Word2Vec$2.call(Word2Vec.java:357)
at akka.dispatch.Futures$$anonfun$future$1.apply(Future.scala:94)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: org.apache.uima.analysis_engine.AnalysisEngineProcessException: Annotator processing failed.
at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:394)
at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.processAndOutputNewCASes(PrimitiveAnalysisEngine_impl.java:298)
at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:568)
at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.(ASB_impl.java:410)
at org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:343)
at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:265)
at org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:267)
at org.deeplearning4j.text.tokenizer.UimaTokenizer.(UimaTokenizer.java:41)
... 14 more
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 7
at java.lang.AbstractStringBuilder.charAt(AbstractStringBuilder.java:210)
at java.lang.StringBuilder.charAt(StringBuilder.java:76)
at org.tartarus.snowball.SnowballProgram.find_among_b(SnowballProgram.java:318)
at org.tartarus.snowball.ext.EnglishStemmer.r_exception2(EnglishStemmer.java:999)
at org.tartarus.snowball.ext.EnglishStemmer.stem(EnglishStemmer.java:1230)
at org.cleartk.token.stem.snowball.SnowballStemmer.process(SnowballStemmer.java:101)
at org.apache.uima.analysis_component.JCasAnnotator_ImplBase.process(JCasAnnotator_ImplBase.java:48)
at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:378)
... 21 more

MnistExample causes an IllegalStateException

While trying to run MnistExample, I am getting an IllegalStateException:

Exception in thread "main" java.lang.RuntimeException: java.lang.IllegalStateException: Hidden unit type must either be rectified linear or binary
    at org.deeplearning4j.nn.BaseMultiLayerNetwork$Builder.build(BaseMultiLayerNetwork.java:3284)
    at org.deeplearning4j.dbn.DBN$Builder.build(DBN.java:801)
    at org.deeplearning4j.example.mnist.MnistExample.main(MnistExample.java:40)
Caused by: java.lang.IllegalStateException: Hidden unit type must either be rectified linear or binary
    at org.deeplearning4j.rbm.RBM.sampleHiddenGivenVisible(RBM.java:350)
    at org.deeplearning4j.nn.BaseMultiLayerNetwork.init(BaseMultiLayerNetwork.java:383)
    at org.deeplearning4j.nn.BaseMultiLayerNetwork.initializeLayers(BaseMultiLayerNetwork.java:344)
    at org.deeplearning4j.nn.BaseMultiLayerNetwork$Builder.build(BaseMultiLayerNetwork.java:3271)
    ... 2 more

DBN.Builder.withHiddenUnits() doesn't work as designed

it doesn't work as designed since the layers are initilized in BaseMultiLayerNetwork.Builder.build() before the execution of DBN.Builder.build(). The layers will be initialized without the hidden units setting. The situation of visible units is similar.

Unable to compile

$  mvn clean install -DskipTests

Give me this:

.....
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project deeplearning4j-core: Compilation failure
[ERROR] /home/robin/Development/contrib/java-deeplearning/deeplearning4j-core/src/test/java/org/deeplearning4j/dbn/DBNTest.java:[272,45] cannot find symbol
[ERROR] symbol:   method feedForwardROperator()
[ERROR] location: variable dbn of type org.deeplearning4j.dbn.DBN
[ERROR] -> [Help 1]
...

Question about DBN Tutorial

Hi, when I run RawDBNMnistExample tutorial code with 60K Data samples I get F1 Score: 0.17815947022600515 = 82% is that normal? Do you have configuration parameters that allow level above 95%?

testDbnStructure() failed!

23:45:34,930 |-INFO in ch.qos.logback.core.FileAppender[FILE] - File property is set to [logs/application.log]
23:45:34,932 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
23:45:34,935 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
23:45:34,940 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
23:45:34,944 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.apache.catalina.core] to DEBUG
23:45:34,944 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.springframework] to DEBUG
23:45:34,944 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.deeplearning4j] to INFO
23:45:34,944 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to ERROR
23:45:34,944 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
23:45:34,945 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [FILE] to Logger[ROOT]
23:45:34,945 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
23:45:34,948 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@781d0abf - Registering current configuration as safe fallback point

java.lang.NullPointerException
at org.deeplearning4j.nn.BaseMultiLayerNetwork.feedForward(BaseMultiLayerNetwork.java:501)
at org.deeplearning4j.nn.BaseMultiLayerNetwork.feedForward(BaseMultiLayerNetwork.java:525)
at org.deeplearning4j.dbn.DBNTest.testDbnStructure(DBNTest.java:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

Process finished with exit code 255

Iris flower dataset can not be classified by CDBN

Hello, Adam,

We have a case to map real input values into low dimensional binary vectors. So we use CDBN here, but whatever I change the parameter combinations of k, lr or epochs, it always failed to classify our dataset.

Under such a situation, I wrote a simple iris dataset test to verify my understanding
https://github.com/guokr/neuseg/blob/master/test/com/guokr/dbn/IrisTest.java

It fails again and again under different params. for one example:

under k = 50, lr = 0.001, and epochs = 1000, the output is

[0.460480, 0.503034, 0.036486;
0.460480, 0.503034, 0.036486;
0.460480, 0.503034, 0.036486]

but it should be

[1, 0, 0;
0, 1, 0;
0, 0, 1]

or some approximative values.

So I am not sure whether my understanding is wrong or some bugs exists.

Thanks for your help!

LineSentenceiterator: Resetting to invalid mark

As already posted on the mailing list, when training a Word2Vec model fed from a LineSentenceIterator, the following exception is thrown:

Exception in thread "main" java.lang.RuntimeException: java.io.IOException: Resetting to invalid mark
    at org.deeplearning4j.word2vec.sentenceiterator.LineSentenceIterator.reset(LineSentenceIterator.java:64)
    at org.deeplearning4j.word2vec.Word2Vec.train(Word2Vec.java:395)
    ... 2 more
Caused by: java.io.IOException: Resetting to invalid mark
    at java.io.BufferedInputStream.reset(BufferedInputStream.java:437)
    at org.deeplearning4j.word2vec.sentenceiterator.LineSentenceIterator.reset(LineSentenceIterator.java:61)
    ... 3 more

I did some basic debugging and figured that this happens because the InputReader's markpos field is set to -1 when reset() is called. However, I haven't been able to fix it because I don't really understand why reset() is called in the first place.

About java.io.tmpdir

On Mac OS X system, sometimes, the "java.io.tmpdir" is not equal to "/tmp". It cause 3 UnitTests failed.
I suggest replacing "java.io.tmpdir" by "user.home" and removing all "/tmp".
It will work on any OS.

Can't compile for some reason, I get this error in GradientStatisticsAspect.java:1:0::0 The type java. lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files

[ERROR] Failed to execute goal org.codehaus.mojo:aspectj-maven-plugin:1.6:compil
e (default) on project deeplearning4j-instrumentation: Compiler errors:
[ERROR] error at (no source information available)
[ERROR] C:\word2vec\deeplearning4j-instrumentation\src\main\java\org\deeplearnin
g4j\instrumentation\gradient\GradientStatisticsAspect.java:1:0::0 The type java.
lang.CharSequence cannot be resolved. It is indirectly referenced from required
.class files
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command

[ERROR] mvn -rf :deeplearning4j-instrumentation
C:\word2vec>

deeplearning4j-examples fails to compile

deeplearning4j-examples/pom.xml lists nd4j as a dependency. However it specified the required nd4 version as 0.0.3-SNAPSHOT. But the current version of nd4j seems to be 0.0.2-SNAPSHOT.

A possible bug!

Hello,

I am trying my hands on this very nice library.
I think, I came across a possible bug in

deeplearning4j-scaleout / deeplearning4j-scaleout-akka-word2vec / src / main / java / org / deeplearning4j / word2vec / sentenceiterator / LineSentenceIterator.java
at method call
at line 36:
public String nextSentence() {
return iter.nextLine();
}

Here we are not doing any preprocessing of the sentence string.

I have updated it to:
public String nextSentence() {
String line = iter.nextLine();
if (preProcessor != null) {
line = preProcessor.preProcess(line);
}
return line;
}

I have also test it, it seems like it's doing its job now.

Please accept my apologies, if I understood something wrong.

Kind Regards,
Saurabh

advice

I am very happy to see so great a project in github.Thank you very much for that.
But I am confused by the codes.
When I run the examples, such as the org.deeplearning4j.example.text. I find that there is no readme.txt in this, so I don't know how to run this program right. If I can't run the program right,I will don't understand the priciple of this codes.

You just give the codes to us, But not help docs or readme.md or readme.txt to let us know how to run.

So I advise that give the readme.md to every example.
Thankyou very much.

issue in the default output activation function of BaseMultiLayerNetwork

private ActivationFunction outputActivationFunction = Activations.softmax(); should be private ActivationFunction outputActivationFunction = Activations.softmax(true);

otherwise, a column wise softmax function will be applied to the output matrix. i.e. the sum of each column is 1. The correct output should have a row summation which is one.

API Changes

Hi,

the API lacks a little bit of clarity for newcomers. Nothing serious, but it would be great if it would be more similar to standard ML tools, like scikit learn. May I suggest the following changes:

  • DataSet API extends Pair<DoubleMatrix,DoubleMatrix>. To access the input I have to call getFirst(), for the label getSecond(). This should be renamed to getInstance() and getLabel() or so.
  • One could think splitting label and instance data to x and y like sklearn. However this makes sorting / shuffling a little but more cumbersome. As other tools (weka, rapid miner, jstats) all have a similar API, its not such a big show stopper.
  • Change train() methods to fit() like in sklearn.
  • There are quite a lot of classes for loaded the datasets. There are DataSet Iterators, Datasheets and some Vectorizers, which are somehow wrapped in the fetchers or so.
    • I think there is no need for an extra DataFetcher object, because the BaseDataSetIterator just wraps it and adds batching. To keep the API simple it might be easier to just provide an AbstractDataSetIterator class with some abstract template method to user have to implement. Off course in the end the user just has to implement the iterator and he can compose it as he wants, but at least the default way should be straight forward.
    • In general I think it is a good idea to encapsulate the vectorization process in an own object. However,
    • Why has the Fetcher and fetch(int count) and an next() method. Does it make sense to merge them to next(int size)? Or is this need for some parallel tasks?

Cheers,

Klaus

[NaN, NaN, NaN] Issue in OutputLayer

Hi,

I tried to use the DBN implementation for 3-class classification. However, the OutputLayer outputs [NaN, NaN, NaN]. During debugging, I found W was changed to null, even I initialized W by VI. Do you have any idea on how to debug further? Thank you!

Philip

RBMMnistExample bursts IllegalStateException

While runnting RBMMnistExample i found log prints IllegalStateException from time to time:

o.d.o.VectorizedNonZeroStoppingConjugateGradient - main ConjugateGradient: At iteration 36, cost = -18.837405005489632 -252
o.d.o.VectorizedNonZeroStoppingConjugateGradient - main ConjugateGradient: At iteration 37, cost = -18.836003822209044 -260
o.d.o.VectorizedNonZeroStoppingConjugateGradient - main ConjugateGradient: At iteration 38, cost = -18.826010155314044 -259
o.d.o.VectorizedNonZeroStoppingConjugateGradient - main ConjugateGradient: At iteration 39, cost = -18.801607309469183 -256
o.d.o.VectorizedNonZeroStoppingConjugateGradient - main ConjugateGradient: At iteration 40, cost = -18.798041251079763 -278
o.d.o.VectorizedNonZeroStoppingConjugateGradient - main ConjugateGradient: At iteration 41, cost = -18.791075687498086 -262
o.d.o.VectorizedNonZeroStoppingConjugateGradient - Error during computation
java.lang.IllegalStateException: Slope = -0.02802297635066623 is negative
    at org.deeplearning4j.optimize.VectorizedBackTrackLineSearch.optimize(VectorizedBackTrackLineSearch.java:123) ~[classes/:na]
    at org.deeplearning4j.optimize.VectorizedNonZeroStoppingConjugateGradient.optimize(VectorizedNonZeroStoppingConjugateGradient.java:141) ~[classes/:na]
    at org.deeplearning4j.optimize.NeuralNetworkOptimizer.train(NeuralNetworkOptimizer.java:90) [classes/:na]
    at org.deeplearning4j.rbm.RBM.trainTillConvergence(RBM.java:523) [classes/:na]
    at org.deeplearning4j.example.mnist.RBMMnistExample.main(RBMMnistExample.java:33) [classes/:na]
o.d.o.VectorizedNonZeroStoppingConjugateGradient - ConjugateGradient converged: old value= -18.791075687498086 new value= -18.791075687498086 tolerance=1.0E-5
o.d.e.m.RBMMnistExample - [9 : 3, 8 : 2, 3 : 2, 7 : 1, 1 : 1, 5 : 1]
o.d.o.VectorizedNonZeroStoppingConjugateGradient - main ConjugateGradient: At iteration 0, cost = -23.68102767157365 -87
o.d.o.VectorizedNonZeroStoppingConjugateGradient - main ConjugateGradient: At iteration 1, cost = -21.672497403233965 -230
o.d.o.VectorizedNonZeroStoppingConjugateGradient - main ConjugateGradient: At iteration 2, cost = -20.155199809782495 -228

I am not sure, may be this is normal.

Distributed Word2Vec

Training a Word2Vec model on a large corpus (approximately 3 billion english words) takes a significant amount of time. On a Core i7- 8 core machine, it took approximately 24 hours to train. Distributing this will significantly reduce training time.

MiniBatch RNTN and Penn Treebank

It would be great to get the mini batch loading of the RNTNs and the penn treebank based features completed. Also, it would be good to integrate the Part of Speech tagging output and any sentiment input for those parts of speech as a feature set into the RNTN

UT failed

Run with:
mvn test -DXmx4096m -DXms2048m
Output:
testSetNewLabels(org.deeplearning4j.datasets.DataSetTest): Java heap space

org.deeplearning4j.sda.DenoisingTests#testOther failed

java.lang.ArrayIndexOutOfBoundsException: 1
at org.deeplearning4j.da.DenoisingAutoEncoder.getGradient(DenoisingAutoEncoder.java:177)
at org.deeplearning4j.nn.BaseNeuralNetwork.backProp(BaseNeuralNetwork.java:292)
at org.deeplearning4j.optimize.NeuralNetworkOptimizer.train(NeuralNetworkOptimizer.java:81)
at org.deeplearning4j.da.DenoisingAutoEncoder.trainTillConvergence(DenoisingAutoEncoder.java:101)
at org.deeplearning4j.sda.DenoisingTests.testOther(DenoisingTests.java:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runners.Suite.runChild(Suite.java:127)
at org.junit.runners.Suite.runChild(Suite.java:26)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

Quickstart example error

I'm getting an error when I try to run the quickstart example on OS 10.9.2

I deleted /tmp/MNIST, ran again, and got this error:

SLF4J: Actual binding is of type [ch.qos.logback.classic.selector.DefaultContextSelector]

o.d.b.MnistFetcher - Downloading mnist...

o.d.b.MnistFetcher - gunzip'ing File: /tmp/MNIST/train-images-idx1-ubyte.gz

o.d.b.MnistFetcher - Here is the standard error of the command (if any):

o.d.b.MnistFetcher - gunzip'ing File: /tmp/MNIST/train-labels-idx1-ubyte.gz

o.d.b.MnistFetcher - Here is the standard error of the command (if any):

Exception in thread "main" java.io.FileNotFoundException: /var/folders/l0/lq9_ldwn6v94d138pmpdkd3c0000gn/T/MNIST/train-images-idx1-ubyte (No such file or directory)

at java.io.RandomAccessFile.open(Native Method)

at java.io.RandomAccessFile.(RandomAccessFile.java:241)

at java.io.RandomAccessFile.(RandomAccessFile.java:122)

at org.deeplearning4j.datasets.mnist.MnistDbFile.(MnistDbFile.java:31)

at org.deeplearning4j.datasets.mnist.MnistImageFile.(MnistImageFile.java:29)

at org.deeplearning4j.datasets.mnist.MnistManager.(MnistManager.java:75)

at org.deeplearning4j.datasets.fetchers.MnistDataFetcher.(MnistDataFetcher.java:40)

at org.deeplearning4j.datasets.fetchers.MnistDataFetcher.(MnistDataFetcher.java:59)

at org.deeplearning4j.datasets.iterator.impl.MnistDataSetIterator.(MnistDataSetIterator.java:12)

at org.deeplearning4j.example.mnist.RBMMnistExample.main(RBMMnistExample.java:26)

LFWLoader problem on Mac OS X

The getIfNotExists() method won't work on Mac OS X.
Maybe the "lfwDir.exists()" always false?
The DBNTest will run into a infinite loop:
Running org.deeplearning4j.dbn.DBNTest
o.d.b.LFWLoader - Grabbing LFW...
o.d.b.LFWLoader - Downloaded lfw
o.d.b.LFWLoader - Untaring File: /Users/linkerlin/lfw/lfw.tgz
o.d.b.LFWLoader - Grabbing LFW...
o.d.b.LFWLoader - Downloaded lfw
o.d.b.LFWLoader - Untaring File: /Users/linkerlin/lfw/lfw.tgz
o.d.b.LFWLoader - Grabbing LFW...
o.d.b.LFWLoader - Downloaded lfw
o.d.b.LFWLoader - Untaring File: /Users/linkerlin/lfw/lfw.tgz
o.d.b.LFWLoader - Grabbing LFW...
o.d.b.LFWLoader - Downloaded lfw
o.d.b.LFWLoader - Untaring File: /Users/linkerlin/lfw/lfw.tgz
o.d.b.LFWLoader - Grabbing LFW...
o.d.b.LFWLoader - Downloaded lfw
o.d.b.LFWLoader - Untaring File: /Users/linkerlin/lfw/lfw.tgz
o.d.b.LFWLoader - Grabbing LFW...
^C

Cannot compile TensorTests.java!

/Users/linkerlin/github/local/java-deeplearning/deeplearning4j-core/src/test/java/org/deeplearning4j/nn/learning/TensorTests.java

Error:(46, 40) java: incompatible types
required: org.deeplearning4j.nn.Tensor
found: org.jblas.DoubleMatrix

Deeplearning4j for time series prediction

An interesting feature of dl4j could be the support for time series prediction.

As stated by Adam
"The pieces are there, but I don't have the basic support in place for "automatic vectorization" of time series data, however there is an implementation of the viterbi algorithm in there.
The pieces would be very similar to the moving window text classification."

Regards

Carlos

Some UTs failed

testWithMnist report a null point exception:
o.d.a.DeepAutoEncoderTest - Training on 27

java.lang.NullPointerException
at org.deeplearning4j.autoencoder.DeepAutoEncoder.initDecoder(DeepAutoEncoder.java:86)
at org.deeplearning4j.autoencoder.DeepAutoEncoder.(DeepAutoEncoder.java:34)
at org.deeplearning4j.autoencoder.DeepAutoEncoderTest.testWithMnist(DeepAutoEncoderTest.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runners.Suite.runChild(Suite.java:127)
at org.junit.runners.Suite.runChild(Suite.java:26)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

Hi,Adam

      I have one important quesion in https://groups.google.com/forum/#topic/deeplearning4j/hE2CwlgLMFM
      I have been worked for 3 days, But I can't solve it, I need your help.
      Thank you very much for you.

Do you support sparsing?

Some researchers claim dramatical increase of efficiency, if sparsing term is added to cost function. Sparsing term tends feature neurons to have mostly zero activation, except few ones. I.e. feature vector tends to appear sparsed.

It this approach implementable by deeplearning4j?

MnistExample Matrix Size Mismatch/Misinitalization

The default MnistExample.java, line 32, has the following lines:

        //batches of 10, 60000 examples total
        DataSetIterator iter = new MnistDataSetIterator(60000,60000);

I think perhaps this should be (10,60000) based on the comments.

Oddly, prior to making this change on my codebase, the 60000,60000 would fail at the fine-tuning step (dbn.finetune(next.getSecond(),1e-1,1000)) due to a matrix dimension mismatch. 100% reproducibility on that.

Word2Vec.iterate(VocabWord w1) is missing w2

The method iterate is missing the second word in the newest snapshot version. The calling method skipGram initializes the second word "VocabWord word2 = sentence.get(c1);" but word2 is never used.

About java.io.tmpdir

On Mac OS X system, sometimes, the "java.io.tmpdir" is not equal to "/tmp". It cause 3 UnitTests failed.
I suggest replacing "java.io.tmpdir" by "user.home" and removing all "/tmp".
It will work on any OS.

Recursive auto encoders

For modularity, it would be nice to have a recursive auto encoder class present in DL4J. The basic building blocks should be there and I think it will benefit users of the framework.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.