当前位置: 首页>>代码示例>>C#>>正文


C# DataModel.GetItems方法代码示例

本文整理汇总了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);
				}
			}
		}
开发者ID:ccollie,项目名称:taste.net,代码行数:31,代码来源:GenericItemCorrelation.cs


注:本文中的DataModel.GetItems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。