Coder Social home page Coder Social logo

jernejk / mlsample.simpletransactiontagging Goto Github PK

View Code? Open in Web Editor NEW
19.0 6.0 8.0 71.12 MB

This is an simple example of tagging bank transactions with ML.NET

C# 52.52% HTML 25.94% Dockerfile 1.33% CSS 18.91% PowerShell 1.30%
automl blazor-application ml-net classification machine-learning

mlsample.simpletransactiontagging's Introduction

MLSample.SimpleTransactionTagging

This is an simple example of tagging bank transactions with ML.NET built for a console as well as server-side Blazor application.

You can read more about this example and ML.NET on my blog post: https://jkdev.me/simple-machine-learning-classification/

Live demo: https://jernejk.github.io/MLSample.SimpleTransactionTagging/

Usage

You 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.

Console (MLSample.TransactionTagging)

This is the initial example on how to use ML.NET for classification. It will train based on the training.json in MLSample.TransationTagging.Core file and it will classify a couple of example transaction descriptions.

If it fails to correctly classify a transaction, it will likely be "Coffee & drink". This category will likely be a "catch-all" (but not always, the beauty of ML) simple because training data has a lot of them.

Cmd Dotnet Run Figure: Run Console application with training.

You can also run the application without building the model. Just make sure to run the console application 1 time to generate the model, before trying to run it without training.

dotnet run no-training

Cmd Dotnet Run No Training Figure: Run Console application without training.

Server-side Blazor

This is designed to be more interactive as well as you why ML.NET might have decided for a certain classification. It 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.

The 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/ UPDATE: Upgraded the code to PredictionEnginePool.

Most of the code is in the Startup.cs and Pages/Index.razor.

Blazor Uber Sample Figure: Example of Blazor application.

Integration test

There is also a integration test, that tests the most common uses cases in my demos. If they fail, it usually because my demo data has changed and confused ML.NET.

AutoML

You can also try out AutoML, which will try to find the best trainer for the data.

For console run:

dotnet run auto-ml

Cmd Dotnet Run Auto Ml Figure: Running AutoML in console application.

For Blazor:

Run the app, go to AutoML and click train. This will create a new model every time you train.

Automl Blazor Training Figure: Running AutoML in Blazor application.

mlsample.simpletransactiontagging's People

Contributors

dependabot-preview[bot] avatar jernejk avatar sucrose0413 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.