{"id":22194104,"url":"https://github.com/roberino/linqinfer","last_synced_at":"2025-07-26T23:31:56.683Z","repository":{"id":8727075,"uuid":"51868241","full_name":"roberino/linqinfer","owner":"roberino","description":"A lightweight and slightly experimental inference library for C# / LINQ","archived":false,"fork":false,"pushed_at":"2022-01-12T13:25:10.000Z","size":75541,"stargazers_count":15,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-25T15:16:48.917Z","etag":null,"topics":["linq","machine-learning","neural-networks","text-mining"],"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/roberino.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":"2016-02-16T20:38:52.000Z","updated_at":"2023-01-25T07:35:36.000Z","dependencies_parsed_at":"2022-08-07T04:16:45.015Z","dependency_job_id":null,"html_url":"https://github.com/roberino/linqinfer","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/roberino/linqinfer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roberino%2Flinqinfer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roberino%2Flinqinfer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roberino%2Flinqinfer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roberino%2Flinqinfer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roberino","download_url":"https://codeload.github.com/roberino/linqinfer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roberino%2Flinqinfer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266808203,"owners_count":23987443,"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","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["linq","machine-learning","neural-networks","text-mining"],"created_at":"2024-12-02T13:11:24.870Z","updated_at":"2025-07-26T23:31:54.432Z","avatar_url":"https://github.com/roberino.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# linqinfer\n\n[![Build Status](https://travis-ci.org/roberino/linqinfer.svg?branch=master)](https://travis-ci.org/roberino/linqinfer)\n\nNuget Package: https://www.nuget.org/packages/LinqInfer/\n\n![logo](docs/logo.png \"LinqInfer\")\n\n## A lightweight inference library for C# / LINQ\n\nLinqInfer is a data transformation, learning and inference framework. \n\nThis library reflects my interest over the years in Bayesian probability, \nprobabilistic reasoning, classification and other means of inference.\n\n### Some key features / aims of the library\n\n* Data extraction methods for object and text based data sets for converting into vector representations\n* Methods for transforming and processing vector models\n* Implementations of learning algorithms\n* An extensible framework for integrating other vector based algorithms\n\n### Basic library layout \n\n#### Features and Feature Pipelines\n\nFeature extraction is key to many of the classification algorithms.\n\nFeature pipelines represent a pipeline of feature data which can be \ntransformed and pumped into various forms. There are a few mechanisms\nfor reducing the dimensionality of the input data, such as principle component \nanalysis.\n\nWhen data is extracted, it is represented as an enumeration of column vectors which \ncan be transformed and filtered before being consumed for classifier training.\n\nFeature pipelines come in [asynchronous](docs/async-pipelines.md) and synchronous flavours. \n\nAsync pipelines support a more complex, batch orientated processing model\nwhich allows for parallel processing of data. Create asyncronous enumerators\nusing the Data.Pipes namespace. You can create from simple enumerators\nor from loading functions.\n\nSynchronous pipelines are derived from IQueryable data sets.\n\n#### Learning\n\nThis is a collection of machine learning algorithms which are available through extention \nfunctions and operate on IQueryable sets of data or on asyncronous enumerators.\n\n* Self organising feature maps\n* Simple statistical classifier\n* Multi-layer neural network classifier\n\n##### Example\n\n```cs\n\nvar cancel = new CancellationTokenSource();\n\n// MyDataLoader returns an enumeration of data\n// There are various other ways to create \n// an async enumerator\n\nvar data = MyDataLoader().AsAsyncEnumerator();\n\n// Apply transformations and create a set for training\n// You need to supply an expression which can classify your data\n// for training \n\nvar trainingSet = await data\n    .BuildPipelineAsync(cancel.Token)\n    .CentreAndScaleAsync(Range.ZeroToOne)\n    .AsTrainingSetAsync(x =\u003e x.classification, cancel.Token);\n\n// Attach a network model to the training set\n// You can attach numerous models and train them in parallel\n\nvar classifier = trainingSet.AttachMultilayerNetworkClassifier(b =\u003e\n{\n    b.ConfigureSoftmaxNetwork(4, p =\u003e\n    {\n        p.LearningRate = 0.005;\n    });\n});\n\n// Run the training procedure (over 550 epochs)\n\nawait trainingSet.RunAsync(cancel.Token, 550);\n\n// Test the classifier\n\nvar results = classifier.Classify(new\n{\n    x = 10,\n    y = 10,\n    classification = \"?\"\n});\n\n// Export the classifier\n\nvar exportedNetwork = classifier.ExportData();\n\n```\n\nSee also [character learning example] (tests/LinqInfer.ImageLearningTests/ImageLearningExamples.cs)\n\nSee more documentation on [Neural Networks](docs/neural-networks.md)\n\n#### Text\n\nUtilities for working with text and text documents.\n\n```cs\n\nvar index = docs // enumeration of XDocuments\n\t.AsTokenisedDocuments(d =\u003e d.Root.Name.LocalName) // Use the root element name as the doc ID\n\t.CreateIndex();\n\nvar results = index.Search(\"brown fox\");\n\n// create training sets\n\nvar corpus = File.OpenText(\"some.txt\").CreateCorpus();\n\nvar trainingSet = corpus.CreateContinuousBagOfWordsAsyncTrainingSet(index.ExtractKeyTerms(500));\n\n```\nSee more documentation on [Text](docs/text.md)\n\n#### Maths\n\nThe Maths namespace consists of some basic numerical utilities \nincluding numerous forms of vectors and vector manipulation methods.\n\n#### Maths.Graphs\n\nThe Maths.Graphs namespace contains useful objects and functions for creating graphical representations of structures.\n\nGraphs can be exported into [GEXF](https://gephi.org/gexf/format/schema.html).\n\nCheck out [Sigmajs](http://sigmajs.org/) and [Gephi](https://gephi.org/) for visualising graphs.\n\n![SOFM graph](docs/sofm_graph2.png)\n\n![Neural network graph](docs/neural-network-sm.png)\n\n#### Maths.Probability \n\nThis is a collection of functions and probability \"objects\" to help solve simple probability problems.\n\n* Sample spaces\n* Hypotheses\n* Markov chains\n* Monte Carlo simulations\n\n##### Examples\n\n```cs\n\n// Sample space\n\nvar sampleSpace = queryableSampleDataset.AsSampleSpace();\n\nvar p = sampleSpace.ProbabilityOfEvent(p =\u003e p.Age \u003e 25);\n\n// Hypotheses\n\nvar die = new[] { 4, 6, 8, 12, 20 };\nvar hypos = die.Select(n =\u003e P.Of(n).Is(1).OutOf(die.Length)).AsHypotheses();\n\nhypos.Update(x =\u003e x \u003c 6 ? Fraction.Zero : (1).OutOf(x));\n\nhypos.ProbabilityOf(4);\n\n```\n\n#### Data\n\nSerialisation and data storage interfaces.\n\n### Examples\n\nSee tests for more usage examples.\n\nIt is still a work in progress.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froberino%2Flinqinfer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froberino%2Flinqinfer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froberino%2Flinqinfer/lists"}