Tutorials Machine Learning with .NET
Getting Started with ML.NET (Regression Analysis)
On this page
What is ML.NET?
ML.NET is an open-source, cross-platform machine learning framework for .NET developers. You can use your existing C# or F# skills to integrate ML into your apps locally, without needing Python!
Scenario: Predicting House Prices
We'll use standard regression to predict a value based on input features.
using Microsoft.ML;
using Microsoft.ML.Data;
// Define Data Structures
public class HouseData {
public float Size { get; set; }
public float Price { get; set; }
}
public class Prediction {
[ColumnName("Score")]
public float Price { get; set; }
}
// Training Logic
var mlContext = new MLContext();
var dataView = mlContext.Data.LoadFromEnumerable(new List { /* Load data */ });
var pipeline = mlContext.Transforms.Concatenate("Features", "Size")
.Append(mlContext.Regression.Trainers.Sdca(labelColumnName: "Price"));
var model = pipeline.Fit(dataView);
Questions on this lesson
0
Sign in to ask a question or upvote helpful answers.
No questions yet — be the first to ask!