{"id":25524019,"url":"https://github.com/jernejk/mlsample.simpletransactiontagging","last_synced_at":"2025-06-26T06:35:07.947Z","repository":{"id":46110182,"uuid":"180152677","full_name":"jernejk/MLSample.SimpleTransactionTagging","owner":"jernejk","description":"This is an simple example of tagging bank transactions with ML.NET","archived":false,"fork":false,"pushed_at":"2022-11-26T00:58:26.000Z","size":72822,"stargazers_count":20,"open_issues_count":9,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-11T02:52:46.258Z","etag":null,"topics":["automl","blazor-application","classification","machine-learning","ml-net"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jernejk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-08T13:15:51.000Z","updated_at":"2024-06-24T20:43:26.000Z","dependencies_parsed_at":"2023-01-23T11:15:51.651Z","dependency_job_id":null,"html_url":"https://github.com/jernejk/MLSample.SimpleTransactionTagging","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jernejk/MLSample.SimpleTransactionTagging","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jernejk%2FMLSample.SimpleTransactionTagging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jernejk%2FMLSample.SimpleTransactionTagging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jernejk%2FMLSample.SimpleTransactionTagging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jernejk%2FMLSample.SimpleTransactionTagging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jernejk","download_url":"https://codeload.github.com/jernejk/MLSample.SimpleTransactionTagging/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jernejk%2FMLSample.SimpleTransactionTagging/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262016166,"owners_count":23245479,"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":["automl","blazor-application","classification","machine-learning","ml-net"],"created_at":"2025-02-19T19:28:03.498Z","updated_at":"2025-06-26T06:35:07.891Z","avatar_url":"https://github.com/jernejk.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MLSample.SimpleTransactionTagging\nThis is an simple example of tagging bank transactions with ML.NET built for a console as well as server-side Blazor application.\n\nYou can read more about this example and [ML.NET](https://dotnet.microsoft.com/apps/machinelearning-ai/ml-dotnet) on my blog post: [https://jkdev.me/simple-machine-learning-classification/](https://jkdev.me/simple-machine-learning-classification/?github)\n\nLive demo: https://jernejk.github.io/MLSample.SimpleTransactionTagging/\n\n## Usage\n\nYou can either run console application (.NET Core 2.2 at the time of writing) or Server-side Blazor (.NET Core 3.0) either via `dotnet run` or Visual Studio 2019.\n\n### Console (MLSample.TransactionTagging)\n\nThis is the initial example on how to use [ML.NET](https://dotnet.microsoft.com/apps/machinelearning-ai/ml-dotnet) for classification.\nIt will train based on the `training.json` in `MLSample.TransationTagging.Core` file and it will classify a couple of example transaction descriptions.\n\nIf it fails to correctly classify a transaction, it will likely be **\"Coffee \u0026 drink\"**.\nThis category will likely be a \"catch-all\" (but not always, the beauty of ML) simple because training data has a lot of them.\n\n![Cmd Dotnet Run](assets/cmd-dotnet-run.png)\n**Figure: Run Console application with training.**\n\nYou can also run the application without building the model.\nJust make sure to run the console application 1 time to generate the model, before trying to run it without training.\n\n`dotnet run no-training`\n\n![Cmd Dotnet Run No Training](assets/cmd-dotnet-run-no-training.png)\n**Figure: Run Console application without training.**\n\n### Server-side Blazor\n\nThis is designed to be more interactive as well as you why ML.NET might have decided for a certain classification.\nIt uses dependency injection to train and load ML model, so it doesn't have to be reloaded every time we hit the page where we want to do classification.\n\nThe DI is done based on a MS blog post: https://devblogs.microsoft.com/cesardelatorre/how-to-optimize-and-run-ml-net-models-on-scalable-asp-net-core-webapis-or-web-apps/\n**UPDATE:** Upgraded the code to `PredictionEnginePool`.\n\nMost of the code is in the `Startup.cs` and `Pages/Index.razor`.\n\n![Blazor Uber Sample](assets/blazor-uber-sample.png)\n**Figure: Example of Blazor application.**\n\n### Integration test\n\nThere is also a integration test, that tests the most common uses cases in my demos.\nIf they fail, it usually because my demo data has changed and confused ML.NET.\n\n## AutoML\n\nYou can also try out AutoML, which will try to find the best trainer for the data.\n\nFor console run:\n\n`dotnet run auto-ml`\n\n![Cmd Dotnet Run Auto Ml](assets/cmd-dotnet-run-auto-ml.png)\n**Figure: Running AutoML in console application.**\n\nFor Blazor:\n\nRun the app, go to AutoML and click train. This will create a new model every time you train.\n\n![Automl Blazor Training](assets/automl-blazor-training.gif)\n**Figure: Running AutoML in Blazor application.**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjernejk%2Fmlsample.simpletransactiontagging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjernejk%2Fmlsample.simpletransactiontagging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjernejk%2Fmlsample.simpletransactiontagging/lists"}