{"id":22685160,"url":"https://github.com/lpapailiou/neuralnetwork","last_synced_at":"2026-02-15T01:03:40.042Z","repository":{"id":54310050,"uuid":"296150613","full_name":"lpapailiou/neuralnetwork","owner":"lpapailiou","description":"A java library providing a configurable neural network. Supports supervised learning and genetic algorithm.","archived":false,"fork":false,"pushed_at":"2022-11-06T14:54:22.000Z","size":112430,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-12T04:37:36.530Z","etag":null,"topics":["ai","configurable","flexible","genetic-algorithm","java","java-8","library","machine-learning","machine-learning-algorithm","maven","maven-library","maven-repository","neural-nets","neural-network","reinforcement-learning","supervised-learning","supervised-machine-learning","unsupervised-learning","unsupervised-machine-learning"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lpapailiou.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-16T21:20:53.000Z","updated_at":"2024-07-07T15:00:42.000Z","dependencies_parsed_at":"2022-08-13T11:40:34.887Z","dependency_job_id":null,"html_url":"https://github.com/lpapailiou/neuralnetwork","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/lpapailiou/neuralnetwork","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lpapailiou%2Fneuralnetwork","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lpapailiou%2Fneuralnetwork/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lpapailiou%2Fneuralnetwork/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lpapailiou%2Fneuralnetwork/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lpapailiou","download_url":"https://codeload.github.com/lpapailiou/neuralnetwork/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lpapailiou%2Fneuralnetwork/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29463554,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T01:01:38.065Z","status":"ssl_error","status_checked_at":"2026-02-15T01:01:23.809Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","configurable","flexible","genetic-algorithm","java","java-8","library","machine-learning","machine-learning-algorithm","maven","maven-library","maven-repository","neural-nets","neural-network","reinforcement-learning","supervised-learning","supervised-machine-learning","unsupervised-learning","unsupervised-machine-learning"],"created_at":"2024-12-09T22:13:24.010Z","updated_at":"2026-02-15T01:03:40.025Z","avatar_url":"https://github.com/lpapailiou.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"![architecture](doc/img/nn_architecture.png)    \n\n# neural network\nThis is a maven library for neural networks in java 8.  \nDifferent visualization options are provided with javafx.  \n\n## Table of Contents\n1. [About](#about)\n2. [Scope](#scope)  \n    2.1 [Architecture](#architecture)  \n    2.2 [Supported algorithms](#supported-algorithms)  \n    2.3 [Initializers](#initializers)  \n    2.4 [Rectifiers](#rectifiers)  \n    2.5 [Cost functions](#cost-functions)  \n    2.6 [Optimizers](#learning-and-mutation-rate-optimizer)  \n    2.7 [Parametrization](#parametrization)  \n    2.8 [Persistence](#persistence)  \n    2.9 [UI](#ui)  \n3. [Samples](#samples)  \n   3.1 [Overview](#overview)   \n   3.2 [Walkthrough](#walkthrough)\n4. [Implementation](#implementation)  \n5. [Releases](#releases)\n6. [References](#references)\n\n## About\nThe motivation for this library originated in the study project [snakeML](https://github.com/lpapailiou/SnakeML),\nwhere the game snake was to be solved by neural networks. The rudimentary approach was extracted to this library\nand improved over time to study both neural networks and play around with java.  \nThe goal of this library is to make neural networks easily accessible in terms of 'how does it work' and to\nprovide an easy-to-use and plug-and-play-tool for other projects.  \nWhile the first steps focused on functionality, later work focused on different approaches of visualization with javafx.\n\n## Scope\n### Architecture\n- fully connected\n- none to many hidden layers supported\n- node count per layer is configurable\n\n### Supported algorithms\n- Supervised learning\n- Genetic algorithm\n\n### Initializers\n- Static\n- Random\n- Xavier\n- Kaiming\n\n### Rectifiers\nImplemented are following rectifiers:\n- Identity\n- RELU\n- Leaky RELU\n- Sigmoid\n- Sigmoid (accurate)\n- SILU\n- SILU (accurate)\n- TANH\n- ELU\n- GELU\n- Softplus\n- Softmax\n\n### Cost functions\n- MSE native\n- MSE\n- Cross entropy\n- Exponential\n- Hellinger distance\n- KLD\n- GKLD\n- ISD\n\n### Optimizers\n- none (static)\n- stochastic gradient descent (applicable to learning rate and mutation rate)\n- dropout\n\n### Parametrization\nThe parametrization of the hyperparameters of the neural network can be done as following:\n- programmatically\n- by `neuralnetwork.properties` in case default values are used constantly\n\n### Persistence\n- neural network instances are fully serializable\n\n### UI\nWith the additional ui package, you may be able to visualize the neural network and additional metrics interactively based on the ``javafx`` framework.\n  \n## Samples\n### Overview\nIn order to have an idea about the look and feel, see following samples which were created with this library.  \n\nSample code for a minimal prediction task:\n\n    double[] in = {1,0.5};                                              // input values\n    NeuralNetwork neuralNetwork = new NeuralNetwork.Builder(2, 4, 1)\n        .setDefaultRectifier(Rectifier.SIGMOID)\n        .setLearningRate(0.8)\n        .build();                                                       // initialization\n    List\u003cDouble\u003e out = neuralNetwork.predict(in);                       // prediction\n\nLive visualization of a predicting neural network:   \n\n![architecture](doc/img/nn_graph_demo.gif)\n\nLine charts of available rectifiers:  \n\n![rectifiers](doc/img/rectifier.png)\n\nVisualization of weights of a layer per node and overall, trained on mnist:    \n\n![layer weights](doc/img/weight_plots.png)\n\nConfusion matrix visualization:  \n\n![confusion matrix](doc/img/confusion_matrix.png)\n\nBinary decision boundaries in 2D and 3D, manually refreshed while training on xor dataset:\n\n![binary decision boundaries](doc/img/2d_db_demo.gif)\n\nMulticlass decision boundaries in 3D, animated:\n\n![multiclass decision boundaries](doc/img/3d_db_demo.gif)  \n\n[Fully integrated sample ui for rudimentary analysis of tsp problem](https://github.com/lpapailiou/tspwalker):\n\n![multiclass decision boundaries](doc/img/tsp_demo.gif)\n### Walkthrough\nDetailed examples are available here:\n\n| Topic \t| Description \t| \n|-----\t|---------\t|\n| [basic usage](doc/WT_01_basic_usage.md) | constructor, methods, basic features |\n| [supervised learning](doc/WT_02_supervised_learning.md) | implementation example |\n| [genetic algorithm](doc/WT_03_genetic_algorithm.md) | implementation example |\n| [visualization](doc/WT_04_visualizations.md) | charts, decision boundaries, confusion matrix, layer weights etc. in 2D and 3D |\n\n## Implementation\nThis library can be either implemented by jar file or as maven dependency.  \nDetailed instructions are documented [here](doc/implementation.md).\n\n## Releases\nAs this project started 'fun project' and the concept of 'free time' is more a fairy tale than reality, \nthere is not a proper version control (yet).  \nIn general, the neural netowrk algorithm is quite stable, no big changes are to be expected soon.  \nBefore new features are introduced, a stable, consistent realease will be made.\n\n| Release \t| Description \t| \n|-----\t|---------\t|\n| upcoming   \t| stable, consistent release, focusing on consistency        \t|\n| [3.1](https://github.com/lpapailiou/neuralnetwork/releases/latest)   \t| mostly minor fixes and features added, currently treated as snapshot        \t|\n| 3.0    \t| introduction of charts and other visualizations, lot of refactoring        \t|\n| \u003c= 2.5    | multiple releases focusing on the neural network algorithm        \t|\n\n## References\nCode:\n- [Sonawane, Suyash: JAvaNet, GitHub Repository, 2021.](https://github.com/SuyashSonawane/JavaNet) (first steps)\n- [https://stackoverflow.com/](https://stackoverflow.com/) (coding hints)\n\nLiterature:\n- [Bialas, Piotr: _Implementation of artifical intelligence in Snake game using genetic algorithm and neural networks_, CEUR 2468, 2019.](http://ceur-ws.org/Vol-2468/p9.pdf)\n- Chollet, Francois: _Deepl Learning mit Python und Kears. Das Praxis-Handbuch_. mitp Verlags GmbH \u0026 Co. KG, Frechen, 2018. (978-3-95845-838-3)\n- Geron, Aurelien: _Hands.On Machine Learning with Scikit-Learn, Keras \u0026 TensorFlow. Concepts, Tools, and Techniques to Build Intelligent Systems_. Second Edition, O'Reilly, Canada 2019. (978-1-492-03264-9)\n- [Hansen, Casper: _Neural Networks: Feedforward and Backpropagation Explained \u0026 Optimization_. Deep Learning, mlfromscratch, 5.08.2019.](https://mlfromscratch.com/activation-functions-explained/#/)\n- [Hansen, Casper: _Activation Functions Explained - GELU, SELU, ELU, ReLU and more_. Deep Learning, mlfromscratch, 22.08.2019.](https://mlfromscratch.com/activation-functions-explained/#/)\n- [Karpathy, Andrej: _CS231n Winter 2016_, Stanford Universy, Youtube, 2016.](https://www.youtube.com/watch?v=NfnWJUyUJYU\u0026list=PLkt2uSq6rBVctENoVBg1TpCC7OQi31AlC)\n- Lapan, Maxim: _Deep Reinforcement Learning Hands-On_. Second Edition, Packt Publishing, Birmingham, 2020. (978-1-83882-699-4)\n- Steinwendner, Joachim et. al: _Neuronale Netzw programmieren mit Python. 2_. Auflage, Rheinwerk Verlag, 2020. (978-3-8362-7450-0)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flpapailiou%2Fneuralnetwork","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flpapailiou%2Fneuralnetwork","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flpapailiou%2Fneuralnetwork/lists"}