{"id":79591,"date":"2018-07-05T17:26:21","date_gmt":"2018-07-05T17:26:21","guid":{"rendered":"https:\/\/www.red-gate.com\/simple-talk\/?p=79591"},"modified":"2024-08-30T14:12:44","modified_gmt":"2024-08-30T14:12:44","slug":"machine-learning-with-net","status":"publish","type":"post","link":"https:\/\/www.red-gate.com\/simple-talk\/development\/dotnet-development\/machine-learning-with-net\/","title":{"rendered":"Machine Learning with .NET"},"content":{"rendered":"<h2>Introduction to Machine Learning with Accord.NET and F#<\/h2>\n<p>How many times have you heard the expression <em>Machine Learning<\/em> as something common, but at the same time so unknown, even if you\u2019re an experienced developer? How many times have you told yourself that a machine alone learning something is a reality very far from yours \u2013 a REST-CRUD-like world. And what about the languages (R, e.g.) these \u2018too-scientific\u2019 programmers use to, well, program?<\/p>\n<p>Every time you see a personalized ad or a recommendation in your favorite retailer website based on your previous activities, what you\u2019re seeing, in fact, are machine learning algorithms running behind the scenes. From your latest song suggestion on Spotify, the last face recognition made on your Facebook picture, to the risk analyzed by PayPal on each of your payment transactions, machine learning is everywhere, helping all sorts of companies to personalize their user experience on a large scale.<\/p>\n<h2>What is Machine Learning?<\/h2>\n<p>To understand the term, you need to remember how our own brains work. We were born with no information about the world and, as we grow, the continuous exposure to more and more data makes us comprehend that putting a finger in the socket is not a good idea. Of course, we have the act of committing mistakes as our main fuel to the learning process, but we also learn a lot just paying attention to the other things that surround us. That\u2019s how machine learning works.<\/p>\n<p>With no need to be updated, a machine learning software solution is programmed once and learns by itself progressively after receiving more inputted data. It means that, if we provide the strings <em>Yellow Square<\/em>, <em>White Square<\/em> and <em>Black Rectangle<\/em> to a machine learning software application, for example, after inputting an image of each geometric form, when we ask the computer what the image of a black square is, it is going to answer: <em>Black Square<\/em>.<\/p>\n<p>Just like humans, the younger the system, the more susceptible to errors it will be. The goal is to let the program read a large amount of data over time in a way it can improve its predictions and decisions. In other words, machine learning can be translated into functions. Mathematically, its algorithms are represented as a single function like that:<\/p>\n<pre class=\"lang:none theme:none\">y = f(x) + e<\/pre>\n<p>Where the elements are basically:<\/p>\n<ul>\n<li><strong><em>y<\/em><\/strong><em>,<\/em> the result. What are you trying to predict here?<\/li>\n<li><strong><em>f<\/em><\/strong><em>,<\/em> the function itself. What we\u2019re really trying to discover that makes things happen based on\u2026<\/li>\n<li><strong><em>x<\/em><\/strong><em>, <\/em>the input data;<\/li>\n<li><strong><em>e<\/em><\/strong><em>,<\/em> error. It says that, no matter how hard we try to guess how things would happen (prediction), we\u2019ll never have enough inputs to perfectly go from <em>x<\/em> to <em>y<\/em>.<\/li>\n<\/ul>\n<h2>Linear regressions<\/h2>\n<p>Inside this functional universe, some models, like regressions, are specialized in number predictions, quantities to be more specific. For example, imagine an algorithm where we always input the same data (let\u2019s say \u2018a\u2019) and it returns some results after six attempts:<\/p>\n<table class=\"table--tight\">\n<tbody>\n<tr>\n<td>\n<p>Input<\/p>\n<\/td>\n<td>\n<p>Result<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>a<\/p>\n<\/td>\n<td>\n<p>1.0<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>a<\/p>\n<\/td>\n<td>\n<p>2.0<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>a<\/p>\n<\/td>\n<td>\n<p>1.5<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>a<\/p>\n<\/td>\n<td>\n<p>1.5<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>a<\/p>\n<\/td>\n<td>\n<p>1.4<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>a<\/p>\n<\/td>\n<td>\n<p>1.5<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>What would you say is the next possible result if we input a seventh \u2018a\u2019? Probably you\u2019d go with 1.5, because your mind automatically calculates the value of 50% of the total results, or at least some value between 1.5 and 2.0.<\/p>\n<p>What your brain did just now is called regression, linear regression. Its goal is trying to get the formula we\u2019ve seen and find the least number of variables that substantially impact determining <em>f(x)<\/em> with the highest correct percentage possible the value of <em>y<\/em>.<\/p>\n<p>Now, imagine you\u2019ve opened a small cupcakes shop, and you want your clients to being able to order cupcakes online via a website. Then, you decided that it would be interesting to collect a rating (1 to 5 stars) for each type of cupcake available for purchase. After searching a little bit, some behaviorist articles also said that, when users are confronted with products of low ratings, most of them abandon the purchase. It\u2019s a good practice to prevent this by showing a prefilled approximate value as shown in Figure 1 of how many product items (cupcakes, in this case) the clients usually order for each type (considering, mainly, the low-rated ones). Linear regression is going to provide the perfect solution to your needs.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"715\" height=\"220\" class=\"wp-image-79592\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2018\/07\/word-image-16.png\" \/><\/p>\n<p class=\"caption\">Figure 1. The cupcake order page<\/p>\n<p>This example will use F# as the main functional language. It integrates with Accord.NET, one of the best .NET machine learning frameworks, specialized in statistical implementations. Combined, they are a great fit for writing linear regression on the .NET platform, as you\u2019ll learn next.<\/p>\n<h2>Setting up the project<\/h2>\n<p>Everything you\u2019ll need to follow along with this article is the latest version of Visual Studio (the Community edition is just fine). However, most .NET developers complete the installation selecting only the single options available for .NET desktop development and the Universal Windows Platform for C#. In this case, you\u2019ll also need to select the <em>Data science and analytical applications<\/em> workload, as you can see in Figure 2. This option will install the data science languages (R and F#) you will need to implement the machine learning code. It\u2019s available during the VS installation process only (if you already have VS installed, you can run the installer again and select the proper workload).<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1299\" height=\"394\" class=\"wp-image-79593\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2018\/07\/word-image-17.png\" \/><\/p>\n<p class=\"caption\">Figure 2. Installing the data science workload.<\/p>\n<p>Once the workload is installed, open Visual Studio and go to menu <em>File &gt; New &gt; Project\u2026<\/em>. Select the <em>Installed<\/em> tab, select the options <em>Visual F# &gt; Console Application<\/em> and type a name for your project, <em>Cupcake Sales Regression<\/em> (Figure 3). If you have trouble finding the right type of application template, you can also search for <em>F#<\/em>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1178\" height=\"816\" class=\"wp-image-79594\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2018\/07\/word-image-18.png\" \/><\/p>\n<p class=\"caption\">Figure 3. Creating a new Visual F# project.<\/p>\n<p>Once it\u2019s finished creating the project, Visual Studio will open a file called <em>Program.fs<\/em>, the main file of the program. The extension <em>fs<\/em> comes from <em>F-sharp<\/em> and represents the source files for F#, which can be compiled as part of any .NET project. However, for simplicity, this example is going to use files of <em>fsx<\/em> extension, which comes from <em>F-sharp scripts<\/em>. They are independent, and individual F# files are intended to run as a script (most of the time for test purposes only). Go to the project in\u00a0 <em>Solution Explorer<\/em> window, right click it, and select <em>Add &gt; New Item\u2026<\/em>, then search for <em>F#, <\/em>select the option<em> F# Script File<\/em> and give it the name <em>CupcakeSalesRegression.fsx<\/em>.<\/p>\n<p>You will also need to set up the two dependencies of Accord.NET via NuGet Package Manager for the project: the core and statistics dependencies, as well as the <em>FSharp.Data<\/em> package (which, among other things, manages providers for working with structured file formats, like CSV). For this, go to menu <em>View &gt; Other Windows &gt; Package Manager Console<\/em> and run the following commands:<\/p>\n<pre class=\"lang:none theme:none\">install-package Accord\r\ninstall-package Accord.Statistics\r\ninstall-package FSharp.Data<\/pre>\n<p>Pay attention to the logs and make sure it ends with the message <em>Successfully installed \u2026<\/em>. You should see the following new items added to the <em>References<\/em> section as shown in Figure 4:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"361\" height=\"211\" class=\"wp-image-79595\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2018\/07\/word-image-19.png\" \/><\/p>\n<p class=\"caption\">Figure 4: The project references<\/p>\n<p>F# is a scripting as well as a REPL language. REPL comes from <em>Read-Eval-Print Loop<\/em>, which means that the language processes single steps one at a time like reading the user inputs (usually expressions), evaluating their values and, in the end, returning the result to the same user. All that happens in a loop until the loop ends. Visual Studio provides a great <em>F# Interactive<\/em> view that runs the scripts in REPL mode and shows the results. Take the following Hello World example:<\/p>\n<pre class=\"lang:c# theme:vs2012\">let hello = \"Hello World\"<\/pre>\n<p>This code just creates a single variable (<em>let<\/em> keyword) and assigns a string value to it. When you run this code (select all the code text and press <em>Alt + Enter<\/em>), you\u2019ll see the following result in the <em>F# Interactive<\/em> window (Figure 5):<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"717\" height=\"252\" class=\"wp-image-79596\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2018\/07\/word-image-20.png\" \/><\/p>\n<p class=\"caption\">Figure 5: The results of a \u201cHello World\u201d script<\/p>\n<p>Look at how F# infers the types. In the end, this is a function called <strong>hello<\/strong> that receives no arguments and returns a string (in this case, a hardcoded one). But the language is even more flexible to allow a common mix of arguments with the code block itself. Replace the previous statement by the following and run the code again. The results are shown in Figure 6:<\/p>\n<pre class=\"lang:c# theme:vs2012\">let hello s = s + \"Hello World\"<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"691\" height=\"270\" class=\"wp-image-79597\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2018\/07\/word-image-21.png\" \/><\/p>\n<p class=\"caption\">Figure 6: The result of running the hello function<\/p>\n<p>This means that the same function now receives an argument called <em>s<\/em> of type <em>string<\/em> and returns another string (in this case, not hardcoded anymore). The <em>-&gt;<\/em> operator tells you that what\u2019s next is the result structure.<\/p>\n<h2>The Cupcake Sales Regression<\/h2>\n<p>The first step towards creating this regression is to understand how the data is organized in a business model way. That is, what is the real entity model representing the sales, each rating and the total of purchased items? Take a look at the following CSV data:<\/p>\n<pre class=\"lang:none theme:none\">CupcakeId,Type,Price,CustomerId,Rating,Total\r\n1,pumpkin,4.25,105,2,1\r\n1,pumpkin,4.25,57,1,2\r\n1,pumpkin,4.25,40,2,2\r\n1,pumpkin,4.25,66,3,1\r\n2,vanilla,4.25,59,5,10\r\n3,white chocolate,4.25,81,1,2\r\n4,red velvet,4.25,167,5,3\r\n\u2026<\/pre>\n<p>You can download the full file <a href=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2018\/07\/cupcake_sales-1.csv\">here<\/a>. Then, import it to your project root folder by copying and pasting the file into Solutions Explorer. If you see errors in the import code (shown later in the article), open the file in VS and make a small edit to get VS to process the file.<\/p>\n<p>Observe, too, the following scatter plot representing the cupcake sales model data. Accord.NET linear regression is going to map all the sale ratings averages and cross them with the average of the total of orders for each type of cupcake. In the end, its purpose is to try to balance the information in both axes (<strong>x <\/strong>and <strong>y<\/strong>) and determine <strong>a line<\/strong> that tries, at its best, to approximate to each point of the graph. That\u2019s the magic of the linear regression shown in Figure 7.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"427\" height=\"425\" class=\"wp-image-79598\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2018\/07\/word-image-22.png\" \/><\/p>\n<p class=\"caption\">Figure 7: The linear regression<\/p>\n<p>Just like you would have in a CSV file showing real data, the data will increase over time and help the algorithm to be smarter. However, in order to use the power of Accord.NET in the <em>fsx<\/em> file, you must first import the corresponding libs (<em>dlls<\/em>) of its main packages. These are going to be the first lines of your fsx file (you can download the completed script <a href=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2018\/07\/CupcakeSalesRegression.zip\">here<\/a>):<\/p>\n<pre class=\"lang:c# theme:vs2012\">#r \"..\/packages\/FSharp.Data.2.4.6\/lib\/net45\/FSharp.Data.dll\"\r\n#r \"..\/packages\/Accord.3.8.0\/lib\/net40\/Accord.dll\"\r\n#r \"..\/packages\/Accord.Statistics.3.8.0\/lib\/net40\/Accord.Statistics.dll\"\r\n#r \"..\/packages\/Accord.Math.3.8.0\/lib\/net40\/Accord.Math.dll\"\r\n#r \"..\/packages\/Accord.Math.3.8.0\/lib\/net40\/Accord.Math.Core.dll\"<\/pre>\n<p>The directive <em>r#<\/em>, in F#, comes from <em>reference<\/em> and is used to load external library references that were previously installed in the project. These <em>dlls<\/em> are:<\/p>\n<ul>\n<li><a href=\"http:\/\/fsharp.github.io\/FSharp.Data\/\">FSharp.Data<\/a>: F# default library to deal with everything related to accessing data in F# applications: from CSV, JSON\/XML files to remote data parsing\/manipulation;<\/li>\n<li><a href=\"https:\/\/www.nuget.org\/packages\/Accord\/3.8.0\">Accord<\/a>: the core of the framework. Stores general exceptions and other libraries extensions;<\/li>\n<li><a href=\"https:\/\/www.nuget.org\/packages\/Accord.Math\/3.8.0\">Accord.Math<\/a>: for all basic mathematical operations, that library is needed, once it contains data science principal functions and numerical algorithms;<\/li>\n<li><a href=\"https:\/\/www.nuget.org\/packages\/Accord.Statistics\/3.8.0\">Accord.Statistics<\/a>: it\u2019s the home of the linear regression statistical models and a whole bunch of components and statistical methods\/functions like variances, deviations, averages, etc.<\/li>\n<\/ul>\n<p>To call the classes in the Accord.NET linear regression module in your code without having to use their fully qualified names, you must import it right after the <em>dlls <\/em>references:<\/p>\n<pre class=\"lang:c# theme:vs2012\">open Accord.Statistics.Models.Regression.Linear\r\nopen FSharp.Data<\/pre>\n<p>In F#, the CSV model can be implemented as follows:<\/p>\n<pre class=\"lang:c# theme:vs2012\">type CupcakeSale = \r\n    {CupcakeId : int;\r\n     Type : string;\r\n     Price : float;\r\n     CustomerId : int;\r\n     Rating : float;\r\n     Total: float}<\/pre>\n<div class=\"note\"><em>Note:F# does not use any kind of code separator, instead it takes into consideration the whitespaces as indentation.<\/em><\/div>\n<p>A <em>type<\/em> in F# represents a class in C# or other object-oriented languages. This way, you can define the name and types of your object attributes (which is also a variable).<\/p>\n<p>Once you\u2019re dealing with a large amount of records, you\u2019ll create a resizable list, import the local CSV file, iterate over its content and add its elements to the list just to simulate the data a real application would supply:<\/p>\n<pre class=\"lang:c# theme:vs2012\">let sales = ResizeArray&lt;CupcakeSale&gt;()\r\ntype CupcakeSalesCSV = CsvProvider&lt;\"cupcake_sales.csv\", \",\"&gt;\r\nlet csv = new CupcakeSalesCSV()\r\nfor row in csv.Rows do\r\n    sales.Add({CupcakeId = row.CupcakeId;\r\n        Type = row.Type;\r\n        Price = (float) row.Price;\r\n        CustomerId = row.CustomerId;\r\n        Rating = (float) row.Rating;\r\n        Total = (float) row.Total})<\/pre>\n<p>Further, you can increase the number of inputs in this list to achieve more accuracy with the algorithm result. Or, if you prefer, you can get the data from a data source or even a web service.<\/p>\n<p>The next step is to group the data in a way to have the rating average values (as the <em>x<\/em> in the formula) vs the average of the total of times each cupcake was ordered (the <em>y<\/em>, the most important information).<\/p>\n<pre class=\"lang:c# theme:vs2012\">let filterByRating = [(fun (x : CupcakeSale) -&gt; x.Rating)]\r\nlet filterByTotal = [(fun (x : CupcakeSale) -&gt; x.Total)]\r\nlet groupedByRatings = \r\n    sales\r\n    |&gt; Seq.groupBy(fun x -&gt; x.CupcakeId)\r\n    |&gt; Seq.map(fun (key, values) -&gt; \r\n           (key, [for prop in filterByRating -&gt; values |&gt; Seq.averageBy prop]))\r\n    |&gt; Seq.toArray\r\nlet groupedByTotals = \r\n    sales\r\n    |&gt; Seq.groupBy(fun x -&gt; x.CupcakeId)\r\n    |&gt; Seq.map(fun (key, values) -&gt; \r\n           (key, [for prop in filterByTotal -&gt; values |&gt; Seq.averageBy prop]))\r\n    |&gt; Seq.toArray<\/pre>\n<p>The variables <strong>filterBy-Something<\/strong> are only a condition attached to the grouping + filtering made upon <strong>groupedBy-Something<\/strong> variables. The operator <strong><em>|&gt;<\/em><\/strong> (pipe-forward) allows you to pass an intermediate\/temporary result (on the leftmost side) to the next function (on the closest right side).<\/p>\n<p>The function <strong>groupBy <\/strong>gets the given list (<strong>sales<\/strong>) and returns a sequence of tuples containing the unique key (the cupcake <strong>id<\/strong>) and all the elements that key matches within another sequence. The next function, <strong>map<\/strong>, receives these tuples mapped to key\/value variables. Then, the lambda expression iterates over the values to apply an <strong>averageBy <\/strong>function against the <strong>filterBy-(Rating\/Total)<\/strong> condition you\u2019ve seen before and finally returns an array containing each tuple of <strong>id\/(rating and total averages). <\/strong>Check the following REPL result as shown in Figure 8.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"651\" height=\"223\" class=\"wp-image-79599\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2018\/07\/word-image-23.png\" \/><\/p>\n<p class=\"caption\">Figure 8: Calculating the averages and totals<\/p>\n<p>Tuples are represented by parentheses and the first element is called <em>key<\/em> (or <em>left<\/em>), the second is <em>value<\/em> (or <em>right<\/em>).<\/p>\n<p>The linear regression object is created from the <em>x<\/em> and <em>y<\/em> values which, in turn, must be represented as arrays with each index of each array corresponding to the respective <em>values<\/em> and <em>total<\/em>. Because of that, the code iterates over the array of tuples (of both <strong>groupedBySomething <\/strong>variables) to extract this correlated data:<\/p>\n<pre class=\"lang:c# theme:vs2012\">let cupcakeIds = Array.create groupedByRatings.Length 0\r\nlet x_averages = Array.create groupedByRatings.Length 0.0\r\nlet y_totals = Array.create groupedByRatings.Length 0.0\r\nfor i in 0..groupedByRatings.Length - 1 do\r\n    let averageTuple = Array.get groupedByRatings i\r\n    let totalTuple = Array.get groupedByTotals i\r\n    let _id = fst averageTuple\r\n    let _average = (snd averageTuple).[0]\r\n    let _total = (snd totalTuple).[0]\r\n    Array.set cupcakeIds i _id\r\n    Array.set x_averages i _average\r\n    Array.set y_totals i _total<\/pre>\n<p><strong>Array.create<\/strong> is a function that creates a new array with the given length and fills it with the given values. The reserved words <strong>fst<\/strong> and <strong>snd<\/strong> are used to access the first and second values of a tuple in F#, respectively.<\/p>\n<p>Finally, you can review the linear regression code:<\/p>\n<pre class=\"lang:c# theme:vs2012\">let ols = OrdinaryLeastSquares()\r\nlet regression = ols.Learn(x_averages, y_totals)\r\n\/\/ Let's say you received this value from the web form\r\nlet purchasedCupcakeId = 1;\r\n\/\/ A shortcut to find the corresponding sale of the provided cupcake id\r\nlet findIndex arr elem = arr |&gt; Array.findIndex((=) elem)\r\nlet i = findIndex cupcakeIds purchasedCupcakeId\r\nlet result = regression.Transform(Array.get x_averages i)\r\nSystem.Console.WriteLine(\"Suggested quantity: {0}\", System.Math.Round(result))<\/pre>\n<p><em>OrdinaryLeastSquares<\/em> (OLS) is the standard linear regression approach used by the Accord.NET library. It is based on the famous least-squares procedure that, in turn, models a single and continuous variable response (y) predicted by another variable recorded on an interval (x) through a linear relationship. In other words, OLS is the most basic and common mathematical representation of the linear regression formula: y = f(x) + e. Its function called <strong>Learn<\/strong> is responsible for receiving the x\/y arrays and so learn by them (more and more every time you increase the arrays) resulting in the regression itself. Once you have seen the model digested by the regression function, all you need to do is to provide a cupcake rating average of a specific cupcake type and the suggested value will be generated as result in the beginning of the F# Interactive output shown in Figure 9. Note that the value was rounded since the user won\u2019t be able to buy a fraction of a cupcake :<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"297\" height=\"113\" class=\"wp-image-79600\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2018\/07\/word-image-24.png\" \/><\/p>\n<p class=\"caption\">Figure 9: The suggested quantity<\/p>\n<p>Now, try it yourself. Feed your algorithm by increasing the number of cupcake sales to the list and analyzing how the linear regression calculates the best fit for (low) user reviews versus the total of number of orders.<\/p>\n<h2>Conclusion<\/h2>\n<p>Using .NET libraries to accomplish machine learning algorithms not only makes it possible to use the power of data science to help predict different sort of things, but also allows you to integrate code easily in all .NET projects\/technologies. Of course, it goes further: It provides fast ways to export code to <em>dll\u2019s<\/em> that can be imported into other languages that know how to translate one type of object into another.<\/p>\n<p>The code in this article is, perhaps, the simplest type of linear regression that can be built with machine learning. Fortunately, <a href=\"http:\/\/accord-framework.net\/\">its official website<\/a> is full of awesome content, more complex examples of regression, classification, tests of hypotheses and even image\/audio manipulation. With regard to F#, both the <a href=\"http:\/\/fsharp.org\/\">official project<\/a> and the <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/fsharp\/\">.NET support documentation<\/a> pages are well documented in a way that is extremely easy to understand. All of that is available to help you to take bigger steps as you learn.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The .NET F# language can be used for machine learning. In this article, Diogo Souza explains what is needed in Visual Studio to take advantage of this feature and walks you through a simple regression example. &hellip;<\/p>\n","protected":false},"author":320401,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[143538,47],"tags":[],"coauthors":[60461],"class_list":["post-79591","post","type-post","status-publish","format-standard","hentry","category-dotnet-development","category-data-science"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/79591","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/users\/320401"}],"replies":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/comments?post=79591"}],"version-history":[{"count":10,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/79591\/revisions"}],"predecessor-version":[{"id":79621,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/79591\/revisions\/79621"}],"wp:attachment":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media?parent=79591"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/categories?post=79591"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/tags?post=79591"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/coauthors?post=79591"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}