Skip to content

Instantly share code, notes, and snippets.

@icebeam7
Created Dec 3, 2019
Embed
What would you like to do?
MovieRecommender: LoadData code
public static (IDataView training, IDataView test) LoadData(MLContext mlContext)
{
var dataPath = Path.Combine(Environment.CurrentDirectory, "Data");
var catalog = mlContext.Data;
var trainingData = Path.Combine(dataPath, "recommendation-ratings-train.csv");
var trainingDataView = catalog.LoadFromTextFile<MovieRating>(
trainingData, hasHeader: true, separatorChar: ',');
var testData = Path.Combine(dataPath, "recommendation-ratings-test.csv");
var testDataView = catalog.LoadFromTextFile<MovieRating>(
testData, hasHeader: true, separatorChar: ',');
return (trainingDataView, testDataView);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment