当前位置: 首页>>代码示例>>Java>>正文


Java AssociationRule类代码示例

本文整理汇总了Java中com.rapidminer.operator.learner.associations.AssociationRule的典型用法代码示例。如果您正苦于以下问题:Java AssociationRule类的具体用法?Java AssociationRule怎么用?Java AssociationRule使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AssociationRule类属于com.rapidminer.operator.learner.associations包,在下文中一共展示了AssociationRule类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getConfidence

import com.rapidminer.operator.learner.associations.AssociationRule; //导入依赖的package包/类
private double getConfidence(AssociationRule currentRule, double currentSummedConfidence, int selectedAggregation) {
	switch (selectedAggregation) {
		case BINARY:
			return 1;
		case MAX_CONFIDENCE:
			return Math.max(currentSummedConfidence, currentRule.getConfidence());
		case MAX_CONVICTION:
			return Math.max(currentSummedConfidence, currentRule.getConviction());
		case MAX_GAIN:
			return Math.max(currentSummedConfidence, currentRule.getGain());
		case MAX_LA_PLACE:
			return Math.max(currentSummedConfidence, currentRule.getLaplace());
		case MAX_LIFT:
			return Math.max(currentSummedConfidence, currentRule.getLift());
	}
	return 0;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:18,代码来源:AssociationRulesApplier.java

示例2: getFilter

import com.rapidminer.operator.learner.associations.AssociationRule; //导入依赖的package包/类
private boolean[] getFilter(AssociationRules rules, Item[] filter, int conjunctionMode, double minRatio) {
	boolean[] mapping = new boolean[rules.getNumberOfRules()];
	int counter = 0;
	for (AssociationRule rule : rules) {
		if (getCriterionValue(rule) >= getCriterionMinValue(minRatio)) {
			if (checkForItem(filter, rule, conjunctionMode)) {
				mapping[counter] = true;
			} else {
				mapping[counter] = false;
			}
		} else {
			mapping[counter] = false;
		}
		counter++;
	}

	return mapping;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:19,代码来源:AssociationRuleFilter.java

示例3: getCriterionValue

import com.rapidminer.operator.learner.associations.AssociationRule; //导入依赖的package包/类
private double getCriterionValue(AssociationRule rule) {
	int criterionSelection = criterionSelectorBox.getSelectedIndex();
	switch (criterionSelection) {
		case AssociationRuleGenerator.LIFT:
			return rule.getLift();
		case AssociationRuleGenerator.CONVICTION:
			return rule.getConviction();
		case AssociationRuleGenerator.PS:
			return rule.getPs();
		case AssociationRuleGenerator.GAIN:
			return rule.getGain();
		case AssociationRuleGenerator.LAPLACE:
			return rule.getLaplace();
		case AssociationRuleGenerator.CONFIDENCE:
		default:
			return rule.getConfidence();
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:19,代码来源:AssociationRuleFilter.java

示例4: createTooltip

import com.rapidminer.operator.learner.associations.AssociationRule; //导入依赖的package包/类
/**
 * Create the tooltip for a rule.
 *
 * @param rule
 *            the rule for which to create the tooltip
 * @param ruleIndex
 *            the index of the rule
 * @return the HTML-formatted tooltip string
 */
private String createTooltip(AssociationRule rule, int ruleIndex) {
	StringBuilder sb = new StringBuilder();

	sb.append("<html><div style=\"font-size: 10px; font-family: 'Open Sans'\">");
	sb.append("<p style=\"font-size: 110%; text-align: center; font-family: 'Open Sans Semibold'\"><b>Rule " + ruleIndex
			+ "</b><hr NOSHADE style=\"color: '#000000'; width: 95%; \"/></p>");
	sb.append(SwingTools.transformToolTipText(
			formatDependencies(rule.getPremiseItems()) + " \u2794 " + formatDependencies(rule.getConclusionItems()),
			false, 200, false, false) + "<br/>");
	sb.append("Support:&nbsp;" + Tools.formatNumber(rule.getTotalSupport(), 2) + "<br/>");
	sb.append("Confidence:&nbsp;" + Tools.formatNumber(rule.getConfidence(), 2) + "<br/>");
	sb.append("Lift:&nbsp;" + Tools.formatNumber(rule.getLift(), 2) + "<br/>");
	sb.append("Gain:&nbsp;" + Tools.formatNumber(rule.getGain(), 2) + "<br/>");
	sb.append("Conviction:&nbsp;" + Tools.formatNumber(rule.getConviction(), 2) + "<br/>");
	sb.append("Laplace:&nbsp;" + Tools.formatNumber(rule.getLaplace(), 2) + "<br/>");
	sb.append("Ps:&nbsp;" + Tools.formatNumber(rule.getPs(), 2));
	sb.append("</div></html>");

	return sb.toString();
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:30,代码来源:AssociationRulesGraphCreator.java

示例5: getConfidence

import com.rapidminer.operator.learner.associations.AssociationRule; //导入依赖的package包/类
private double getConfidence(AssociationRule currentRule, double currentSummedConfidence, int selectedAggregation) {
	switch (selectedAggregation) {
	case BINARY:
		return 1;
	case MAX_CONFIDENCE:
		return Math.max(currentSummedConfidence, currentRule.getConfidence());
	case MAX_CONVICTION:
		return Math.max(currentSummedConfidence, currentRule.getConviction());
	case MAX_GAIN:
		return Math.max(currentSummedConfidence, currentRule.getGain());
	case MAX_LA_PLACE:
		return Math.max(currentSummedConfidence, currentRule.getLaplace());
	case MAX_LIFT:
		return Math.max(currentSummedConfidence, currentRule.getLift());
	}
	return 0;
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:18,代码来源:AssociationRulesApplier.java

示例6: getFilter

import com.rapidminer.operator.learner.associations.AssociationRule; //导入依赖的package包/类
private boolean[] getFilter(AssociationRules rules, Item[] filter, int conjunctionMode, double minRatio) {				
	boolean[] mapping = new boolean[rules.getNumberOfRules()];
	int counter = 0;
	for (AssociationRule rule : rules) {
		if (getCriterionValue(rule) >= getCriterionMinValue(minRatio)) {
			if (checkForItem(filter, rule, conjunctionMode)) {
				mapping[counter] = true;
			} else {
				mapping[counter] = false;
			}
		} else {
			mapping[counter] = false;
		}
		counter++;
	}

	return mapping;
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:19,代码来源:AssociationRuleFilter.java

示例7: getCriterionValue

import com.rapidminer.operator.learner.associations.AssociationRule; //导入依赖的package包/类
private double getCriterionValue(AssociationRule rule) {
	int criterionSelection = criterionSelectorBox.getSelectedIndex();
	switch (criterionSelection) {
	case AssociationRuleGenerator.LIFT:
		return rule.getLift();
	case AssociationRuleGenerator.CONVICTION:
		return rule.getConviction();
	case AssociationRuleGenerator.PS:
		return rule.getPs();
	case AssociationRuleGenerator.GAIN:
		return rule.getGain();
	case AssociationRuleGenerator.LAPLACE:
		return rule.getLaplace();
	case AssociationRuleGenerator.CONFIDENCE:
	default:
		return rule.getConfidence();
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:19,代码来源:AssociationRuleFilter.java

示例8: getGraphCreator

import com.rapidminer.operator.learner.associations.AssociationRule; //导入依赖的package包/类
@Override
public GraphCreator<String, String> getGraphCreator(Object renderable, IOContainer ioContainer) {
	AssociationRules rules = (AssociationRules) renderable;
	int numberOfRules = rules.getNumberOfRules();
	if (numberOfRules > 0) {
		if (numberOfRules > MAX_RULE_NUMBER) {
			List<AssociationRule> ruleList = new ArrayList<AssociationRule>(numberOfRules);
			for (int i = 0; i < numberOfRules; ++i) {
				ruleList.add(rules.getRule(i));
			}
			Collections.sort(ruleList, new Comparator<AssociationRule>() {

				@Override
				public int compare(AssociationRule rule1, AssociationRule rule2) {
					if (rule1.getConfidence() == rule2.getConfidence()) {
						return 0;
					} else if (rule1.getConfidence() < rule2.getConfidence()) {
						return -1;
					} else {
						return 1;
					}
				}
			});
			AssociationRules filteredRules = new AssociationRules();
			for (int i = 0; i < MAX_RULE_NUMBER; ++i) {
				filteredRules.addItemRule(ruleList.get(i));
			}
			rules = filteredRules;
		}
		return new AssociationRulesGraphCreator(rules);

	} else {
		return null;
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:36,代码来源:AssociationRulesGraphRenderer.java

示例9: checkForItem

import com.rapidminer.operator.learner.associations.AssociationRule; //导入依赖的package包/类
private boolean checkForItem(Item[] filter, AssociationRule rule, int conjunctionMode) {
	if (filter == null) {
		return true;
	}
	switch (conjunctionMode) {
		case AssociationRuleFilterListener.CONJUNCTION_ANY:
			List<Item> filterList = Arrays.asList(filter);
			Iterator<Item> c = rule.getConclusionItems();
			while (c.hasNext()) {
				if (filterList.contains(c.next())) {
					return true;
				}
			}
			return false;
		case AssociationRuleFilterListener.CONJUNCTION_ALL:
			for (Item item : filter) {
				c = rule.getConclusionItems();
				boolean found = false;
				while (c.hasNext()) {
					if (c.next().equals(item)) {
						found = true;
						break;
					}
				}
				if (!found) {
					return false;
				}
			}
			return true;
		default:
			throw new RuntimeException("Illegal filter type index: " + conjunctionMode);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:34,代码来源:AssociationRuleFilter.java

示例10: getValueAt

import com.rapidminer.operator.learner.associations.AssociationRule; //导入依赖的package包/类
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
	AssociationRule rule = rules.getRule(this.mapping[rowIndex]);
	switch (columnIndex) {
		case COLUMN_RULE_ID:
			return Integer.valueOf(this.mapping[rowIndex] + 1);
		case COLUMN_PREMISES:
			return getItemString(rule.getPremiseItems());
		case COLUMN_CONCLUSION:
			return getItemString(rule.getConclusionItems());
		case COLUMN_SUPPORT:
			return Double.valueOf(rule.getTotalSupport());
		case COLUMN_CONFIDENCE:
			return Double.valueOf(rule.getConfidence());
		case COLUMN_CONVICTION:
			return Double.valueOf(rule.getConviction());
		case COLUMN_GAIN:
			return Double.valueOf(rule.getGain());
		case COLUMN_PS:
			return Double.valueOf(rule.getPs());
		case COLUMN_LIFT:
			return Double.valueOf(rule.getLift());
		case COLUMN_LA_PLACE:
			return Double.valueOf(rule.getLaplace());
		default:
			// cannot happen
			return "?";
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:30,代码来源:AssociationRuleTableModel.java

示例11: getGraphCreator

import com.rapidminer.operator.learner.associations.AssociationRule; //导入依赖的package包/类
@Override
public GraphCreator<String, String> getGraphCreator(Object renderable, IOContainer ioContainer) {
	AssociationRules rules = (AssociationRules) renderable;
	int numberOfRules = rules.getNumberOfRules();
	if (numberOfRules > 0) {
		if (numberOfRules > MAX_RULE_NUMBER) {
			List<AssociationRule> ruleList = new ArrayList<AssociationRule>(numberOfRules);
			for (int i = 0; i < numberOfRules; ++i) {
				ruleList.add(rules.getRule(i));
			}
			Collections.sort(ruleList, new Comparator<AssociationRule>() {

				@Override
				public int compare(AssociationRule rule1, AssociationRule rule2) {
					if (rule1.getConfidence() == rule2.getConfidence()) {
						return 0;
					} else if (rule1.getConfidence() < rule2.getConfidence()) {
						return -1;
					} else {
						return 1;
					}
				}
			});
			AssociationRules filteredRules = new AssociationRules();
			for (int i = 0; i < MAX_RULE_NUMBER; ++i) {
				filteredRules.addItemRule(ruleList.get(i));
			}
			rules = filteredRules;
		}
		rules.sort();
		return new AssociationRulesGraphCreator(rules);

	} else {
		return null;
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:37,代码来源:AssociationRulesGraphRenderer.java

示例12: getGraphCreator

import com.rapidminer.operator.learner.associations.AssociationRule; //导入依赖的package包/类
@Override
public GraphCreator<String, String> getGraphCreator(Object renderable, IOContainer ioContainer) {
	AssociationRules rules = (AssociationRules) renderable;
	int numberOfRules = rules.getNumberOfRules();
	if (numberOfRules > 0) {
		if (numberOfRules > MAX_RULE_NUMBER ) {
			List<AssociationRule> ruleList = new ArrayList<AssociationRule>(numberOfRules);
			for(int i = 0; i < numberOfRules; ++i) {
				ruleList.add(rules.getRule(i));
			}
			Collections.sort(ruleList, new Comparator<AssociationRule>() {

				@Override
				public int compare(AssociationRule rule1, AssociationRule rule2) {
					if(rule1.getConfidence() == rule2.getConfidence()) {
						return 0;
					} else if(rule1.getConfidence() < rule2.getConfidence()) {
						return -1;
					} else {
						return 1;
					}
				}
			});
			AssociationRules filteredRules = new AssociationRules();
			for(int i = 0; i < MAX_RULE_NUMBER; ++i) {
				filteredRules.addItemRule(ruleList.get(i));
			}
			rules = filteredRules;
		}
		return new AssociationRulesGraphCreator(rules);

	} else {
		return null;
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:36,代码来源:AssociationRulesGraphRenderer.java

示例13: checkForItem

import com.rapidminer.operator.learner.associations.AssociationRule; //导入依赖的package包/类
private boolean checkForItem(Item[] filter, AssociationRule rule, int conjunctionMode) {
	if (filter == null)
		return true;
	switch (conjunctionMode) {
	case AssociationRuleFilterListener.CONJUNCTION_ANY:
		List<Item> filterList = Arrays.asList(filter);
		Iterator<Item> c = rule.getConclusionItems();
		while (c.hasNext()) {
			if (filterList.contains(c.next())) {
				return true;
			}	
		}
		return false;
	case AssociationRuleFilterListener.CONJUNCTION_ALL:
		for (Item item : filter) {
			c = rule.getConclusionItems();
			boolean found = false;
			while (c.hasNext()) {
				if (c.next().equals(item)) {
					found = true;
					break;
				}
			}
			if (!found) return false;
		}
		return true;
	default:
		throw new RuntimeException("Illegal filter type index: "+conjunctionMode);
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:31,代码来源:AssociationRuleFilter.java

示例14: getValueAt

import com.rapidminer.operator.learner.associations.AssociationRule; //导入依赖的package包/类
public Object getValueAt(int rowIndex, int columnIndex) {
	AssociationRule rule = rules.getRule(this.mapping[rowIndex]);
	switch (columnIndex) {
	case COLUMN_RULE_ID:
		return Integer.valueOf(this.mapping[rowIndex] + 1);
	case COLUMN_PREMISES:
		return getItemString(rule.getPremiseItems());
	case COLUMN_CONCLUSION:
		return getItemString(rule.getConclusionItems());
	case COLUMN_SUPPORT:
		return Double.valueOf(rule.getTotalSupport());
	case COLUMN_CONFIDENCE:
		return Double.valueOf(rule.getConfidence());
	case COLUMN_CONVICTION:
		return Double.valueOf(rule.getConviction());
	case COLUMN_GAIN:
		return Double.valueOf(rule.getGain());
	case COLUMN_PS:
		return Double.valueOf(rule.getPs());
	case COLUMN_LIFT:
		return Double.valueOf(rule.getLift());
	case COLUMN_LA_PLACE:
		return Double.valueOf(rule.getLaplace());
	default:
		// cannot happen
		return "?";
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:29,代码来源:AssociationRuleTableModel.java


注:本文中的com.rapidminer.operator.learner.associations.AssociationRule类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。