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

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

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

Instances.sort介绍

[英]Sorts the instances based on an attribute. For numeric attributes, instances are sorted in ascending order. For nominal attributes, instances are sorted based on the attribute label ordering specified in the header. Instances with missing values for the attribute are placed at the end of the dataset.
[中]根据属性对实例进行排序。对于数值属性,实例按升序排序。对于标称属性,实例将根据标题中指定的属性标签顺序进行排序。属性缺少值的实例放置在数据集的末尾。

代码示例

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

@Override
public void sort(int attIndex) {
 super.sort(attIndex);
}

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

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

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

/**
 * Sorts the instances based on an attribute. For numeric attributes,
 * instances are sorted into ascending order. For nominal attributes,
 * instances are sorted based on the attribute label ordering specified in the
 * header. Instances with missing values for the attribute are placed at the
 * end of the dataset.
 * 
 * @param att the attribute
 */
public void sort(Attribute att) {
 sort(att.index());
}

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

/**
 * Sorts the instances based on an attribute. For numeric attributes,
 * instances are sorted into ascending order. For nominal attributes,
 * instances are sorted based on the attribute label ordering specified in the
 * header. Instances with missing values for the attribute are placed at the
 * end of the dataset.
 * 
 * @param att the attribute
 */
public void sort(Attribute att) {
 sort(att.index());
}

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

/**
 * Creates a C4.5-type split on the given data.
 * 
 * @exception Exception if something goes wrong
 */
@Override
public void buildClassifier(Instances trainInstances) throws Exception {
 // Initialize the remaining instance variables.
 m_numSubsets = 0;
 m_splitPoint = Double.MAX_VALUE;
 m_infoGain = 0;
 m_gainRatio = 0;
 // Different treatment for enumerated and numeric
 // attributes.
 if (trainInstances.attribute(m_attIndex).isNominal()) {
  handleEnumeratedAttribute(trainInstances);
 } else {
  trainInstances.sort(trainInstances.attribute(m_attIndex));
  handleNumericAttribute(trainInstances);
 }
}

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

/**
 * Creates a C4.5-type split on the given data.
 * 
 * @exception Exception if something goes wrong
 */
@Override
public void buildClassifier(Instances trainInstances) throws Exception {
 // Initialize the remaining instance variables.
 m_numSubsets = 0;
 m_splitPoint = Double.MAX_VALUE;
 m_infoGain = 0;
 m_gainRatio = 0;
 // Different treatment for enumerated and numeric
 // attributes.
 if (trainInstances.attribute(m_attIndex).isNominal()) {
  handleEnumeratedAttribute(trainInstances);
 } else {
  trainInstances.sort(trainInstances.attribute(m_attIndex));
  handleNumericAttribute(trainInstances);
 }
}

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

+ ps.getQuantile());
inst.sort(attIndex);
double actualQuant = 0;
AttributeStats as = inst.attributeStats(attIndex);

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

/**
 * Set cutpoints for a single attribute using MDL.
 * 
 * @param index the index of the attribute to set cutpoints for
 * @param data the data to work with
 */
protected void calculateCutPointsByMDL(int index, Instances data) {
 // Sort instances
 data.sort(data.attribute(index));
 // Find first instances that's missing
 int firstMissing = data.numInstances();
 for (int i = 0; i < data.numInstances(); i++) {
  if (data.instance(i).isMissing(index)) {
   firstMissing = i;
   break;
  }
 }
 m_CutPoints[index] = cutPointsForSubset(data, index, 0, firstMissing);
}

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

/**
 * Set cutpoints for a single attribute using MDL.
 * 
 * @param index the index of the attribute to set cutpoints for
 * @param data the data to work with
 */
protected void calculateCutPointsByMDL(int index, Instances data) {
 // Sort instances
 data.sort(data.attribute(index));
 // Find first instances that's missing
 int firstMissing = data.numInstances();
 for (int i = 0; i < data.numInstances(); i++) {
  if (data.instance(i).isMissing(index)) {
   firstMissing = i;
   break;
  }
 }
 m_CutPoints[index] = cutPointsForSubset(data, index, 0, firstMissing);
}

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

/**
 * Creates a C4.5-type split on the given data. Assumes that none of the class
 * values is missing.
 * 
 * @exception Exception if something goes wrong
 */
@Override
public void buildClassifier(Instances trainInstances) throws Exception {
 // Initialize the remaining instance variables.
 m_numSubsets = 0;
 m_splitPoint = Double.MAX_VALUE;
 m_infoGain = 0;
 m_gainRatio = 0;
 // Different treatment for enumerated and numeric
 // attributes.
 if (trainInstances.attribute(m_attIndex).isNominal()) {
  m_complexityIndex = trainInstances.attribute(m_attIndex).numValues();
  m_index = m_complexityIndex;
  handleEnumeratedAttribute(trainInstances);
 } else {
  m_complexityIndex = 2;
  m_index = 0;
  trainInstances.sort(trainInstances.attribute(m_attIndex));
  handleNumericAttribute(trainInstances);
 }
}

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

/**
 * Creates a C4.5-type split on the given data. Assumes that none of the class
 * values is missing.
 * 
 * @exception Exception if something goes wrong
 */
@Override
public void buildClassifier(Instances trainInstances) throws Exception {
 // Initialize the remaining instance variables.
 m_numSubsets = 0;
 m_splitPoint = Double.MAX_VALUE;
 m_infoGain = 0;
 m_gainRatio = 0;
 // Different treatment for enumerated and numeric
 // attributes.
 if (trainInstances.attribute(m_attIndex).isNominal()) {
  m_complexityIndex = trainInstances.attribute(m_attIndex).numValues();
  m_index = m_complexityIndex;
  handleEnumeratedAttribute(trainInstances);
 } else {
  m_complexityIndex = 2;
  m_index = 0;
  trainInstances.sort(trainInstances.attribute(m_attIndex));
  handleNumericAttribute(trainInstances);
 }
}

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

/**
 * Creates a NBTree-type split on the given data. Assumes that none of the
 * class values is missing.
 * 
 * @exception Exception if something goes wrong
 */
@Override
public void buildClassifier(Instances trainInstances) throws Exception {
 // Initialize the remaining instance variables.
 m_numSubsets = 0;
 m_errors = 0;
 if (m_globalNB != null) {
  m_errors = m_globalNB.getErrors();
 }
 // Different treatment for enumerated and numeric
 // attributes.
 if (trainInstances.attribute(m_attIndex).isNominal()) {
  m_complexityIndex = trainInstances.attribute(m_attIndex).numValues();
  handleEnumeratedAttribute(trainInstances);
 } else {
  m_complexityIndex = 2;
  trainInstances.sort(trainInstances.attribute(m_attIndex));
  handleNumericAttribute(trainInstances);
 }
}

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

/**
 * Creates a NBTree-type split on the given data. Assumes that none of the
 * class values is missing.
 * 
 * @exception Exception if something goes wrong
 */
@Override
public void buildClassifier(Instances trainInstances) throws Exception {
 // Initialize the remaining instance variables.
 m_numSubsets = 0;
 m_errors = 0;
 if (m_globalNB != null) {
  m_errors = m_globalNB.getErrors();
 }
 // Different treatment for enumerated and numeric
 // attributes.
 if (trainInstances.attribute(m_attIndex).isNominal()) {
  m_complexityIndex = trainInstances.attribute(m_attIndex).numValues();
  handleEnumeratedAttribute(trainInstances);
 } else {
  m_complexityIndex = 2;
  trainInstances.sort(trainInstances.attribute(m_attIndex));
  handleNumericAttribute(trainInstances);
 }
}

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

sortedData.sort(sortedData.attribute(m_attIndex));

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

sortedData.sort(sortedData.attribute(m_attIndex));

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

m_Instances.sort(index);

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

m_Instances.sort(index);

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

m_instances.sort(i);
currentSplit.attrSplit(i, m_instances);

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

m_Instances.sort(index);

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

m_Instances.sort(index);

相关文章

Instances类方法