Exemple #1
0
 @Before
 public void setUp() throws Exception {
   mp1 = MP1.getInstance();
   if (mp1 != null) {
     reader1 = mp1.GetDatasetReader("./dataset1/homes - Copy.txt", "./dataset1/friends.txt");
     if (reader1 != null) {
       assertTrue("Failed to read dataset1", reader1.read());
     }
     reader2 = mp1.GetDatasetReader("./dataset2/homes.txt", "./dataset2/friends.txt");
     if (reader2 != null) {
       assertTrue("Failed to read dataset2", reader2.read());
     }
   }
 }
Exemple #2
0
  @Test
  public void testWithin25KmAccuracy() {
    assertNotNull(reader1);

    SocialNetwork network1 = reader1.getSocialNetwork();
    assertNotNull(network1);

    GroundTruth gt1 = reader1.getGroundTruth();
    assertNotNull(gt1);

    InferenceAlgorithm simpleAlgo = mp1.GetSimpleInferenceAlgorithm(network1);
    assertNotNull(simpleAlgo);
    assertTrue(simpleAlgo instanceof SimpleInferenceAlgorithm);

    Evaluator evaluator = Evaluator.getInstance();
    assertNotNull(evaluator);

    Metric within25KmAccuracyMetric = new WithinXkmMetric(25.0);
    double normalizedError = evaluator.EvaluateInference(simpleAlgo, gt1, within25KmAccuracyMetric);
    double averageAccuracy = 1.0 - normalizedError;

    assertTrue(averageAccuracy > 0 && averageAccuracy < 1.0);

    System.out.println(
        "Info: testWithin25KmAccuracy - averageAccuracy: " + averageAccuracy * 100.0 + "%");
  }
Exemple #3
0
  @Test
  public void testGetPart2InferenceAlgorithm() {
    assertNotNull(reader2);
    SocialNetwork network2 = reader2.getSocialNetwork();
    assertNotNull(network2);

    InferenceAlgorithm part2Algo = mp1.GetPart2InferenceAlgorithm(network2);
    assertNotNull(part2Algo);
    assertFalse(part2Algo instanceof SimpleInferenceAlgorithm);
  }
Exemple #4
0
  @Test
  public void testGetSimpleInferenceAlgorithm() {
    assertNotNull(reader1);
    SocialNetwork network1 = reader1.getSocialNetwork();
    assertNotNull(network1);

    InferenceAlgorithm simpleAlgo = mp1.GetSimpleInferenceAlgorithm(network1);
    assertNotNull(simpleAlgo);
    assertTrue(simpleAlgo instanceof SimpleInferenceAlgorithm);
  }