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

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

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

Instances.renameAttribute介绍

[英]Renames an attribute. This change only affects this dataset.
[中]重命名属性。此更改仅影响此数据集。

代码示例

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

@Override
public void renameAttribute(Attribute att, String name) {
 super.renameAttribute(att, name);
}

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

@Override
public void renameAttribute(int arg0, String arg1) {
 super.renameAttribute(arg0, arg1);
}

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

/**
 * Renames an attribute. This change only affects this dataset.
 *
 * @param att the attribute
 * @param name the new name
 */
public void renameAttribute(Attribute att, String name) {
 renameAttribute(att.index(), name);
}

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

/**
 * Renames an attribute. This change only affects this dataset.
 *
 * @param att the attribute
 * @param name the new name
 */
public void renameAttribute(Attribute att, String name) {
 renameAttribute(att.index(), name);
}

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

/**
 * renames the attribute at the given col index
 *
 * @param columnIndex the index of the column
 * @param newName the new name of the attribute
 */
public void renameAttributeAt(int columnIndex, String newName) {
  if ((columnIndex > 0) && (columnIndex < getColumnCount())) {
    addUndoPoint();
    m_Data.renameAttribute(columnIndex - 1, newName);
    notifyListener(new TableModelEvent(this, TableModelEvent.HEADER_ROW));
  }
}

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

/**
 * renames the attribute at the given col index
 *
 * @param columnIndex the index of the column
 * @param newName the new name of the attribute
 */
public void renameAttributeAt(int columnIndex, String newName) {
  if ((columnIndex > 0) && (columnIndex < getColumnCount())) {
    addUndoPoint();
    m_Data.renameAttribute(columnIndex - 1, newName);
    notifyListener(new TableModelEvent(this, TableModelEvent.HEADER_ROW));
  }
}

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

/**
 * renames the attribute at the given col index
 * 
 * @param columnIndex the index of the column
 * @param newName the new name of the attribute
 */
public void renameAttributeAt(int columnIndex, String newName) {
 if (isAttribute(columnIndex)) {
  addUndoPoint();
  m_Data.renameAttribute(getAttributeIndex(columnIndex), newName);
  notifyListener(new TableModelEvent(this, TableModelEvent.HEADER_ROW));
 }
}

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

/**
 * renames the attribute at the given col index
 * 
 * @param columnIndex the index of the column
 * @param newName the new name of the attribute
 */
public void renameAttributeAt(int columnIndex, String newName) {
 if (isAttribute(columnIndex)) {
  addUndoPoint();
  m_Data.renameAttribute(getAttributeIndex(columnIndex), newName);
  notifyListener(new TableModelEvent(this, TableModelEvent.HEADER_ROW));
 }
}

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

instances.renameAttribute(i,"a_"+i);

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

instances.renameAttribute(i,"a_"+i);

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

@Override
public Instances process(Instances D) throws Exception {
  //System.out.println("PROCESS! = "+D.numInstances());
  int L = D.classIndex();
  D = new Instances(D); // D_
  // rename classes 
  for(int j = 0; j < L; j++) {
    D.renameAttribute(j,encodeClass(j));
  }
  // merge labels
  D = mergeLabels(D,indices,m_P,m_N);
  // templates
  x_template = D.firstInstance();
  setOutputFormat(D);
  //System.out.println("PROCESS! => "+D);
  return D;
}

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

@Override
public Instances process(Instances D) throws Exception {
  //System.out.println("PROCESS! = "+D.numInstances());
  int L = D.classIndex();
  D = new Instances(D); // D_
  // rename classes 
  for(int j = 0; j < L; j++) {
    D.renameAttribute(j,encodeClass(j));
  }
  // merge labels
  D = mergeLabels(D,indices,m_P,m_N);
  // templates
  x_template = D.firstInstance();
  setOutputFormat(D);
  //System.out.println("PROCESS! => "+D);
  return D;
}

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

/**
 * Initializes the format for the dataset produced. Must be called before the
 * generateExample or generateExamples methods are used. Re-initializes the
 * random number generator with the given seed.
 * 
 * @return the format for the dataset
 * @throws Exception if the generating of the format failed
 * @see #getSeed()
 */
@Override
public Instances defineDataFormat() throws Exception {
 BayesNetGenerator bng;
 bng = new BayesNetGenerator();
 bng.setOptions(getGenerator().getOptions());
 setGeneratorOption(bng, "M", "1");
 bng.generateRandomNetwork();
 bng.generateInstances();
 bng.m_Instances.renameAttribute(0, "class");
 bng.m_Instances.setRelationName(getRelationNameToUse());
 return bng.m_Instances;
}

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

/**
 * Initializes the format for the dataset produced. Must be called before the
 * generateExample or generateExamples methods are used. Re-initializes the
 * random number generator with the given seed.
 * 
 * @return the format for the dataset
 * @throws Exception if the generating of the format failed
 * @see #getSeed()
 */
@Override
public Instances defineDataFormat() throws Exception {
 BayesNetGenerator bng;
 bng = new BayesNetGenerator();
 bng.setOptions(getGenerator().getOptions());
 setGeneratorOption(bng, "M", "1");
 bng.generateRandomNetwork();
 bng.generateInstances();
 bng.m_Instances.renameAttribute(0, "class");
 bng.m_Instances.setRelationName(getRelationNameToUse());
 return bng.m_Instances;
}

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

if (m_SelectedCols.isInRange(i)) {
 if (outputFormat.attribute(i).isNumeric()) {
  outputFormat.renameAttribute(i, outputFormat.attribute(i).name()
                 + " d"
                 + (m_InstanceRange < 0 ? '-' : '+')

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

if (m_SelectedCols.isInRange(i)) {
 if (outputFormat.attribute(i).isNumeric()) {
  outputFormat.renameAttribute(i, outputFormat.attribute(i).name()
                 + " d"
                 + (m_InstanceRange < 0 ? '-' : '+')

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

if (outputFormat.attribute(i).isNominal()
  || outputFormat.attribute(i).isNumeric()) {
 outputFormat.renameAttribute(i, outputFormat.attribute(i).name()
                + (m_InstanceRange < 0 ? '-' : '+')
                + Math.abs(m_InstanceRange));

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

if (outputFormat.attribute(i).isNominal()
  || outputFormat.attribute(i).isNumeric()) {
 outputFormat.renameAttribute(i, outputFormat.attribute(i).name()
                + (m_InstanceRange < 0 ? '-' : '+')
                + Math.abs(m_InstanceRange));

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

/**
 * Generates all examples of the dataset. Re-initializes the random number
 * generator with the given seed, before generating instances.
 * 
 * @return the generated dataset
 * @throws Exception if the format of the dataset is not yet defined
 * @throws Exception if the generator only works with generateExample, which
 *           means in single mode
 * @see #getSeed()
 */
@Override
public Instances generateExamples() throws Exception {
 getGenerator().setOptions(getGenerator().getOptions());
 getGenerator().generateRandomNetwork();
 getGenerator().generateInstances();
 getGenerator().m_Instances.renameAttribute(0, "class");
 getGenerator().m_Instances.setRelationName(getRelationNameToUse());
 return getGenerator().m_Instances;
}

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

/**
 * Generates all examples of the dataset. Re-initializes the random number
 * generator with the given seed, before generating instances.
 * 
 * @return the generated dataset
 * @throws Exception if the format of the dataset is not yet defined
 * @throws Exception if the generator only works with generateExample, which
 *           means in single mode
 * @see #getSeed()
 */
@Override
public Instances generateExamples() throws Exception {
 getGenerator().setOptions(getGenerator().getOptions());
 getGenerator().generateRandomNetwork();
 getGenerator().generateInstances();
 getGenerator().m_Instances.renameAttribute(0, "class");
 getGenerator().m_Instances.setRelationName(getRelationNameToUse());
 return getGenerator().m_Instances;
}

相关文章

Instances类方法