weka.filters.Filter.getOutputFormat()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(126)

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

Filter.getOutputFormat介绍

[英]Gets the format of the output instances. This should only be called after input() or batchFinished() has returned true. The relation name of the output instances should be changed to reflect the action of the filter (eg: add the filter name and options).
[中]获取输出实例的格式。只有在input()或batchFinished()返回true后才应调用此函数。应该更改输出实例的关系名称以反映筛选器的操作(例如:添加筛选器名称和选项)。

代码示例

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

@Override
public Instances getOutputFormat() {
 Instances outFormat = m_delegate.getOutputFormat();
 if (!m_stringsChecked) {
  m_hasStringAtts = outFormat.checkForStringAttributes();
  m_stringsChecked = true;
 }
 return outFormat;
}

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

@Override
public void setFilter(Filter filter) {
 super.setFilter(filter);
 if (!(filter instanceof PreconstructedFilter)) {
  throw new IllegalArgumentException(
   "The filter must be a Preconstructed one!");
 } else if (!((PreconstructedFilter) filter).isConstructed()) {
  throw new IllegalArgumentException("PreconstructedFilter: "
   + filter.getClass().getName() + " has not been initialized!");
 }
 m_FilteredInstances = filter.getOutputFormat();
}

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

/**
 * Gets the format of the output instances. This should only be called after
 * input() or batchFinished() has returned true. The relation name of the
 * output instances should be changed to reflect the action of the filter (eg:
 * add the filter name and options).
 * 
 * @return an Instances object containing the output instance structure only.
 * @throws NullPointerException if no input structure has been defined (or the
 *           output format hasn't been determined yet)
 */
@Override
public Instances getOutputFormat() {
 if (m_IgnoreClass) {
  outputFormatPeek().setClassIndex(m_ClassIndex);
 }
 return super.getOutputFormat();
}

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

/**
 * Gets the format of the output instances. This should only be called after
 * input() or batchFinished() has returned true. The relation name of the
 * output instances should be changed to reflect the action of the filter (eg:
 * add the filter name and options).
 * 
 * @return an Instances object containing the output instance structure only.
 * @throws NullPointerException if no input structure has been defined (or the
 *           output format hasn't been determined yet)
 */
@Override
public Instances getOutputFormat() {
 if (m_IgnoreClass) {
  outputFormatPeek().setClassIndex(m_ClassIndex);
 }
 return super.getOutputFormat();
}

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

Instances currentFormat = m_ntob.getOutputFormat();

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

protected MultiLabelOutput makePredictionInternal(Instance instance) throws Exception {
    boolean[] bipartition = new boolean[numLabels];
    double[] confidences = new double[numLabels];

    Instance tempInstance = DataUtils.createInstance(instance, instance.weight(), instance.toDoubleArray());
    for (int counter = 0; counter < numLabels; counter++) {
      double distribution[];
      try {
        distribution = ensemble[counter].distributionForInstance(tempInstance);
      } catch (Exception e) {
        System.out.println(e);
        return null;
      }
      int maxIndex = (distribution[0] > distribution[1]) ? 0 : 1;

      // Ensure correct predictions both for class values {0,1} and {1,0}
      Attribute classAttribute = ensemble[counter].getFilter().getOutputFormat().classAttribute();
      bipartition[chain[counter]] = (classAttribute.value(maxIndex).equals("1")) ? true : false;

      // The confidence of the label being equal to 1
      confidences[chain[counter]] = distribution[classAttribute.indexOfValue("1")];

      tempInstance.setValue(labelIndices[chain[counter]], maxIndex);

    }

    MultiLabelOutput mlo = new MultiLabelOutput(bipartition, confidences);
    return mlo;
  }
}

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

/**
 * Apply the filters (if any) setup for this map task to the supplied
 * instances
 *
 * @param toApplyTo the instances to filer
 * @return a filtered set of instances
 * @throws Exception if a problem occurs
 */
public Instances applyFilters(Instances toApplyTo) throws Exception {
 Instances result = toApplyTo;
 if (m_finalFullPreprocess != null) {
  result =
   new Instances(((Filter) m_finalFullPreprocess).getOutputFormat(), 0);
  for (int i = 0; i < toApplyTo.numInstances(); i++) {
   ((Filter) m_finalFullPreprocess).input(toApplyTo.instance(i));
   Instance processed = ((Filter) m_finalFullPreprocess).output();
   result.add(processed);
  }
 }
 return result;
}

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

Instances currentFormat = m_ntob.getOutputFormat();

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

/**
 * Determines the output format based on the input format and returns this. In
 * case the output format cannot be returned immediately, i.e.,
 * hasImmediateOutputFormat() returns false, then this method will called from
 * batchFinished() after the call of preprocess(Instances), in which, e.g.,
 * statistics for the actual processing step can be gathered.
 * 
 * @param inputFormat the input format to base the output format on
 * @return the output format
 * @throws Exception in case the determination goes wrong
 * @see #hasImmediateOutputFormat()
 * @see #batchFinished()
 * @see #preprocess(Instances)
 */
@Override
protected Instances determineOutputFormat(Instances inputFormat)
 throws Exception {
 Instances result;
 int i;
 result = getInputFormat();
 for (i = 0; i < getFilters().length; i++) {
  if (!isFirstBatchDone()) {
   getFilter(i).setInputFormat(result);
  }
  result = getFilter(i).getOutputFormat();
 }
 return result;
}

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

/**
 * Determines the output format based on the input format and returns this. In
 * case the output format cannot be returned immediately, i.e.,
 * hasImmediateOutputFormat() returns false, then this method will called from
 * batchFinished() after the call of preprocess(Instances), in which, e.g.,
 * statistics for the actual processing step can be gathered.
 * 
 * @param inputFormat the input format to base the output format on
 * @return the output format
 * @throws Exception in case the determination goes wrong
 * @see #hasImmediateOutputFormat()
 * @see #batchFinished()
 * @see #preprocess(Instances)
 */
@Override
protected Instances determineOutputFormat(Instances inputFormat)
 throws Exception {
 Instances result;
 int i;
 result = getInputFormat();
 for (i = 0; i < getFilters().length; i++) {
  if (!isFirstBatchDone()) {
   getFilter(i).setInputFormat(result);
  }
  result = getFilter(i).getOutputFormat();
 }
 return result;
}

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

Instances newData = filter.getOutputFormat();
Instance processed;
while ((processed = filter.output()) != null) {

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

Instances newData = filter.getOutputFormat();
Instance processed;
while ((processed = filter.output()) != null) {

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

m_replaceMissing = new ReplaceMissingValues();
m_replaceMissing.setInputFormat(instanceInfo);
if (m_ntob.setInputFormat(m_replaceMissing.getOutputFormat())) {
 setOutputFormat();
 return true;

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

m_replaceMissing = new ReplaceMissingValues();
m_replaceMissing.setInputFormat(instanceInfo);
if (m_ntob.setInputFormat(m_replaceMissing.getOutputFormat())) {
 setOutputFormat();
 return true;

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

result = m_Filter.getOutputFormat();
weka.core.Instance processed;
while ((processed = m_Filter.output()) != null) {

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

} else {
 m_distanceFunction.setInstances(((Filter) m_finalFullPreprocess)
  .getOutputFormat());
 m_updateDistanceFunction = true;

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

weka.filters.Filter.makeCopy(getFilter());
if (tempFilter.setInputFormat(incomingStructure)) {
 return tempFilter.getOutputFormat();

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

weka.filters.Filter.makeCopy(getFilter());
if (tempFilter.setInputFormat(incomingStructure)) {
 return tempFilter.getOutputFormat();

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

m_streamingFilter.batchFinished();
Instances structureCopy =
 m_streamingFilter.getOutputFormat().stringFreeStructure();
while (m_streamingFilter.numPendingOutput() > 0) {
 getStepManager().throughputUpdateStart();

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

m_streamingFilter.batchFinished();
Instances structureCopy =
 m_streamingFilter.getOutputFormat().stringFreeStructure();
while (m_streamingFilter.numPendingOutput() > 0) {
 getStepManager().throughputUpdateStart();

相关文章