本文整理汇总了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));
}
示例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));
}
示例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);
}
示例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);
示例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);
示例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);
示例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);
示例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);