本文整理匯總了Java中weka.core.FastVector.elements方法的典型用法代碼示例。如果您正苦於以下問題:Java FastVector.elements方法的具體用法?Java FastVector.elements怎麽用?Java FastVector.elements使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類weka.core.FastVector
的用法示例。
在下文中一共展示了FastVector.elements方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: findRulesQuickly
import weka.core.FastVector; //導入方法依賴的package包/類
/**
* Method that finds all association rules.
*
* @throws Exception if an attribute is numeric
*/
private void findRulesQuickly() throws Exception {
FastVector[] rules;
// Build rules
for (int j = 1; j < m_Ls.size(); j++) {
FastVector currentItemSets = (FastVector)m_Ls.elementAt(j);
Enumeration enumItemSets = currentItemSets.elements();
while (enumItemSets.hasMoreElements()) {
AprioriItemSet currentItemSet = (AprioriItemSet)enumItemSets.nextElement();
//AprioriItemSet currentItemSet = new AprioriItemSet((ItemSet)enumItemSets.nextElement());
rules = currentItemSet.generateRules(m_minMetric, m_hashtables, j + 1);
for (int k = 0; k < rules[0].size(); k++) {
m_allTheRules[0].addElement(rules[0].elementAt(k));
m_allTheRules[1].addElement(rules[1].elementAt(k));
m_allTheRules[2].addElement(rules[2].elementAt(k));
if (rules.length > 3) {
m_allTheRules[3].addElement(rules[3].elementAt(k));
m_allTheRules[4].addElement(rules[4].elementAt(k));
m_allTheRules[5].addElement(rules[5].elementAt(k));
}
}
}
}
}
示例2: findCarRulesQuickly
import weka.core.FastVector; //導入方法依賴的package包/類
/**
* Method that finds all class association rules.
*
* @throws Exception if an attribute is numeric
*/
private void findCarRulesQuickly() throws Exception {
FastVector[] rules;
// Build rules
for (int j = 0; j < m_Ls.size(); j++) {
FastVector currentLabeledItemSets = (FastVector)m_Ls.elementAt(j);
Enumeration enumLabeledItemSets = currentLabeledItemSets.elements();
while (enumLabeledItemSets.hasMoreElements()) {
LabeledItemSet currentLabeledItemSet = (LabeledItemSet)enumLabeledItemSets.nextElement();
rules = currentLabeledItemSet.generateRules(m_minMetric,false);
for (int k = 0; k < rules[0].size(); k++) {
m_allTheRules[0].addElement(rules[0].elementAt(k));
m_allTheRules[1].addElement(rules[1].elementAt(k));
m_allTheRules[2].addElement(rules[2].elementAt(k));
}
}
}
}
示例3: upDateCounters
import weka.core.FastVector; //導入方法依賴的package包/類
/**
* Updates counter of a specific item set
* @param itemSets an item sets
* @param instancesNoClass instances without the class attribute
* @param instancesClass the values of the class attribute sorted according to instances
*/
public static void upDateCounters(FastVector itemSets, Instances instancesNoClass, Instances instancesClass){
for (int i = 0; i < instancesNoClass.numInstances(); i++) {
Enumeration enu = itemSets.elements();
while (enu.hasMoreElements())
((LabeledItemSet)enu.nextElement()).upDateCounter(instancesNoClass.instance(i),instancesClass.instance(i));
}
}
示例4: findRulesBruteForce
import weka.core.FastVector; //導入方法依賴的package包/類
/**
* Method that finds all association rules and performs significance test.
*
* @throws Exception if an attribute is numeric
*/
private void findRulesBruteForce() throws Exception {
FastVector[] rules;
// Build rules
for (int j = 1; j < m_Ls.size(); j++) {
FastVector currentItemSets = (FastVector)m_Ls.elementAt(j);
Enumeration enumItemSets = currentItemSets.elements();
while (enumItemSets.hasMoreElements()) {
AprioriItemSet currentItemSet = (AprioriItemSet)enumItemSets.nextElement();
//AprioriItemSet currentItemSet = new AprioriItemSet((ItemSet)enumItemSets.nextElement());
rules=currentItemSet.generateRulesBruteForce(m_minMetric,m_metricType,
m_hashtables,j+1,
m_instances.numInstances(),
m_significanceLevel);
for (int k = 0; k < rules[0].size(); k++) {
m_allTheRules[0].addElement(rules[0].elementAt(k));
m_allTheRules[1].addElement(rules[1].elementAt(k));
m_allTheRules[2].addElement(rules[2].elementAt(k));
m_allTheRules[3].addElement(rules[3].elementAt(k));
m_allTheRules[4].addElement(rules[4].elementAt(k));
m_allTheRules[5].addElement(rules[5].elementAt(k));
}
}
}
}
示例5: upDateCounters
import weka.core.FastVector; //導入方法依賴的package包/類
/**
* Updates counters for a set of item sets and a set of instances.
*
* @param itemSets the set of item sets which are to be updated
* @param instances the instances to be used for updating the counters
*/
public static void upDateCounters(FastVector itemSets, Instances instances) {
for (int i = 0; i < instances.numInstances(); i++) {
Enumeration enu = itemSets.elements();
while (enu.hasMoreElements())
((ItemSet)enu.nextElement()).upDateCounter(instances.instance(i));
}
}
示例6: listOptions
import weka.core.FastVector; //導入方法依賴的package包/類
/**
* Returns an enumeration describing the available options.
*
* @return an enumeration of all the available options.
*/
public Enumeration listOptions() {
String string1 = "\tThe required number of rules. (default = " + m_numRules + ")",
string2 =
"\tThe minimum confidence of a rule. (default = " + m_minMetric + ")",
string3 = "\tThe delta by which the minimum support is decreased in\n",
string4 = "\teach iteration. (default = " + m_delta + ")",
string5 =
"\tThe lower bound for the minimum support. (default = " +
m_lowerBoundMinSupport + ")",
string6 = "\tIf used, rules are tested for significance at\n",
string7 = "\tthe given level. Slower. (default = no significance testing)",
string8 = "\tIf set the itemsets found are also output. (default = no)",
string9 = "\tIf set class association rules are mined. (default = no)",
string10 = "\tThe class index. (default = last)",
stringType = "\tThe metric type by which to rank rules. (default = "
+"confidence)",
stringZeroAsMissing = "\tTreat zero (i.e. first value of nominal attributes) as " +
"missing";
FastVector newVector = new FastVector(11);
newVector.addElement(new Option(string1, "N", 1,
"-N <required number of rules output>"));
newVector.addElement(new Option(stringType, "T", 1,
"-T <0=confidence | 1=lift | "
+"2=leverage | 3=Conviction>"));
newVector.addElement(new Option(string2, "C", 1,
"-C <minimum metric score of a rule>"));
newVector.addElement(new Option(string3 + string4, "D", 1,
"-D <delta for minimum support>"));
newVector.addElement(new Option("\tUpper bound for minimum support. "
+"(default = 1.0)", "U", 1,
"-U <upper bound for minimum support>"));
newVector.addElement(new Option(string5, "M", 1,
"-M <lower bound for minimum support>"));
newVector.addElement(new Option(string6 + string7, "S", 1,
"-S <significance level>"));
newVector.addElement(new Option(string8, "I", 0,
"-I"));
newVector.addElement(new Option("\tRemove columns that contain "
+"all missing values (default = no)"
, "R", 0,
"-R"));
newVector.addElement(new Option("\tReport progress iteratively. (default "
+"= no)", "V", 0,
"-V"));
newVector.addElement(new Option(string9, "A", 0,
"-A"));
newVector.addElement(new Option(stringZeroAsMissing, "Z", 0,
"-Z"));
newVector.addElement(new Option(string10, "c", 1,
"-c <the class index>"));
return newVector.elements();
}