Build A Product Recommender Using C# and ML.NET Machine Learning

Mark Farragher
6 min readApr 20, 2019

In this article I’m going to build a product recommendation service using C#, ML.NET, and NET Core.

ML.NET is Microsoft’s new machine learning library. It can run linear regression, logistic classification, clustering, deep learning, and many other machine learning algorithms.

And NET Core is the Microsoft multi-platform NET Framework that runs on Windows, OS/X, and Linux. It’s the future of cross-platform NET development.

The first thing I need for my product recommendation app is a data file with hundreds of thousands of product purchases. I can use the SNAP Amazon Co-Purchasing Network which was created by crawling the Amazon website in 2003. The dataset is based on the ‘Customers Who Bought This Item Also Bought’ feature of the Amazon website and contains every product combination discovered by the crawler.

The dataset contains a list of 1,234,878 product combinations and looks like this:

It’s a very simple TSV file with only two columns:

  • The ID of a purchased product
  • The ID of a second product that was often bought by customers who also bought the first product

I will build a machine learning model that reads in each set of Product IDs, and then…

--

--