weka.core.Instances.setClass()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(91)

本文整理了Java中weka.core.Instances.setClass()方法的一些代码示例,展示了Instances.setClass()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Instances.setClass()方法的具体详情如下:
包路径:weka.core.Instances
类名称:Instances
方法名:setClass

Instances.setClass介绍

[英]Sets the class attribute.
[中]设置类属性。

代码示例

代码示例来源:origin: com.googlecode.obvious/obviousx-weka

@Override
public void setClass(Attribute att) {
 super.setClass(att);
}

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

dataSet.setClass(classAtt);
} else {

代码示例来源:origin: Waikato/weka-trunk

dataSet.setClass(classAtt);
} else {

代码示例来源:origin: kodapan/osm-common

wekaTrainingData.setClass(wekaTrainingData.attribute("class"));
classifier.buildClassifier(wekaTrainingData);

代码示例来源:origin: Waikato/weka-trunk

boolean assigned = false;
if (classAtt != null) {
 dataSet.setClass(classAtt);
 assigned = true;
} else {

代码示例来源:origin: hltfbk/Excitement-Open-Platform

/**
 * Load data instances from Weka ARFF file to memory for classification
 * training or testing.
 * 
 * @param filename
 *            Weka ARFF data file path.
 * @param className
 *            name used in data to denote attribute which is the class
 * @return data instances
 * @throws IOException
 */
private Instances loadInstancesFromARFF(String filename, String className)
    throws IOException {
  DataSource source;
  try {
    source = new DataSource(filename);
    Instances data = source.getDataSet();
    Attribute classAttribute = data.attribute(className);
    data.setClass(classAttribute);
    return data;
  } catch (Exception e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  return null;
}

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

boolean assigned = false;
if (classAtt != null) {
 dataSet.setClass(classAtt);
 assigned = true;
} else {

代码示例来源:origin: net.sourceforge/javaml

public ToWekaUtils(Dataset data) {
  classes=new Vector<Object>();
  classes.addAll(data.classes());
  FastVector att = new FastVector();
  for (int i = 0; i < data.noAttributes(); i++) {
    att.addElement(new Attribute("att" + i));
  }
  classSet = data.classes().size() > 0;
  Attribute ca = null;
  if (classSet) {
    FastVector fvNominalVal = new FastVector(data.classes().size());
    for (Object o : data.classes()) {
      fvNominalVal.addElement(o.toString());
    }
    ca = new Attribute("classAtt", fvNominalVal);
    att.addElement(ca);
  }
  wData = new Instances("generated_from_java-ml_dataset", att, data.size());
  if (classSet) {
    assert (ca != null);
    wData.setClass(ca);
  }
  for (net.sf.javaml.core.Instance i : data) {
    wData.add(instanceToWeka(i));
  }
}

代码示例来源:origin: ClearTK/cleartk

instances.setClass(outcomeAttribute);

代码示例来源:origin: org.cleartk/cleartk-ml-weka

instances.setClass(outcomeAttribute);

代码示例来源:origin: com.github.fracpete/multisearch-weka-package

private static Instances getDummyXORData() {
 List<String> values = new ArrayList<String>();
 values.add("0");
 values.add("1");
 Attribute x1 = new Attribute("x1", values);
 Attribute x2 = new Attribute("x2", values);
 Attribute y = new Attribute("y", values);
 ArrayList<Attribute> attributes = new ArrayList<Attribute>();
 attributes.add(x1);
 attributes.add(x2);
 attributes.add(y);
 Instances data = new Instances("xor", attributes, 4);
 for (int x1val = 0; x1val <= 1; ++x1val) {
  for (int x2val = 0; x2val <= 1; ++x2val) {
 for (int yval = 0; yval <= 1; ++yval) {
  double[] attValues = { x1val, x2val, yval };
  DenseInstance instance = new DenseInstance(1.0, attValues);
  data.add(instance);
 }
  }
 }
 data.setClass(y);
 return data;
}

代码示例来源:origin: psal/jstylo

Attribute classAttribute = insts.attribute(insts.numAttributes() - 1);
InfoGainAttributeEval ig = new InfoGainAttributeEval();
insts.setClass(classAttribute);
ig.buildEvaluator(insts);

代码示例来源:origin: org.dkpro.tc/dkpro-tc-ml-weka

masterInstance.setClass(outcomeAttribute);
saver.setInstances(masterInstance);

代码示例来源:origin: dkpro/dkpro-tc

masterInstance.setClass(outcomeAttribute);
saver.setInstances(masterInstance);

代码示例来源:origin: hltfbk/Excitement-Open-Platform

attributeTable.setClass(ClassAttribute);

代码示例来源:origin: de.tudarmstadt.ukp.dkpro.tc/de.tudarmstadt.ukp.dkpro.tc.weka-gpl

wekaInstances.setClass(outcomeAttribute);

代码示例来源:origin: dkpro/dkpro-tc

compTestData.setClass(compTestData
    .attribute(Constants.CLASS_ATTRIBUTE_NAME + COMPATIBLE_OUTCOME_CLASS));
return compTestData;

代码示例来源:origin: org.dkpro.tc/dkpro-tc-ml-weka

compTestData.setClass(compTestData
    .attribute(Constants.CLASS_ATTRIBUTE_NAME + COMPATIBLE_OUTCOME_CLASS));
return compTestData;

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

.classAttribute().name();
Attribute classAtt = testData.attribute(className);
testData.setClass(classAtt);
predictions = evalUtils.getTestPredictions(classifier, testData);
success = true;

代码示例来源:origin: Waikato/weka-trunk

.classAttribute().name();
Attribute classAtt = testData.attribute(className);
testData.setClass(classAtt);
predictions = evalUtils.getTestPredictions(classifier, testData);
success = true;

相关文章

Instances类方法