congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
LenskitConfiguration.addRoot
Code IndexAdd Tabnine to your IDE (free)

How to use
addRoot
method
in
org.lenskit.LenskitConfiguration

Best Java code snippets using org.lenskit.LenskitConfiguration.addRoot (Showing top 11 results out of 315)

origin: lenskit/lenskit

/**
 * Add a root type.
 * @param type The type to add.
 * @see LenskitConfiguration#addRoot(Class)
 */
public void root(Class<?> type) {
  config.addRoot(type);
}
origin: lenskit/lenskit

for (EvalTask task: tasks) {
  for (Class<?> cls: task.getRequiredRoots()) {
    config.addRoot(cls);
origin: org.grouplens.lenskit/lenskit-groovy

/**
 * Add a root type.
 * @param type The type to add.
 * @see LenskitConfiguration#addRoot(Class)
 */
public void root(Class<?> type) {
  config.addRoot(type);
}
origin: lenskit/lenskit

                     efac.rating(101, 203, 3.5));
LenskitConfiguration config = new LenskitConfiguration();
config.addRoot(BiasModel.class);
config.bind(BiasModel.class).to(LiveUserItemBiasModel.class);
origin: lenskit/lenskit

@Test
public void testComputeUserMeans() {
  EntityFactory efac = new EntityFactory();
  EntityCollectionDAOBuilder daoBuilder = new EntityCollectionDAOBuilder();
  daoBuilder.addEntities(efac.rating(100, 200, 3.0),
              efac.rating(101, 200, 4.0),
              efac.rating(102, 201, 2.5),
              efac.rating(102, 203, 4.5),
              efac.rating(101, 203, 3.5));
  LenskitConfiguration config = new LenskitConfiguration();
  config.addRoot(BiasModel.class);
  config.bind(BiasModel.class).toProvider(UserAverageRatingBiasModelProvider.class);
  LenskitRecommender rec = LenskitRecommender.build(config, daoBuilder.build());
  BiasModel model = rec.get(BiasModel.class);
  assertThat(model.getIntercept(), closeTo(3.5, 1.0e-3));
  assertThat(model.getUserBias(100), closeTo(-0.5, 1.0e-3));
  assertThat(model.getUserBias(101), closeTo(0.25, 1.0e-3));
  assertThat(model.getUserBias(102), closeTo(0.0, 1.0e-3));
}
origin: lenskit/lenskit

@Test
public void testComputeItemMeans() {
  EntityFactory efac = new EntityFactory();
  EntityCollectionDAOBuilder daoBuilder = new EntityCollectionDAOBuilder();
  daoBuilder.addEntities(efac.rating(100, 200, 3.0),
              efac.rating(101, 200, 4.0),
              efac.rating(101, 201, 2.5),
              efac.rating(102, 203, 4.5),
              efac.rating(103, 203, 3.5));
  LenskitConfiguration config = new LenskitConfiguration();
  config.addRoot(BiasModel.class);
  config.bind(BiasModel.class).toProvider(ItemAverageRatingBiasModelProvider.class);
  LenskitRecommender rec = LenskitRecommender.build(config, daoBuilder.build());
  BiasModel model = rec.get(BiasModel.class);
  assertThat(model.getIntercept(), closeTo(3.5, 1.0e-3));
  assertThat(model.getItemBias(200), closeTo(0.0, 1.0e-3));
  assertThat(model.getItemBias(201), closeTo(-1.0, 1.0e-3));
  assertThat(model.getItemBias(203), closeTo(0.5, 1.0e-3));
}
origin: lenskit/lenskit

  @Test
  public void testComputeMeans() {
    EntityFactory efac = new EntityFactory();
    EntityCollectionDAOBuilder daoBuilder = new EntityCollectionDAOBuilder();
    daoBuilder.addEntities(efac.rating(100, 200, 3.0),
                efac.rating(101, 200, 4.0),
                efac.rating(102, 201, 2.5),
                efac.rating(102, 203, 4.5),
                efac.rating(101, 203, 3.5));
    LenskitConfiguration config = new LenskitConfiguration();
    config.addRoot(BiasModel.class);
    config.bind(BiasModel.class).to(UserBiasModel.class);

    LenskitRecommender rec = LenskitRecommender.build(config, daoBuilder.build());
    BiasModel model = rec.get(BiasModel.class);

    assertThat(model.getIntercept(), closeTo(3.5, 1.0e-3));
    assertThat(model.getUserBias(100), closeTo(-0.5, 1.0e-3));
    assertThat(model.getUserBias(101), closeTo(0.25, 1.0e-3));
    assertThat(model.getUserBias(102), closeTo(0.0, 1.0e-3));
  }
}
origin: lenskit/lenskit

  @Test
  public void testComputeMeans() {
    EntityFactory efac = new EntityFactory();
    EntityCollectionDAOBuilder daoBuilder = new EntityCollectionDAOBuilder();
    daoBuilder.addEntities(efac.rating(100, 200, 3.0),
                efac.rating(101, 200, 4.0),
                efac.rating(101, 201, 2.5),
                efac.rating(102, 203, 4.5),
                efac.rating(103, 203, 3.5));
    LenskitConfiguration config = new LenskitConfiguration();
    config.addRoot(BiasModel.class);
    config.bind(BiasModel.class).toProvider(ItemAverageRatingBiasModelProvider.class);

    LenskitRecommender rec = LenskitRecommender.build(config, daoBuilder.build());
    BiasModel model = rec.get(BiasModel.class);

    assertThat(model.getIntercept(), closeTo(3.5, 1.0e-3));
    assertThat(model.getItemBias(200), closeTo(0.0, 1.0e-3));
    assertThat(model.getItemBias(201), closeTo(-1.0, 1.0e-3));
    assertThat(model.getItemBias(203), closeTo(0.5, 1.0e-3));
  }
}
origin: lenskit/lenskit

@Before
public void createNormalizer() {
  EntityFactory ef = new EntityFactory();
  EntityCollectionDAOBuilder db = new EntityCollectionDAOBuilder();
  /* Set up so that b=3.0, b(u=42) = 0.5, b(u=37) = -0.2, b(i=1) = 0.2, b(i=2) = -0.1 */
  db.addEntities(ef.rating(42, 7, 3.0),
          ef.rating(42, 8, 4.0),
          ef.rating(37, 9, 3.0),
          ef.rating(37, 10, 2.6),
          ef.rating(99, 1, 3.2),
          ef.rating(99, 2, 2.9),
          ef.rating(99, 7, 2),
          ef.rating(99, 8, 3),
          ef.rating(99, 9, 3.4),
          ef.rating(99, 10, 3.0),
          ef.rating(99, 99, 2.9));
  db.deriveEntities(CommonTypes.ITEM,
           CommonTypes.RATING,
           CommonAttributes.ITEM_ID);
  db.deriveEntities(CommonTypes.USER,
           CommonTypes.RATING,
           CommonAttributes.USER_ID);
  LenskitConfiguration config = new LenskitConfiguration();
  config.bind(BaselineScorer.class, ItemScorer.class).to(UserMeanItemScorer.class);
  config.bind(UserMeanBaseline.class, ItemScorer.class).to(ItemMeanRatingItemScorer.class);
  config.bind(UserVectorNormalizer.class).to(BaselineSubtractingUserVectorNormalizer.class);
  config.addRoot(UserVectorNormalizer.class);
  recommender = LenskitRecommender.build(config, db.build());
  normalizer = recommender.get(UserVectorNormalizer.class);
}
origin: lenskit/lenskit

  @Test
  public void testComputeAllMeans() {
    EntityFactory efac = new EntityFactory();
    EntityCollectionDAOBuilder daoBuilder = new EntityCollectionDAOBuilder();
    daoBuilder.addEntities(efac.rating(100, 200, 3.0),
                efac.rating(101, 200, 4.0),
                efac.rating(102, 201, 2.5),
                efac.rating(102, 203, 4.5),
                efac.rating(101, 203, 3.5));
    LenskitConfiguration config = new LenskitConfiguration();
    config.addRoot(BiasModel.class);
    config.bind(BiasModel.class).toProvider(UserItemAverageRatingBiasModelProvider.class);

    LenskitRecommender rec = LenskitRecommender.build(config, daoBuilder.build());
    BiasModel model = rec.get(BiasModel.class);

    assertThat(model.getIntercept(), closeTo(3.5, 1.0e-3));
    assertThat(model.getItemBias(200), closeTo(0.0, 1.0e-3));
    assertThat(model.getItemBias(201), closeTo(-1.0, 1.0e-3));
    assertThat(model.getItemBias(203), closeTo(0.5, 1.0e-3));
    assertThat(model.getUserBias(100), closeTo(-0.5, 1.0e-3));
    assertThat(model.getUserBias(101), closeTo(0, 1.0e-3));
    assertThat(model.getUserBias(102), closeTo(0.25, 1.0e-3));
  }
}
origin: org.grouplens.lenskit/lenskit-eval

for (EvalTask task: tasks) {
  for (Class<?> cls: task.getRequiredRoots()) {
    config.addRoot(cls);
org.lenskitLenskitConfigurationaddRoot

Javadoc

Add the specified component type as a root component. This forces it (and its dependencies) to be resolved, and makes it available from the resulting recommenders.

Popular methods of LenskitConfiguration

  • <init>
    Create a new copy of a LensKit configuration.
  • bind
  • set
  • addComponent
  • within
  • buildGraph
    Get a mockup of the full recommender graph. This fully resolves the graph so that it can be analyzed
  • getBindings
  • getRoots
  • wrapContext
  • clearRoots
    Clear the set of roots, removing all configured and default roots. This is almost never desired in p

Popular in Java

  • Making http requests using okhttp
  • startActivity (Activity)
  • putExtra (Intent)
  • findViewById (Activity)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • JComboBox (javax.swing)
  • JFileChooser (javax.swing)
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now