本文整理汇总了C#中DataModel.GetItems方法的典型用法代码示例。如果您正苦于以下问题:C# DataModel.GetItems方法的具体用法?C# DataModel.GetItems怎么用?C# DataModel.GetItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataModel
的用法示例。
在下文中一共展示了DataModel.GetItems方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenericItemCorrelation
/// <summary>
/// <p>Builds a list of item-item correlations given an {@link ItemCorrelation} implementation and a
/// <see cref="DataModel">DataModel</see>, rather than a list of {@link ItemItemCorrelation}s.</p>
/// <p>It's valid to build a <see cref="GenericItemCorrelation"/> this way, but perhaps missing some of the point
/// of an item-based Recommender. Item-based recommenders use the assumption that item-item correlations
/// are relatively fixed, and might be known already independent of user preferences. Hence it is useful
/// to inject that information, using {@link GenericItemCorrelation(java.util.Collection)}.</p>
/// </summary>
/// <param name="otherCorrelation">otherCorrelation other {@link ItemCorrelation} to get correlations from</param>
/// <param name="dataModel">dataModel data Model to get {@link Item}s from</param>
public GenericItemCorrelation(ItemCorrelation otherCorrelation, DataModel dataModel)
{
List<Item> items = EnumeratorUtils.EnumerableToList<Item>(dataModel.GetItems());
int size = items.Count;
for (int i = 0; i < size; i++)
{
Item item1 = items[i];
for (int j = i + 1; j < size; j++)
{
Item item2 = items[j];
double correlation = otherCorrelation.GetItemCorrelation(item1, item2);
Dictionary<Item, Double> map = null;
if (!correlationMaps.TryGetValue(item1, out map))
{
map = new Dictionary<Item, Double>(1009);
correlationMaps.Add(item1, map);
}
map.Add(item2, correlation);
}
}
}