Framework
dotnet/machinelearning-samples avatar
dotnet/machinelearning-samples

dotnet/machinelearning-samples: what the official ML.NET sample set actually contains

Samples for ML.NET, an open source and cross-platform machine learning framework for .NET.

4,683 stars2,664 forksPowerShellMIT

At a glance

What is it?
The dotnet/machinelearning-samples repository is the official sample collection for ML.NET, split into console-style getting-started projects and end-to-end apps. It is a teaching corpus, not a library, and the README does not document how to run any of it.
Who is it for?
Adopt this repository if you are a .NET developer who wants runnable ML.NET example code for a specific task, and pick the single sample folder that matches it. Do not adopt it if you need a maintained library, a documented build, or a model you can put into production unchanged: the last push was on 2026-09-03, but the most recent release is from 2020-08-24 and the README documents no commands.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 26 days ago.
What is it written in?
Mainly PowerShell, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 29, 2026, and from our analysis. They are not legal advice.

Editorial analysis

The gap dotnet/machinelearning-samples fills for .NET developers

ML.NET is described in the repository README as "a cross-platform open-source machine learning framework that makes machine learning accessible to .NET developers." That is the framework. This repository is the other half: the working code that shows what the framework looks like when applied to a task. The README states the samples exist to "help you get started with ML.NET and how to infuse ML into existing and new .NET apps."

The audience is narrow and specific. You already write C# or F#. You have a task in mind, sentiment classification, price regression, product recommendation, and you want to see the shape of an ML.NET program that does it. The repository answers that by giving you a folder per task rather than a narrative. If you are not a .NET developer, nothing here is aimed at you; the samples are written in C# and F#, and the repository's primary language is listed as PowerShell, which reflects the build scripts rather than the samples themselves.

Two sample types and how the repository is organised

The README draws a line between two kinds of content. Getting Started samples are "ML.NET code focused samples for each ML task or area, usually implemented as simple console apps." End-to-End apps are "End-user sample web and desktop apps infused with Machine Learning models based on ML.NET." That distinction matters more than it looks. A getting-started console app strips the problem down to data loading, a pipeline, training and prediction. An end-to-end app adds the parts that make a real product awkward: UI, model persistence, and the plumbing between them.

The catalogue is organised by machine learning task. Binary classification covers sentiment analysis, spam detection, credit card fraud detection and heart disease prediction. Multi-class classification covers GitHub issue labelling, Iris flowers and MNIST. Recommendation covers product recommendation, movie recommendation with matrix factorization, and a field-aware factorization machines movie recommender. Regression covers taxi fare prediction, sales forecasting and bike sharing demand. There are also sections for time series forecasting and anomaly detection.

Most entries link to both a C# and an F# implementation. Heart disease prediction and MNIST are listed with C# only. The directory layout matches the README tables: samples/csharp/ and samples/fsharp/ hold the language-specific trees, samples/modelbuilder/ holds Model Builder material, and samples/CLI/ sits alongside them. A datasets/ directory at the repository root holds the data the samples consume, which is why the console samples can run without you sourcing a CSV first.

Getting a sample running without documented commands

Here is the honest constraint: the README does not give install or run commands. It is a catalogue with links, not a quickstart. What it does give you is the folder path for each sample, and each sample folder is where the runnable project lives. The repository root carries build.ps1 and a samples/Directory.Build.props, and there is a samples/nuget.config, which together suggest the samples are meant to be restored and built through the .NET toolchain rather than by hand.

Start by cloning and moving into the sample you want. The sentiment analysis sample is the conventional first stop because the README lists it first under binary classification:

bash
git clone https://github.com/dotnet/machinelearning-samples.git
cd machinelearning-samples/samples/csharp/getting-started/BinaryClassification_SentimentAnalysis

From inside that folder, restore and run the project. The repository does not publish the exact command in its README, so confirm the project file name in the folder before running:

bash
dotnet run

What you should see is a console application that trains on the sentiment dataset and prints evaluation output. If the SDK on your machine is older than the target framework in samples/Directory.Build.props, the restore fails before any training happens, and that failure is about your SDK, not the sample.

For the end-to-end apps the shape is different. The GitHub issue labeler and the sales forecasting app are applications rather than console demos, so expect to open them in an IDE and configure whatever the app's own README asks for. The root README does not cover that configuration.

Where the sample set stops being the right tool

The repository is explicit about one boundary. The README says to open issues about the ML.NET framework in the Machine Learning repository, and to create an issue here "only if you face issues with the samples in this repository." Read that as the maintainers telling you what this repository is not: it is not the place where framework behaviour is fixed, and a bug you hit in a trainer is not a sample bug.

The second limitation is age. The three most recent releases listed are all from 2020: 2020-08-24, 2020-06-30 and 2020-04-16, and all three concern deep learning image classification with ML.NET and TensorFlow, or Model Builder in Azure. The repository has been pushed to more recently, on 2026-09-03, but the release list tells you where the substantive sample additions stopped. If you are looking for a sample of a newer ML.NET API surface, the catalogue may not have caught up, and the README gives no version compatibility table to tell you which ML.NET version each sample targets.

The third limitation is that samples are not production code. A console app that loads a CSV, builds a pipeline and prints metrics has no story for retraining, model versioning or serving. The GitHub issue labeler is closer to a real application, but it is still a demonstration. If you need a library to depend on, this is the wrong repository; you want the ML.NET framework packages, not the samples that call them.

How this differs from scikit-learn's example gallery

The obvious comparison is scikit-learn's example gallery, and the difference is structural rather than cosmetic. scikit-learn's examples live inside the library's own documentation build. They are executed as part of the docs pipeline, and the gallery is a rendering of code that the project runs. The examples and the library share a release cycle.

Here the samples are a separate repository from the framework. That separation is deliberate and has a cost. It means the samples can lag the framework without breaking the framework's build, which is exactly the pattern the 2020 release dates suggest. It also means the samples can be written in two languages, C# and F#, without the framework repository carrying F# sample code it does not otherwise need.

The practical consequence for you: when you find a sample that will not build, the fix may be in the sample, not in ML.NET, and the README's issue routing sends you to the right tracker for each case. With scikit-learn you would file one issue against one project. Here you first decide which of the two repositories owns the problem.

Licence, maintenance and what an upgrade costs you

The repository is MIT licensed, per the LICENSE file at the root. MIT is permissive: you can copy a sample's code into your own project, modify it and ship it, provided you carry the licence notice. That matters because copying is the realistic use pattern here. Nobody vendors a samples repository as a dependency; they read a pipeline definition and rewrite it. Check whether the datasets under datasets/ carry their own terms before you redistribute them, since a repository-level LICENSE does not necessarily cover third-party data. That is a question for your own review, not legal advice from this page.

The maintenance picture is mixed and worth stating plainly. The repository is not archived, and the last push was on 2026-09-03, so there is current activity. But the newest release listed is from 2020-08-24. Treat the release list as the better signal for how much new sample material has been published recently, and the push date as a signal that the repository is still being touched.

Upgrade cost depends entirely on which sample you copied. A console sample that uses a trainer and a pipeline is small enough to retarget by hand. The end-to-end apps carry UI and configuration, and the README does not document a migration path between ML.NET versions for them. If you build on one of those, budget for reading the framework's own release notes when you move your target framework forward, because this repository will not tell you what changed.

Editorial conclusion

Adopt this repository if you are a .NET developer who wants runnable ML.NET example code for a specific task, and pick the single sample folder that matches it. Do not adopt it if you need a maintained library, a documented build, or a model you can put into production unchanged: the last push was on 2026-09-03, but the most recent release is from 2020-08-24 and the README documents no commands. Verify first that the sample you chose builds against your installed .NET SDK, and read the sample's own README inside its folder rather than the repository root.

Frequently asked questions

Is ChatGPT AI or ML?

The repository material does not discuss ChatGPT or large language models, so it cannot answer this. What it does cover is ML.NET, described in the README as a cross-platform open source machine learning framework for .NET developers.

Can I learn ML in 3 months?

The repository makes no claim about learning timelines. It provides getting-started samples for individual ML tasks, such as sentiment analysis, spam detection and taxi fare prediction, which are intended to help developers get started with ML.NET.

What are the 7 types of machine learning?

The README does not enumerate seven types of machine learning. It organises samples by task instead: binary classification, multi-class classification, recommendation, regression, time series forecasting and anomaly detection.

What are 10 applications of machine learning?

The README lists sample applications rather than a general list of ten. Among them are sentiment analysis, spam detection, credit card fraud detection, heart disease prediction, GitHub issue classification, Iris flower classification, MNIST, product and movie recommendation, taxi fare prediction, sales forecasting and bike sharing demand prediction.

Official sources

  1. dotnet/machinelearning-samples on GitHub
  2. License: MIT
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/dotnet-machinelearning-samples.svg)](https://hysenlabs.com/projects/dotnet-machinelearning-samples)