Esempio n. 1
0
 @Test
 public void testFractionLoaded() {
   assertEquals(1.0f, new ALSSpeedModel(2).getFractionLoaded());
   ALSSpeedModel model = new ALSSpeedModel(2);
   model.retainRecentAndUserIDs(Collections.singleton("U1"));
   model.retainRecentAndItemIDs(Collections.singleton("I0"));
   assertEquals(0.0f, model.getFractionLoaded());
   model.setUserVector("U1", new float[] {1.5f, -2.5f});
   assertEquals(0.5f, model.getFractionLoaded());
   model.setItemVector("I0", new float[] {0.5f, 0.0f});
   assertEquals(1.0f, model.getFractionLoaded());
 }
Esempio n. 2
0
 @Test
 public void testUserItemVector() {
   ALSSpeedModel model = new ALSSpeedModel(2);
   assertEquals(2, model.getFeatures());
   model.setUserVector("U1", new float[] {1.5f, -2.5f});
   assertArrayEquals(new float[] {1.5f, -2.5f}, model.getUserVector("U1"));
   model.setItemVector("I0", new float[] {0.5f, 0.0f});
   assertArrayEquals(new float[] {0.5f, 0.0f}, model.getItemVector("I0"));
 }