本文整理汇总了C#中IEntityMapping.ToOriginalID方法的典型用法代码示例。如果您正苦于以下问题:C# IEntityMapping.ToOriginalID方法的具体用法?C# IEntityMapping.ToOriginalID怎么用?C# IEntityMapping.ToOriginalID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEntityMapping
的用法示例。
在下文中一共展示了IEntityMapping.ToOriginalID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WritePredictions
// TODO as soon as we drop support for Mono 2.6, use default arguments
/// <summary>Rate a given set of instances and write it to a TextWriter</summary>
/// <param name="recommender">rating predictor</param>
/// <param name="ratings">test cases</param>
/// <param name="user_mapping">an <see cref="EntityMapping"/> object for the user IDs</param>
/// <param name="item_mapping">an <see cref="EntityMapping"/> object for the item IDs</param>
/// <param name="line_format">a format string specifying the line format; {0} is the user ID, {1} the item ID, {2} the rating</param>
/// <param name="writer">the TextWriter to write the predictions to</param>
public static void WritePredictions(
IRatingPredictor recommender,
IRatings ratings,
IEntityMapping user_mapping, IEntityMapping item_mapping,
string line_format,
TextWriter writer)
{
for (int index = 0; index < ratings.Count; index++)
writer.WriteLine(line_format,
user_mapping.ToOriginalID(ratings.Users[index]),
item_mapping.ToOriginalID(ratings.Items[index]),
recommender.Predict(ratings.Users[index], ratings.Items[index]).ToString(CultureInfo.InvariantCulture));
}