當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。