本文整理汇总了C#中FileReader.GetData方法的典型用法代码示例。如果您正苦于以下问题:C# FileReader.GetData方法的具体用法?C# FileReader.GetData怎么用?C# FileReader.GetData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileReader
的用法示例。
在下文中一共展示了FileReader.GetData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ItemItemStart
static void ItemItemStart()
{
FileReader fReader = new FileReader();
Dictionary<int, UserPref> userList = fReader.GetData();
Dictionary<string, float> fileMetaData = fReader.GetMetaData();
FormulaFactory forFactory = new FormulaFactory();
ItemComparer itemComparer = new ItemComparer(fReader.allProducts, userList);
int targetUserID = 186;
int targetProductID = 172;
DateTime startTime = DateTime.Now;
itemComparer.PredictRating(userList[targetUserID], targetProductID);
// var x = itemComparer.PredictTopRatings(userList[targetUserID], 5);
DateTime endTime = DateTime.Now;
Console.WriteLine("Calculating the predicted rating took {0} ms",(endTime-startTime).Milliseconds);
//itemComparer.AddNewRating(userList[3],105,4);
//var y = itemComparer.PredictTopRatings(userList[targetUserID], 5);
Console.Read();
}
示例2: UserItemStart
static void UserItemStart()
{
FileReader fReader = new FileReader();
Dictionary<int, UserPref> userList = fReader.GetData();
Dictionary<string, float> fileMetaData = fReader.GetMetaData();
FormulaFactory forFactory = new FormulaFactory();
NeighbourFinder nFinder = new NeighbourFinder(forFactory.GetFormula(fileMetaData));
int targetUserID = 186;
Dictionary<int, double> neighbourList = nFinder.FindNeighbours(targetUserID, userList);
foreach (var neighbour in neighbourList)
{
Console.WriteLine("Neighbour {0} has a similarity of {1}", neighbour.Key, neighbour.Value);
}
RatingPredictor rPredictor = new RatingPredictor();
rPredictor.PredictRatings(userList, targetUserID, neighbourList);
rPredictor.GetTopPredictedRatings(8);
Console.Read();
}