/// <summary>Create a CombinedRatings object from to existing IRatings objects</summary> /// <param name="ratings1">the first data set</param> /// <param name="ratings2">the second data set</param> public CombinedRatings(IRatings ratings1, IRatings ratings2) { Users = new CombinedList<int>(ratings1.Users, ratings2.Users); Items = new CombinedList<int>(ratings1.Items, ratings2.Items); Values = new CombinedList<float>(ratings1, ratings2); Scale = new RatingScale(ratings1.Scale, ratings2.Scale); MaxUserID = Math.Max(ratings1.MaxUserID, ratings2.MaxUserID); MaxItemID = Math.Max(ratings1.MaxItemID, ratings2.MaxItemID); }
public void TestConstructor3_1() { var levels = (new float[] {0f, 1f}).ToList(); var scale = new RatingScale(new RatingScale(levels), new RatingScale(levels)); Assert.AreEqual(0f, scale.Min); Assert.AreEqual(1f, scale.Max); Assert.AreEqual(2, scale.Levels.Count); Assert.AreEqual(0, scale.LevelID[0f]); Assert.AreEqual(1, scale.LevelID[1f]); }
/// <summary>Create a CombinedRatings object from to existing IRatings objects</summary> /// <param name="ratings1">the first data set</param> /// <param name="ratings2">the second data set</param> public CombinedRatings(IRatings ratings1, IRatings ratings2) { Users = new CombinedList <int>(ratings1.Users, ratings2.Users); Items = new CombinedList <int>(ratings1.Items, ratings2.Items); Values = new CombinedList <float>(ratings1, ratings2); Scale = new RatingScale(ratings1.Scale, ratings2.Scale); MaxUserID = Math.Max(ratings1.MaxUserID, ratings2.MaxUserID); MaxItemID = Math.Max(ratings1.MaxItemID, ratings2.MaxItemID); }
public void TestConstructor2() { var scale = new RatingScale(CreateRatings()); Assert.AreEqual(0.2f, scale.Min); Assert.AreEqual(0.6f, scale.Max); Assert.AreEqual(4, scale.Levels.Count); Assert.AreEqual(0, scale.LevelID[0.2f]); Assert.AreEqual(1, scale.LevelID[0.3f]); Assert.AreEqual(2, scale.LevelID[0.4f]); Assert.AreEqual(3, scale.LevelID[0.6f]); }
public void TestConstructor3_2() { var levels = (new float[] {0f, 1f}).ToList(); var scale = new RatingScale(new RatingScale(levels), new RatingScale(CreateRatings())); Assert.AreEqual(0f, scale.Min); Assert.AreEqual(1f, scale.Max); Assert.AreEqual(6, scale.Levels.Count); Assert.AreEqual(0, scale.LevelID[0f]); Assert.AreEqual(1, scale.LevelID[0.2f]); Assert.AreEqual(2, scale.LevelID[0.3f]); Assert.AreEqual(3, scale.LevelID[0.4f]); Assert.AreEqual(4, scale.LevelID[0.6f]); Assert.AreEqual(5, scale.LevelID[1f]); }
/// public Ratings(SerializationInfo info, StreamingContext context) : base(info, context) { Values = (List <float>)info.GetValue("Values", typeof(List <float>)); Scale = (RatingScale)info.GetValue("Scale", typeof(RatingScale)); }
/// public virtual void InitScale() { Scale = new RatingScale(this.Values); }
/// <summary> /// Initializes a new instance of the <see cref="MyMediaLite.Data.RatingScale"/> class, /// given two existing instances. /// </summary> /// <param name='scale1'>the first scale object</param> /// <param name='scale2'>the second scale object</param> public RatingScale(RatingScale scale1, RatingScale scale2) { Init(scale1.LevelID.Keys.Union(scale2.LevelID.Keys).ToList()); }
/// public override void InitScale() { Scale = new RatingScale(this.byte_values); }