{"id":29625044,"url":"https://github.com/anjohan/neuralnetwork","last_synced_at":"2026-02-07T00:03:11.992Z","repository":{"id":83955757,"uuid":"156381192","full_name":"anjohan/neuralnetwork","owner":"anjohan","description":"Simple, parallel, object-oriented Fortran neural network","archived":false,"fork":false,"pushed_at":"2018-11-11T14:45:54.000Z","size":29,"stargazers_count":20,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-03-26T03:51:42.916Z","etag":null,"topics":["coarray-fortran","fortran","machine-learning","neural-network"],"latest_commit_sha":null,"homepage":"","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anjohan.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,"governance":null}},"created_at":"2018-11-06T12:35:12.000Z","updated_at":"2023-11-15T15:16:27.000Z","dependencies_parsed_at":"2023-03-01T01:16:20.201Z","dependency_job_id":null,"html_url":"https://github.com/anjohan/neuralnetwork","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"54d1d7585ab0b9854f86afd3f1b5c84f4e358b3b"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/anjohan/neuralnetwork","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anjohan%2Fneuralnetwork","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anjohan%2Fneuralnetwork/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anjohan%2Fneuralnetwork/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anjohan%2Fneuralnetwork/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anjohan","download_url":"https://codeload.github.com/anjohan/neuralnetwork/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anjohan%2Fneuralnetwork/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266248501,"owners_count":23899056,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["coarray-fortran","fortran","machine-learning","neural-network"],"created_at":"2025-07-21T06:07:10.916Z","updated_at":"2026-02-07T00:03:11.950Z","avatar_url":"https://github.com/anjohan.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Neural Network\n\nThis repository contains a simple, fully connected, dense, deep neural network,\nimplemented in modern Fortran and parallelised using coarrays.\n\nThe implementation is highly object oriented for ease of reuse and extension.\n\n## Usage\n\nA neural network can be constructed using\n``` Fortran\nuse mod_neural_network\nclass(neural_network), allocatable :: nn\n\nnn = neural_network(number of inputs,\n                    numbers of neurons per layer (including output layer),\n                    activation function in hidden layers - e.g. relu() or sigmoid(),\n                    activation function in output layer (optional),\n                    L2 regularisation parameter (optional))\n```\nExample: A neural network with\n\n- 2 inputs\n- 3 hidden layers with RELU activation functions and 30, 20 and 10 neurons\n- 1 output using a sigmoid function in the output layer (e.g. for binary classification)\n- L2 regularisation parameter 0.01\n\ncan be constructed with\n``` Fortran\nnn = neural_network(2, [30, 20, 10, 1], relu(), sigmoid(), 0.01d0)\n```\nand trained with a learning rate of 0.001 for 100 epochs with a batch size of 32 with\n``` Fortran\ncall nn%train(X, Y, 0.001d0, 100, 32)\n```\nwhere `X` has dimension `2 x N` and `Y` has dimension `1 x N` (where `N` is the number of training samples). Note that `Y` has to be a matrix even though the network only gives one output per input.\n\n## Compilation and installation\nPrerequisites:\n\n- `gfortran`, tested with 8.2. It seems no other compilers support `co_sum` yet.\n- `cmake`.\n\nCompilation sequence is the usual,\n```\ngit clone https://github.com/anjohan/neuralnetwork.git\ncd neuralnetwork\nmkdir build\ncd build\ncmake .. # or FC=caf cmake ..\nmake\n```\n\nThis (hopefully) gives the library `libneuralnetwork.a`\n\nFor parallel execution, [OpenCoarrays](https://github.com/sourceryinstitute/OpenCoarrays) is required. Run `FC=caf cmake ..` if the `caf` wrapper is in your `PATH`. If the compiler does not contain `caf`, `-fcoarray=single` is used for serial execution.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanjohan%2Fneuralnetwork","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanjohan%2Fneuralnetwork","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanjohan%2Fneuralnetwork/lists"}