All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.codelibs.elasticsearch.taste.recommender.ItemBasedRecommenderBuilder Maven / Gradle / Ivy

package org.codelibs.elasticsearch.taste.recommender;

import java.util.HashMap;
import java.util.Map;

import org.codelibs.elasticsearch.taste.model.DataModel;
import org.codelibs.elasticsearch.taste.model.IndexInfo;
import org.codelibs.elasticsearch.taste.similarity.ItemSimilarity;
import org.codelibs.elasticsearch.util.settings.SettingsUtils;

public class ItemBasedRecommenderBuilder extends AbstractRecommenderBuilder {

    public ItemBasedRecommenderBuilder(final IndexInfo indexInfo,
            final Map rootSettings) {
        super(indexInfo, rootSettings);
    }

    @Override
    public Recommender buildRecommender(final DataModel dataModel) {
        final Map similaritySettings = SettingsUtils.get(
                rootSettings, "similarity", new HashMap());
        similaritySettings.put(DATA_MODEL_ATTR, dataModel);
        final ItemSimilarity similarity = createSimilarity(similaritySettings);

        return new GenericItemBasedRecommender(dataModel, similarity);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy