GithubHelp home page GithubHelp logo

dj-core's Introduction

DeepJava

Read this in other languages: Русский

DeepJava (DJ) is a DeepLearning framework. One might ask: why do we need yet another DeepLearning framework? Good question. There is, at least, one thing that makes DJ different: it is, mainly, for the educational purpose. What does this mean exactly:

  • Codebase should be understandable (not fast). Anyone who has read a book about DeepLearning should be able to map main concepts from the book to the code in this framework (if concept already implemented);
  • You can experiment. Educational purpose means that the framework open for the experiments. Do you have an idea how to represent a computational graph in a non-canonical way? You can try it here!
  • Simple to use. DJ prioritizing the simplicity over the speed, such priority would not be possible with other frameworks.

Usage Example

1 Layer Perceptron With Sigmoid Activation Function

Network that we are building is describe in the chapter 2.

Context context = new Context(
         /* learningRate */ 0.2, 
         /* debug mode */ false);

InputNeuron inputFriend = new InputNeuron("friend");
InputNeuron inputVodka = new InputNeuron("vodka");
InputNeuron inputSunny = new InputNeuron("sunny");

ConnectedNeuron outputNeuron
        = new ConnectedNeuron.Builder()
            .bias(0.1)
            .activationFunction(new Sigmoid())
            .context(context)
            .build();

inputFriend.connect(outputNeuron, wFriend);
inputVodka.connect(outputNeuron, wVodka);
inputSunny.connect(outputNeuron, wSunny);

// Sending input signal to the graph:
inputFriend.forwardSignalReceived(null, 1.);
inputVodka.forwardSignalReceived(null, 1.);
inputSunny.forwardSignalReceived(null, 1.);

// Getting result and calculating the error:
double result = outputNeuron.getForwardResult();
double expectedResult = 1.;
double errorDy = 2 * (expectedResult - result);

// Sending error back to the graph:
outputNeuron.backwardSignalReceived(errorDy);

How To Contribute

There are several ways:

  • open bug/issue if you have found something or want us to do something;
  • submit a PR;

dj-core's People

Contributors

andrey-kotkovets avatar b0noi avatar glaizier 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dj-core's Issues

Attempt to deserialize model throws error (serialVersionUID is broken)

java.io.InvalidClassException: com.dj.core.serializer.ModelWrapper; local class incompatible: stream classdesc serialVersionUID = -5674594797353358206, local class serialVersionUID = 6179854597939874036
at java.base/java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:689)
at java.base/java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1894)
at java.base/java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1763)
at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2051)
at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1585)
at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)
at com.dj.core.serializer.SerializerHelper.deserializeFromFile(SerializerHelper.java:25)
at com.dj.models.mnist.MnistTrainerTest.testTrainMnistContinue(MnistTrainerTest.java:21)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

Create the ability to notify observer when training iteration is done

Currently, there is no way to tell when the graph has processed the iteration. There should be a way to attach a listener to the graph and listen when an iteration is over. Currently, you can find Thread.sleep in the tests. Basically, we just assuming that some time of waiting is enough for the graph to process the calculation.

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.