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

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

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

Instances.allAttributeWeightsIdentical介绍

[英]Returns true if all attribute weights are the same and false otherwise. Returns true if there are no attributes. The class attribute (if set) is skipped when this test is performed.
[中]如果所有属性权重相同,则返回true;否则返回false。如果没有属性,则返回true。执行此测试时,将跳过类属性(如果已设置)。

代码示例

代码示例来源:origin: net.sf.meka/meka

/**
 * Build the classifier on the filtered data.
 *
 * @param data the training data
 * @throws Exception if the classifier could not be built successfully
 */
public void buildClassifier(Instances data) throws Exception {
 if (m_Classifier == null) {
  throw new Exception("No base classifier has been set!");
 }
 getCapabilities().testWithFail(data);
 Random r = (data.numInstances() > 0) ? data.getRandomNumberGenerator(getSeed()) : new Random(getSeed());
 data = setUp(data, r);
 if (!data.allInstanceWeightsIdentical() && !(m_Classifier instanceof WeightedInstancesHandler)) {
  data = data.resampleWithWeights(r); // The filter may have assigned weights.
 }
 if (!data.allAttributeWeightsIdentical() && !(m_Classifier instanceof WeightedAttributesHandler)) {
  data = resampleAttributes(data, false, r);
 }
 if (m_Classifier instanceof Randomizable) {
  ((Randomizable)m_Classifier).setSeed(r.nextInt());
 }
 m_Classifier.buildClassifier(data);
}

代码示例来源:origin: Waikato/meka

/**
 * Build the classifier on the filtered data.
 *
 * @param data the training data
 * @throws Exception if the classifier could not be built successfully
 */
public void buildClassifier(Instances data) throws Exception {
 if (m_Classifier == null) {
  throw new Exception("No base classifier has been set!");
 }
 getCapabilities().testWithFail(data);
 Random r = (data.numInstances() > 0) ? data.getRandomNumberGenerator(getSeed()) : new Random(getSeed());
 data = setUp(data, r);
 if (!data.allInstanceWeightsIdentical() && !(m_Classifier instanceof WeightedInstancesHandler)) {
  data = data.resampleWithWeights(r); // The filter may have assigned weights.
 }
 if (!data.allAttributeWeightsIdentical() && !(m_Classifier instanceof WeightedAttributesHandler)) {
  data = resampleAttributes(data, false, r);
 }
 if (m_Classifier instanceof Randomizable) {
  ((Randomizable)m_Classifier).setSeed(r.nextInt());
 }
 m_Classifier.buildClassifier(data);
}

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

/**
 * Build the classifier on the filtered data.
 *
 * @param data the training data
 * @throws Exception if the classifier could not be built successfully
 */
public void buildClassifier(Instances data) throws Exception {
 if (m_Classifier == null) {
  throw new Exception("No base classifier has been set!");
 }
 getCapabilities().testWithFail(data);
 Random r = (data.numInstances() > 0) ? data.getRandomNumberGenerator(getSeed()) : new Random(getSeed());
 data = setUp(data, r);
 if (!data.allInstanceWeightsIdentical() && !(m_Classifier instanceof WeightedInstancesHandler)) {
  data = data.resampleWithWeights(r); // The filter may have assigned weights.
 }
 if (!data.allAttributeWeightsIdentical() && !(m_Classifier instanceof WeightedAttributesHandler)) {
  data = resampleAttributes(data, false, r);
 }
 // can classifier handle the data?
 getClassifier().getCapabilities().testWithFail(data);
 if (m_Classifier instanceof Randomizable) {
  ((Randomizable)m_Classifier).setSeed(r.nextInt());
 }
 m_Classifier.buildClassifier(data);
}

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

if (!data.allAttributeWeightsIdentical() && !(m_Classifier instanceof WeightedAttributesHandler)) {
 data = resampleAttributes(data, false, r);

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

/**
 * Build the classifier on the filtered data.
 *
 * @param data the training data
 * @throws Exception if the classifier could not be built successfully
 */
public void buildClassifier(Instances data) throws Exception {
 if (m_Classifier == null) {
  throw new Exception("No base classifier has been set!");
 }
 getCapabilities().testWithFail(data);
 Random r = (data.numInstances() > 0) ? data.getRandomNumberGenerator(getSeed()) : new Random(getSeed());
 data = setUp(data, r);
 if (!data.allInstanceWeightsIdentical() && !(m_Classifier instanceof WeightedInstancesHandler)) {
  data = data.resampleWithWeights(r); // The filter may have assigned weights.
 }
 if (!data.allAttributeWeightsIdentical() && !(m_Classifier instanceof WeightedAttributesHandler)) {
  data = resampleAttributes(data, false, r);
 }
 // can classifier handle the data?
 getClassifier().getCapabilities().testWithFail(data);
 if (m_Classifier instanceof Randomizable) {
  ((Randomizable)m_Classifier).setSeed(r.nextInt());
 }
 m_Classifier.buildClassifier(data);
}

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

if (!data.allAttributeWeightsIdentical() && !(m_Classifier instanceof WeightedAttributesHandler)) {
 data = resampleAttributes(data, false, r);

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

data = data.resampleWithWeights(random);
if (!data.allAttributeWeightsIdentical() && !(m_Filter instanceof WeightedAttributesHandler)) {
 data = resampleAttributes(data, true, random);

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

data = data.resampleWithWeights(random);
if (!data.allAttributeWeightsIdentical() && !(m_Filter instanceof WeightedAttributesHandler)) {
 data = resampleAttributes(data, true, random);

相关文章

Instances类方法