-
-
Save AbhiAgarwal192/b56215361a2b840485873ebedb6f8592 to your computer and use it in GitHub Desktop.
This code is part of a Medium article.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// The main program class. | |
/// </summary> | |
class Program | |
{ | |
// filename for dataset | |
private static string dataPath = Path.Combine(Environment.CurrentDirectory, "amazon0302.txt"); | |
/// <summary> | |
/// The main entry point of the program. | |
/// </summary> | |
/// <param name="args">The command line arguments.</param> | |
static void Main(string[] args) | |
{ | |
// create a machine learning context | |
var context = new MLContext(); | |
// load the dataset in memory | |
Console.WriteLine("Loading data..."); | |
var data = context.Data.LoadFromTextFile<ProductInfo>( | |
dataPath, | |
hasHeader: true, | |
separatorChar: '\t'); | |
// split the data into 80% training and 20% testing partitions | |
var partitions = context.Data.TrainTestSplit(data, testFraction: 0.2); | |
// the rest of the code goes here... | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment