Skip to content
Browse files

Adding more range to generated reviewer scores to produce more valuab…

…le results.
  • Loading branch information...
1 parent 384e0ef commit 1121c9e2988c74971804954465d1262ba6ee194f @robertgreiner committed
View
16 Recommender.Tests/Common/RankReviewersTests.cs
@@ -46,27 +46,27 @@ public void OrderingOfSortedReviewersShouldBeDifferentThanInitialListOfReviewers
}
[Test]
- public void TheMostSimilarReviewerShouldBeR4()
+ public void TheMostSimilarReviewerShouldBeCarol()
{
- Assert.AreEqual(reviewers.ElementAt(2).Name, sortedReviewers.ElementAt(0).Key.Name);
+ Assert.AreEqual(reviewers.ElementAt(2).Name, "Carol");
}
[Test]
- public void TheSecondRankedReviewerShouldBeR5()
+ public void TheSecondRankedReviewerShouldBeShelby()
{
- Assert.AreEqual(reviewers.ElementAt(3).Name, sortedReviewers.ElementAt(1).Key.Name);
+ Assert.AreEqual(reviewers.ElementAt(3).Name, "Shelby");
}
[Test]
- public void TheThirdRankedReviewerShouldBeR2()
+ public void TheThirdRankedReviewerShouldBeSeymour()
{
- Assert.AreEqual(reviewers.ElementAt(0).Name, sortedReviewers.ElementAt(2).Key.Name);
+ Assert.AreEqual(reviewers.ElementAt(0).Name, "Seymour");
}
[Test]
- public void TheLeastSimilarReviewerShouldBeR3()
+ public void TheLeastSimilarReviewerShouldBeMichael()
{
- Assert.AreEqual(reviewers.ElementAt(1).Name, sortedReviewers.ElementAt(3).Key.Name);
+ Assert.AreEqual(reviewers.ElementAt(1).Name, "Michael");
}
}
}
View
2 Recommender.Tests/Instructions/SumProductsTests.cs
@@ -26,7 +26,7 @@ public void SetUp()
[Test]
public void ShouldSumTheProductsOfBothReviewers()
{
- Assert.AreEqual(59.5, new SumProducts(similarReviews, r1.Reviews, r2.Reviews).Calculate());
+ Assert.AreEqual(43.75, new SumProducts(similarReviews, r1.Reviews, r2.Reviews).Calculate());
}
}
}
View
2 Recommender.Tests/Instructions/SumScoresTests.cs
@@ -34,7 +34,7 @@ public void SumASingleScoreFromOneUser()
[Test]
public void ShouldSumAllOfTheScoresFromTheFirstUser()
{
- Assert.AreEqual(18.0, new SumScores(similarReviews, r1.Reviews).Calculate());
+ Assert.AreEqual(15.0, new SumScores(similarReviews, r1.Reviews).Calculate());
}
[Test]
View
2 Recommender.Tests/Instructions/SumSquaresTests.cs
@@ -27,7 +27,7 @@ public void SetUp()
[Test]
public void ShouldSumTheSquaresOfAllOfTheScoresFromTheFirstUser()
{
- Assert.AreEqual(55.0, new SumSquares(similarReviews, r1.Reviews).Calculate());
+ Assert.AreEqual(44.0, new SumSquares(similarReviews, r1.Reviews).Calculate());
}
[Test]
View
2 Recommender.Tests/SimilarityScore/EuclideanDistanceTests.cs
@@ -18,7 +18,7 @@ public void SetUp()
[Test]
public void TwoReviewersWithSomeSimilarReviewsShouldHaveAScoreBetweenZeroAndOne()
{
- Assert.AreEqual(0.148, euclideanDistance.Score());
+ Assert.AreEqual(0.037, euclideanDistance.Score());
}
[Test]
View
9 Recommender.Tests/SimilarityScore/PearsonCorrelationTests.cs
@@ -35,17 +35,16 @@ public void ReviewersThatHaveTheSameTasteShouldHaveAPerfectScore()
[Test]
public void TwoReviewersWithSomeSimilarReviewsShouldHaveAScoreBetweenZeroAndOne()
{
- Assert.AreEqual(0.396, pearsonCorrelationScore.Score());
+ Assert.AreEqual(-0.777, pearsonCorrelationScore.Score());
}
[Test]
public void TestValuesOfReviewers()
{
var currentUser = ReviewerBuilder.BuildReviewer1();
- Assert.AreEqual(0.396, new PearsonCorrelation(currentUser, ReviewerBuilder.BuildReviewer2()).Score());
- Assert.AreEqual(-0.141, new PearsonCorrelation(currentUser, ReviewerBuilder.BuildReviewer3()).Score());
- Assert.AreEqual(0.567, new PearsonCorrelation(currentUser, ReviewerBuilder.BuildReviewer4()).Score());
- Assert.AreEqual(0.423, new PearsonCorrelation(currentUser, ReviewerBuilder.BuildReviewer5()).Score());
+ Assert.AreEqual(0.211, new PearsonCorrelation(currentUser, ReviewerBuilder.BuildReviewer3()).Score());
+ Assert.AreEqual(-0.343, new PearsonCorrelation(currentUser, ReviewerBuilder.BuildReviewer4()).Score());
+ Assert.AreEqual(-0.832, new PearsonCorrelation(currentUser, ReviewerBuilder.BuildReviewer5()).Score());
}
}
}
View
12 Recommender/Data/ReviewerBuilder.cs
@@ -71,11 +71,11 @@ public static Reviewer BuildAReviewerThatReviewedSomethingUnique()
public static Reviewer BuildReviewer1()
{
var reviewer = new Reviewer {Name = "Lisa"};
- reviewer.AddReview("Code Complete", 2.5);
- reviewer.AddReview("C# in Depth", 3.5);
- reviewer.AddReview("Clean Code", 3.0);
- reviewer.AddReview("Unit Testing", 3.5);
- reviewer.AddReview("Joel on Software", 3.0);
+ reviewer.AddReview("Code Complete", 3.5);
+ reviewer.AddReview("C# in Depth", 1.0);
+ reviewer.AddReview("Clean Code", 4.0);
+ reviewer.AddReview("Unit Testing", 1.5);
+ reviewer.AddReview("Joel on Software", 2.5);
reviewer.AddReview("Refactoring", 2.5);
return reviewer;
}
@@ -97,7 +97,7 @@ public static Reviewer BuildReviewer3()
var reviewer = new Reviewer {Name = "Michael"};
reviewer.AddReview("Code Complete", 1.5);
reviewer.AddReview("C# in Depth", 1.0);
- reviewer.AddReview("Unit Testing", 4.5);
+ reviewer.AddReview("Unit Testing", 2.5);
reviewer.AddReview("Refactoring", 5.0);
return reviewer;
}

0 comments on commit 1121c9e

Please sign in to comment.
Something went wrong with that request. Please try again.