本文整理汇总了Java中weka.associations.Apriori类的典型用法代码示例。如果您正苦于以下问题:Java Apriori类的具体用法?Java Apriori怎么用?Java Apriori使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Apriori类属于weka.associations包,在下文中一共展示了Apriori类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildAssociate
import weka.associations.Apriori; //导入依赖的package包/类
public static String buildAssociate() throws Exception {
InstanceQuery query = new InstanceQuery();
query.setUsername("root");
query.setPassword("cs6310");
query.setDatabaseURL("jdbc:mysql://localhost/system?#characterEncoding=UTF-8");
query.setQuery("select * from courses_sessions;");
// You can declare that your data set is sparse
// query.setSparseData(true);
Instances data = query.retrieveInstances();
data.setClassIndex(data.numAttributes() - 1);
final NumericToNominal filter = new NumericToNominal();
filter.setInputFormat(data);
data = Filter.useFilter(data, filter);
if (data.size() > 0) {
// build associator
Apriori apriori = new Apriori();
apriori.setClassIndex(data.classIndex());
apriori.buildAssociations(data);
return String.valueOf(apriori);
} else {
return "Not enough data provided";
}
}
示例2: getClassifierClassName
import weka.associations.Apriori; //导入依赖的package包/类
/**
* Get classifier's class name by a short name
* */
public static String getClassifierClassName(String classifierName) {
String className = "";
switch (classifierName) {
case "SGD":
className = SGD.class.toString();
break;
case "SGDText":
className = SGDText.class.toString();
break;
case "J48":
className = J48.class.toString();
break;
case "PART":
className = PART.class.toString();
break;
case "NaiveBayes":
className = NaiveBayes.class.toString();
break;
case "NBUpdateable":
className = NaiveBayesUpdateable.class.toString();
break;
case "AdaBoostM1":
className = AdaBoostM1.class.toString();
break;
case "LogitBoost":
className = LogitBoost.class.toString();
break;
case "Bagging":
className = Bagging.class.toString();
break;
case "Stacking":
className = Stacking.class.toString();
break;
case "AdditiveRegression":
className = AdditiveRegression.class.toString();
break;
case "Apriori":
className = Apriori.class.toString();
break;
default:
className = SGD.class.toString();
}
className = className.substring(6);
return className;
}
示例3: main
import weka.associations.Apriori; //导入依赖的package包/类
public static void main(String args[]) throws Exception {
// load data
Instances data = new Instances(new BufferedReader(new FileReader("data/supermarket.arff")));
// build model
Apriori model = new Apriori();
model.buildAssociations(data);
System.out.println(model);
FPGrowth fpgModel = new FPGrowth();
fpgModel.buildAssociations(data);
System.out.println(fpgModel);
}
开发者ID:PacktPublishing,项目名称:Machine-Learning-End-to-Endguide-for-Java-developers,代码行数:15,代码来源:Supermarket.java
示例4: generateRule
import weka.associations.Apriori; //导入依赖的package包/类
public void generateRule(){
apriori = new Apriori();
try {
// apriori.setNumRules(20);
apriori.buildAssociations(superMarket);
System.out.println(apriori);
} catch (Exception e) {
}
}
示例5: DataMiningControl
import weka.associations.Apriori; //导入依赖的package包/类
public DataMiningControl() {
this.selectedTag = new SelectedTag(0, Apriori.TAGS_SELECTION); //confiddence ref weka.Apriori.
this.minMetric = Constantes.CONFIANCA_MIN_PADRAO;
this.minSup = Constantes.SUPORTE_MIN_PADRAO;
this.verboseMode = Constantes.VERBOSE_MODE;
this.maxRules = Constantes.MAX_RULES;
}
示例6: getPossibleMetricTypes
import weka.associations.Apriori; //导入依赖的package包/类
public static String[] getPossibleMetricTypes() {
String[] metricTypes = new String[Apriori.TAGS_SELECTION.length];
for (int i = 0; i < metricTypes.length; i++) {
metricTypes[i] = Apriori.TAGS_SELECTION[i].getReadable();
}
return metricTypes;
}
示例7: setMetricType
import weka.associations.Apriori; //导入依赖的package包/类
public void setMetricType(int tagID) {
try {
TAGS_SELECTION[tagID].getID();
} catch (ArrayIndexOutOfBoundsException ex) {
throw new RuntimeException("TagId not known. Metric's TagId type must be one of: 0, 1, 2, 3");
}
this.setSelectedTag(new SelectedTag(tagID, Apriori.TAGS_SELECTION));
}