{"id":21276438,"url":"https://github.com/lawrence-laz/tinn-dotnet","last_synced_at":"2025-04-14T12:03:57.852Z","repository":{"id":90683386,"uuid":"330378360","full_name":"lawrence-laz/tinn-dotnet","owner":"lawrence-laz","description":"A tiny neural network library.","archived":false,"fork":false,"pushed_at":"2023-10-08T09:49:01.000Z","size":159,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-14T12:03:53.050Z","etag":null,"topics":["artificial-intelligence","csharp","dotnet","dotnet-core","machine-learning","neural-network"],"latest_commit_sha":null,"homepage":"","language":"C#","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/lawrence-laz.png","metadata":{"files":{"readme":"readme.md","changelog":"CHANGELOG.md","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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-17T11:46:35.000Z","updated_at":"2023-12-10T07:58:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"24e7ad6d-bcd9-49af-a2df-f3288eafb530","html_url":"https://github.com/lawrence-laz/tinn-dotnet","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lawrence-laz%2Ftinn-dotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lawrence-laz%2Ftinn-dotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lawrence-laz%2Ftinn-dotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lawrence-laz%2Ftinn-dotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lawrence-laz","download_url":"https://codeload.github.com/lawrence-laz/tinn-dotnet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248877986,"owners_count":21176243,"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":["artificial-intelligence","csharp","dotnet","dotnet-core","machine-learning","neural-network"],"created_at":"2024-11-21T09:48:59.079Z","updated_at":"2025-04-14T12:03:57.840Z","avatar_url":"https://github.com/lawrence-laz.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NuGet Version](https://img.shields.io/nuget/v/Tinn?label=NuGet)](https://www.nuget.org/packages/Tinn/)\n[![NuGet Downloads](https://img.shields.io/nuget/dt/Tinn?label=Downloads)](https://www.nuget.org/packages/Tinn/)\n[![Build](https://github.com/lawrence-laz/tinn-dotnet/workflows/Build/badge.svg)](https://github.com/lawrence-laz/tinn-dotnet/actions?query=workflow%3ABuild)\n\n# Tinn: Tiny Neural Network\nTinn is a tiny and dependency free neural network implementation for dotnet.\nIt has three configurable layers: an input layer, a hidden layer and an output layer.\n\n# How to get started?\nCreate a neural network:\n```csharp\nvar network = new TinyNeuralNetwork(inputCount: 2, hiddenCount: 4, outputCount: 1); \n```\n\nLoad a data set:\n```csharp\n// This is XOR operation example.\nvar input = new float[][]\n{\n    new []{ 1f, 1f }, // --\u003e 0f\n    new []{ 1f, 0f }, // --\u003e 1f\n    new []{ 0f, 1f }, // --\u003e 1f\n    new []{ 0f, 0f }, // --\u003e 0f\n};\nvar expected = new float[][]\n{\n    new []{ 0f }, // \u003c-- 1f ^ 1f\n    new []{ 1f }, // \u003c-- 1f ^ 0f\n    new []{ 1f }, // \u003c-- 0f ^ 1f\n    new []{ 0f }, // \u003c-- 0f ^ 0f\n};\n```\nTrain the network until a desired accuracy is achieved:\n```csharp\nfor (int i = 0; i \u003c input.Length; i++)\n{\n    network.Train(input[i], expected[i], 1f);\n}\n// Note: you will probably have to loop this for a few times until network improves.\n```\nTry to predict some values:\n```csharp\nvar prediction = network.Predict(new [] { 1f, 1f });  \n// Will return probability close to 0f, since 1 ^ 1 = 0.\n```\nFor more examples see [the examples directory](https://github.com/lawrence-laz/tinn-dotnet/tree/main/example/) and [automated tests](https://github.com/lawrence-laz/tinn-dotnet/tree/main/test/Tinn.Tests).\n\n---\nThe original library was written by [glouw in C](https://github.com/glouw/tinn).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flawrence-laz%2Ftinn-dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flawrence-laz%2Ftinn-dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flawrence-laz%2Ftinn-dotnet/lists"}