當前位置: 首頁>>代碼示例>>Java>>正文


Java ExecutablePluginSupport類代碼示例

本文整理匯總了Java中org.easyrec.plugin.support.ExecutablePluginSupport的典型用法代碼示例。如果您正苦於以下問題:Java ExecutablePluginSupport類的具體用法?Java ExecutablePluginSupport怎麽用?Java ExecutablePluginSupport使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ExecutablePluginSupport類屬於org.easyrec.plugin.support包,在下文中一共展示了ExecutablePluginSupport類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: calculateSimilarity

import org.easyrec.plugin.support.ExecutablePluginSupport; //導入依賴的package包/類
public void calculateSimilarity(final Integer tenantId, final Integer actionTypeId, final Integer itemTypeId,
                                final Integer assocTypeId, final Integer viewTypeId, final Integer sourceTypeId,
                                final Date changeDate, final GeneratorStatistics stats,
                                final ExecutablePluginSupport.ExecutionControl control) {
    validateStrategies();

    if (logger.isInfoEnabled()) logger.info("Starting similarity computation.");

    Date start = new Date();

    int assocsCreated = similarityCalculationStrategy
            .calculateSimilarity(tenantId, actionTypeId, itemTypeId, assocTypeId, sourceTypeId, viewTypeId,
                    changeDate, control);
    stats.setNumberOfRulesCreated(assocsCreated);

    Date end = new Date();
    double time = (end.getTime() - start.getTime()) / 1000L;

    if (logger.isInfoEnabled())
        logger.info(String.format("Calculating USER-ITEM predictions for %d took %.2f seconds", tenantId, time));
}
 
開發者ID:major2015,項目名稱:easyrec_major,代碼行數:22,代碼來源:ItemItemServiceImpl.java

示例2: predict

import org.easyrec.plugin.support.ExecutablePluginSupport; //導入依賴的package包/類
public void predict(final Integer tenantId, final Integer actionTypeId, final Integer itemTypeId,
                    final Integer assocTypeId, final Integer viewTypeId, final Integer sourceTypeId,
                    final Date changeDate, final String sourceInfo, final Integer minRatingValue,
                    final Integer maxRatingValue, final ExecutablePluginSupport.ExecutionControl control) {
    validateStrategies();

    if (logger.isInfoEnabled()) logger.info("Starting prediction computation.");

    Date start = new Date();

    final List<Integer> users = actionDao.getUsersForTenant(tenantId);
    final List<ItemVO<Integer, Integer>> items = actionDao
            .getAvailableItemsForTenant(tenantId, itemTypeId);

    final ItemVO<Integer, Integer> itemSample = new ItemVO<Integer, Integer>(tenantId, null,
            itemTypeId);
    final UserAssoc sample = new UserAssoc(null, changeDate, itemSample, sourceTypeId, tenantId, null);

    predictionComputationStrategy
            .beginPrediction(sample, minRatingValue, maxRatingValue, configuration.isNormalizePredictions());

    final int TOTAL_STEPS = items.size();
    int currentStep = 0;

    final IAConstraintVO<Integer, Integer> constraints = new IAConstraintVO<Integer, Integer>(
            null, viewTypeId, sourceTypeId, sourceInfo, tenantId, true, null);

    for (final ItemVO<Integer, Integer> item : items) {
        if (control != null) control.updateProgress(
                String.format("Calculating predictions %d/%d - %.2f%%", currentStep, TOTAL_STEPS,
                        ((double) currentStep / (double) TOTAL_STEPS) * 100.00));

        final List<AssociatedItemVO<Integer, Integer>> itemAssocs = itemAssocService
                .getItemsFrom(itemTypeId, assocTypeId, item, constraints);

        for (final Integer user : users)
            if (!actionDao.didUserRateItem(user, item, actionTypeId))
                predictionComputationStrategy.predictForUserAndItem(user, item, itemAssocs);
    }

    predictionComputationStrategy.endPrediction();

    Date end = new Date();
    double time = (end.getTime() - start.getTime()) / 1000L;

    if (logger.isInfoEnabled())
        logger.info(String.format("Calculating similarities for %d took %.2f seconds", tenantId, time));
}
 
開發者ID:major2015,項目名稱:easyrec_major,代碼行數:49,代碼來源:ItemItemServiceImpl.java

示例3: calculateDeviations

import org.easyrec.plugin.support.ExecutablePluginSupport; //導入依賴的package包/類
public void calculateDeviations(SlopeOneIntegerConfiguration config, Date lastRun, SlopeOneStats stats,
                                Set<TenantItem> changedItemIds,
                                final ExecutablePluginSupport.ExecutionControl control) {
    long start = System.currentTimeMillis();

    // get only the users that did ratings since the last execution
    List<Integer> users = actionDAO.getUsers(config.getTenant(), config.getItemTypes(), lastRun);
    stats.setNoUsers(users.size());

    final int TOTAL_STEPS = users.size();
    int currentStep = 0;

    for (int userId : users) {
        if (control != null)
            control.updateProgress(String.format("Calculating deviations %d/%d", currentStep++, TOTAL_STEPS));

        // for each of these users get all his ratings
        List<RatingVO<Integer, Integer>> ratings =
                actionDAO.getRatings(config.getTenant(), config.getItemTypes(), userId);
        stats.setNumberOfActionsConsidered(stats.getNumberOfActionsConsidered() + ratings.size());

        // and use them to calculate the new deviations (old deviations, i.e. deviations that were already
        // generated in a prior run are already filtered by the strategy.)
        // moreover a proxy strategy merges the deviations with the deviations in the database (i.e. numerator
        // and denominator are already summed to the current value.)
        DeviationCalculationResult result = deviationCalculation.calculate(userId, ratings, lastRun);
        List<Deviation> deviations = result.getDeviations();
        stats.setNoCreatedDeviations(stats.getNoCreatedDeviations() + result.getCreated());
        stats.setNoModifiedDeviations(stats.getNoModifiedDeviations() + result.getModified());

        if (changedItemIds != null) {
            for (Deviation deviation : deviations) {
                changedItemIds.add(new TenantItem(deviation.getItem1Id(), deviation.getItem1TypeId()));
                changedItemIds.add(new TenantItem(deviation.getItem2Id(), deviation.getItem1TypeId()));
            }
        }

        deviationDAO.insertDeviations(deviations);
    }

    if (logger.isDebugEnabled())
        logger.debug("finishing deviations calculation");

    // endUpdate hint to DAO, so that if the DAO is cached the cache has a chance to write through to the underlying
    // store
    deviationDAO.endUpdate();

    stats.setDeviationDuration(System.currentTimeMillis() - start);
}
 
開發者ID:major2015,項目名稱:easyrec_major,代碼行數:50,代碼來源:SlopeOneServiceImpl.java

示例4: calculateSimilarity

import org.easyrec.plugin.support.ExecutablePluginSupport; //導入依賴的package包/類
/**
 * Calculate similarities between all items.
 *
 * @param tenantId     Tenant id.
 * @param actionTypeId Action type id.
 * @param itemTypeId   Item type id.
 * @param assocTypeId  Association type id.
 * @param sourceTypeId Source type id used for storing generated similarities.
 * @param viewTypeId   View type id used for storing generated similarities.
 * @param changeDate   Change date used for storing generated similarities.
 * @param control      Control to update progress.
 */
int calculateSimilarity(Integer tenantId, Integer actionTypeId, Integer itemTypeId, Integer assocTypeId,
                        Integer sourceTypeId, Integer viewTypeId, Date changeDate,
                        final ExecutablePluginSupport.ExecutionControl control);
 
開發者ID:major2015,項目名稱:easyrec_major,代碼行數:16,代碼來源:SimilarityCalculationStrategy.java

示例5: calculateSimilarity

import org.easyrec.plugin.support.ExecutablePluginSupport; //導入依賴的package包/類
/**
 * Calculate the similarity between each pair of items.
 *
 * @param tenantId     Tenant id.
 * @param actionTypeId Action type id.
 * @param itemTypeId   Item type id.
 * @param assocTypeId  Association type id.
 * @param viewTypeId   View type id.
 * @param sourceTypeId Source type id.
 * @param changeDate   Date to set for generated {@link org.easyrec.model.core.ItemAssocVO}s.
 * @param control      Control to update progress.
 */
void calculateSimilarity(Integer tenantId, Integer actionTypeId, Integer itemTypeId, Integer assocTypeId,
                         Integer viewTypeId, Integer sourceTypeId, Date changeDate, GeneratorStatistics stats,
                         final ExecutablePluginSupport.ExecutionControl control);
 
開發者ID:major2015,項目名稱:easyrec_major,代碼行數:16,代碼來源:ItemItemService.java

示例6: predict

import org.easyrec.plugin.support.ExecutablePluginSupport; //導入依賴的package包/類
/**
 * Calculate user to item predictions (recommendations) for each user.
 *
 * @param tenantId       Tenant id.
 * @param actionTypeId   Action type id.
 * @param itemTypeId     Item type id.
 * @param assocTypeId    Assocation type id.
 * @param viewTypeId     View type id.
 * @param sourceTypeId   Source type id.
 * @param changeDate     Date to set for generated +{@link org.easyrec.plugin.itemitem.model.UserAssoc}s.
 * @param sourceInfo     Source info to set for generated {@link org.easyrec.plugin.itemitem.model.UserAssoc}s.
 * @param minRatingValue Minimum allowed rating value (used only when {@link org.easyrec.plugin.itemitem.model.ItemItemConfiguration#isNormalizePredictions()}
 *                       is {@code true}.)
 * @param maxRatingValue Maximum allowed rating value (used only when {@link org.easyrec.plugin.itemitem.model.ItemItemConfiguration#isNormalizePredictions()}
 *                       is {@code true}.)
 * @param control        Control to update progress.
 */
void predict(Integer tenantId, Integer actionTypeId, Integer itemTypeId, Integer assocTypeId, Integer viewTypeId,
             Integer sourceTypeId, Date changeDate, String sourceInfo, Integer minRatingValue,
             Integer maxRatingValue, final ExecutablePluginSupport.ExecutionControl control);
 
開發者ID:major2015,項目名稱:easyrec_major,代碼行數:21,代碼來源:ItemItemService.java

示例7: calculateDeviations

import org.easyrec.plugin.support.ExecutablePluginSupport; //導入依賴的package包/類
/**
 * Calculate all new deviations since {@code lastRun}. All newly created deviation's items are optionally stored in
 * {@code changedItemIds}.
 *
 * @param tenant         Tenant to calculate deviations for.
 * @param config         Configuration used.
 * @param lastRun        Time of the last run, used to filter actions that happend before.
 * @param stats          Statistics.
 * @param changedItemIds If a non-null set is supplied all changed items will be stored in the set.
 * @param control        Control to update progress.
 */
void calculateDeviations(SlopeOneIntegerConfiguration config, Date lastRun, SlopeOneStats stats,
                         Set<TenantItem> changedItemIds, final ExecutablePluginSupport.ExecutionControl control);
 
開發者ID:major2015,項目名稱:easyrec_major,代碼行數:14,代碼來源:SlopeOneService.java

示例8: nonPersonalizedRecommendations

import org.easyrec.plugin.support.ExecutablePluginSupport; //導入依賴的package包/類
/**
 * Generate non personalized recommendations.
 * <p/>
 * Based on sorting of the deviation table to generate item->item recommendations.
 *
 * @param tenant         Tenant to calculate deviations for.
 * @param config         Configuration used.
 * @param stats          Statistics.
 * @param execution      Time to assign to newly created {@link org.easyrec.model.core.ItemAssocVO}s.
 * @param changedItemIds If a non-null set is supplied all changed items will be stored in the set.
 * @param sourceType     Source type for storing recommendations.
 * @param control        Control for updating progress.
 */
void nonPersonalizedRecommendations(SlopeOneIntegerConfiguration config, SlopeOneStats stats, Date execution,
                                    Set<TenantItem> changedItemIds,
                                    final ExecutablePluginSupport.ExecutionControl control);
 
開發者ID:major2015,項目名稱:easyrec_major,代碼行數:17,代碼來源:SlopeOneService.java


注:本文中的org.easyrec.plugin.support.ExecutablePluginSupport類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。