当前位置: 首页>>代码示例>>Java>>正文


Java ConverterUtils类代码示例

本文整理汇总了Java中weka.core.converters.ConverterUtils的典型用法代码示例。如果您正苦于以下问题:Java ConverterUtils类的具体用法?Java ConverterUtils怎么用?Java ConverterUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ConverterUtils类属于weka.core.converters包,在下文中一共展示了ConverterUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: train

import weka.core.converters.ConverterUtils; //导入依赖的package包/类
private void train(String name) {
	try {
		Classifier randomForest = new RandomForest();

		ConverterUtils.DataSource source = new ConverterUtils.DataSource(FOLDER + name);
		dataSet = source.getDataSet();

		dataSet.setClassIndex(dataSet.numAttributes() - 1);
		randomForest.buildClassifier(dataSet);

		classifier = randomForest;
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:igr,项目名称:parlo,代码行数:16,代码来源:SentenceClassifier.java

示例2: train

import weka.core.converters.ConverterUtils; //导入依赖的package包/类
public void train() {
	try {
		Classifier randomForest = new RandomForest();

		ConverterUtils.DataSource source = new ConverterUtils.DataSource(FOLDER + "question-classifier.arff");
		dataSet = source.getDataSet();

		dataSet.setClassIndex(dataSet.numAttributes() - 1);
		randomForest.buildClassifier(dataSet);

		classifier = randomForest;
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:igr,项目名称:parlo,代码行数:16,代码来源:QuestionClassifier.java

示例3: filterNonCoreLoaderFileFilters

import weka.core.converters.ConverterUtils; //导入依赖的package包/类
/**
 * filters out all non-core loaders if only those should be displayed.
 * 
 * @param list the list of filters to check
 * @return the filtered list of filters
 * @see #m_CoreConvertersOnly
 */
protected Vector<ExtensionFileFilter> filterNonCoreLoaderFileFilters(
  Vector<ExtensionFileFilter> list) {
  Vector<ExtensionFileFilter> result;
  int i;
  ExtensionFileFilter filter;
  AbstractLoader loader;

  if (!getCoreConvertersOnly()) {
    result = list;
  } else {
    result = new Vector<ExtensionFileFilter>();
    for (i = 0; i < list.size(); i++) {
      filter = list.get(i);
      loader = ConverterUtils
        .getLoaderForExtension(filter.getExtensions()[0]);
      if (ConverterUtils.isCoreFileLoader(loader.getClass().getName())) {
        result.add(filter);
      }
    }
  }

  return result;
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:31,代码来源:ConverterFileChooser.java

示例4: filterNonCoreSaverFileFilters

import weka.core.converters.ConverterUtils; //导入依赖的package包/类
/**
 * filters out all non-core savers if only those should be displayed.
 * 
 * @param list the list of filters to check
 * @return the filtered list of filters
 * @see #m_CoreConvertersOnly
 */
protected Vector<ExtensionFileFilter> filterNonCoreSaverFileFilters(
  Vector<ExtensionFileFilter> list) {
  Vector<ExtensionFileFilter> result;
  int i;
  ExtensionFileFilter filter;
  AbstractSaver saver;

  if (!getCoreConvertersOnly()) {
    result = list;
  } else {
    result = new Vector<ExtensionFileFilter>();
    for (i = 0; i < list.size(); i++) {
      filter = list.get(i);
      saver = ConverterUtils.getSaverForExtension(filter.getExtensions()[0]);
      if (ConverterUtils.isCoreFileSaver(saver.getClass().getName())) {
        result.add(filter);
      }
    }
  }

  return result;
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:30,代码来源:ConverterFileChooser.java

示例5: filterSaverFileFilters

import weka.core.converters.ConverterUtils; //导入依赖的package包/类
/**
 * filters the list of file filters according to the currently set.
 * Capabilities
 * 
 * @param list the filters to check
 * @return the filtered list of filters
 */
protected Vector<ExtensionFileFilter> filterSaverFileFilters(
  Vector<ExtensionFileFilter> list) {
  Vector<ExtensionFileFilter> result;
  int i;
  ExtensionFileFilter filter;
  AbstractSaver saver;

  if (m_CapabilitiesFilter == null) {
    result = list;
  } else {
    result = new Vector<ExtensionFileFilter>();

    for (i = 0; i < list.size(); i++) {
      filter = list.get(i);
      saver = ConverterUtils.getSaverForExtension(filter.getExtensions()[0]);
      if (saver.getCapabilities().supports(m_CapabilitiesFilter)) {
        result.add(filter);
      }
    }
  }

  return result;
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:31,代码来源:ConverterFileChooser.java

示例6: loadFile

import weka.core.converters.ConverterUtils; //导入依赖的package包/类
/**
 * loads the specified ARFF file
 * 
 * @param filename the file to load
 * @param loaders optional varargs for a loader to use
 */
protected void loadFile(String filename, AbstractFileLoader... loaders) {
  AbstractFileLoader loader;

  if (loaders == null || loaders.length == 0) {
    loader = ConverterUtils.getLoaderForFile(filename);
  } else {
    loader = loaders[0];
  }

  if (loader != null) {
    try {
      loader.setFile(new File(filename));
      setInstances(loader.getDataSet());
    } catch (Exception e) {
      ComponentHelper
        .showMessageBox(null, "Error loading file...", e.toString(),
          JOptionPane.OK_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE);
      System.out.println(e);
      setInstances(null);
    }
  }
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:29,代码来源:ArffTableModel.java

示例7: filterNonCoreLoaderFileFilters

import weka.core.converters.ConverterUtils; //导入依赖的package包/类
/**
  * filters out all non-core loaders if only those should be displayed.
  * 
  * @param list	the list of filters to check
  * @return		the filtered list of filters
  * @see		#m_CoreConvertersOnly
  */
 protected Vector<ExtensionFileFilter> filterNonCoreLoaderFileFilters(Vector<ExtensionFileFilter> list) {
   Vector<ExtensionFileFilter> result;
   int				i;
   ExtensionFileFilter		filter;
   AbstractLoader		loader;
   
   if (!getCoreConvertersOnly()) {
     result = list;
   }
   else {
     result = new Vector<ExtensionFileFilter>();
     for (i = 0; i < list.size(); i++) {
filter = list.get(i);
loader = ConverterUtils.getLoaderForExtension(filter.getExtensions()[0]);
if (ConverterUtils.isCoreFileLoader(loader.getClass().getName()))
  result.add(filter);
     }
   }
   
   return result;
 }
 
开发者ID:dsibournemouth,项目名称:autoweka,代码行数:29,代码来源:ConverterFileChooser.java

示例8: filterNonCoreSaverFileFilters

import weka.core.converters.ConverterUtils; //导入依赖的package包/类
/**
  * filters out all non-core savers if only those should be displayed.
  * 
  * @param list	the list of filters to check
  * @return		the filtered list of filters
  * @see		#m_CoreConvertersOnly
  */
 protected Vector<ExtensionFileFilter> filterNonCoreSaverFileFilters(Vector<ExtensionFileFilter> list) {
   Vector<ExtensionFileFilter> result;
   int				i;
   ExtensionFileFilter		filter;
   AbstractSaver		saver;
   
   if (!getCoreConvertersOnly()) {
     result = list;
   }
   else {
     result = new Vector<ExtensionFileFilter>();
     for (i = 0; i < list.size(); i++) {
filter = list.get(i);
saver = ConverterUtils.getSaverForExtension(filter.getExtensions()[0]);
if (ConverterUtils.isCoreFileSaver(saver.getClass().getName()))
  result.add(filter);
     }
   }
   
   return result;
 }
 
开发者ID:dsibournemouth,项目名称:autoweka,代码行数:29,代码来源:ConverterFileChooser.java

示例9: filterSaverFileFilters

import weka.core.converters.ConverterUtils; //导入依赖的package包/类
/**
  * filters the list of file filters according to the currently set.
  * Capabilities
  * 
  * @param list	the filters to check
  * @return		the filtered list of filters
  */
 protected Vector<ExtensionFileFilter> filterSaverFileFilters(Vector<ExtensionFileFilter> list) {
   Vector<ExtensionFileFilter>	result;
   int				i;
   ExtensionFileFilter		filter;
   AbstractSaver		saver;
   
   if (m_CapabilitiesFilter == null) {
     result = list;
   }
   else {
     result = new Vector<ExtensionFileFilter>();
     
     for (i = 0; i < list.size(); i++) {
filter = list.get(i);
saver  = ConverterUtils.getSaverForExtension(filter.getExtensions()[0]);
if (saver.getCapabilities().supports(m_CapabilitiesFilter))
  result.add(filter);
     }
   }

   return result;
 }
 
开发者ID:dsibournemouth,项目名称:autoweka,代码行数:30,代码来源:ConverterFileChooser.java

示例10: nextIteration

import weka.core.converters.ConverterUtils; //导入依赖的package包/类
/**
 * Carries out the next iteration of the experiment.
 * 
 * @throws Exception if an error occurs
 */
@Override
public void nextIteration() throws Exception {

	if (m_UsePropertyIterator) {
		if (m_CurrentProperty != m_PropertyNumber) {
			setProperty(0, m_ResultProducer);
			m_CurrentProperty = m_PropertyNumber;
		}
	}

	if (m_CurrentInstances == null) {
		File currentFile = (File) getDatasets().elementAt(m_DatasetNumber);
		AbstractFileLoader loader = ConverterUtils.getLoaderForFile(currentFile);
		loader.setFile(currentFile);
		Instances data = new Instances(loader.getDataSet());
		MLUtils.prepareData(data);
		m_CurrentInstances = data;
		m_ResultProducer.setInstances(m_CurrentInstances);
	}

	m_ResultProducer.doRun(m_RunNumber);

	advanceCounters();
}
 
开发者ID:IsaacHaze,项目名称:meka,代码行数:30,代码来源:MekaExperiment.java

示例11: save

import weka.core.converters.ConverterUtils; //导入依赖的package包/类
/**
 * Saves the data to the specified file.
 * 
 * @param file the file to save the data to
 * @param saver the saver to use, determines it automatically if null
 */
public void save(File file, AbstractFileSaver saver) {
	if (saver == null)
		saver = ConverterUtils.getSaverForFile(file);
	try {
		saver.setInstances(m_Data);
		if ((saver.retrieveFile() == null) || !saver.retrieveFile().equals(file))
			saver.setFile(file);
		saver.writeBatch();
		m_CurrentFile = file;
	}
	catch (Exception e) {
		System.err.println("Failed to save data to '" + file + "':");
		e.printStackTrace();
		JOptionPane.showMessageDialog(
				this, 
				"Failed to save dataset to '" + file + "':\n" + e, 
				"Error saving",
				JOptionPane.ERROR_MESSAGE);
	}

	updateMenu();
}
 
开发者ID:IsaacHaze,项目名称:meka,代码行数:29,代码来源:Explorer.java

示例12: filterNonCoreLoaderFileFilters

import weka.core.converters.ConverterUtils; //导入依赖的package包/类
/**
  * filters out all non-core loaders if only those should be displayed
  * 
  * @param list	the list of filters to check
  * @return		the filtered list of filters
  * @see		#m_CoreConvertersOnly
  */
 protected Vector<ExtensionFileFilter> filterNonCoreLoaderFileFilters(Vector<ExtensionFileFilter> list) {
   Vector<ExtensionFileFilter> result;
   int				i;
   ExtensionFileFilter		filter;
   AbstractLoader		loader;
   
   if (!getCoreConvertersOnly()) {
     result = list;
   }
   else {
     result = new Vector<ExtensionFileFilter>();
     for (i = 0; i < list.size(); i++) {
filter = list.get(i);
loader = ConverterUtils.getLoaderForExtension(filter.getExtensions()[0]);
if (ConverterUtils.isCoreFileLoader(loader.getClass().getName()))
  result.add(filter);
     }
   }
   
   return result;
 }
 
开发者ID:williamClanton,项目名称:jbossBA,代码行数:29,代码来源:ConverterFileChooser.java

示例13: filterNonCoreSaverFileFilters

import weka.core.converters.ConverterUtils; //导入依赖的package包/类
/**
  * filters out all non-core savers if only those should be displayed
  * 
  * @param list	the list of filters to check
  * @return		the filtered list of filters
  * @see		#m_CoreConvertersOnly
  */
 protected Vector<ExtensionFileFilter> filterNonCoreSaverFileFilters(Vector<ExtensionFileFilter> list) {
   Vector<ExtensionFileFilter> result;
   int				i;
   ExtensionFileFilter		filter;
   AbstractSaver		saver;
   
   if (!getCoreConvertersOnly()) {
     result = list;
   }
   else {
     result = new Vector<ExtensionFileFilter>();
     for (i = 0; i < list.size(); i++) {
filter = list.get(i);
saver = ConverterUtils.getSaverForExtension(filter.getExtensions()[0]);
if (ConverterUtils.isCoreFileSaver(saver.getClass().getName()))
  result.add(filter);
     }
   }
   
   return result;
 }
 
开发者ID:williamClanton,项目名称:jbossBA,代码行数:29,代码来源:ConverterFileChooser.java

示例14: filterSaverFileFilters

import weka.core.converters.ConverterUtils; //导入依赖的package包/类
/**
  * filters the list of file filters according to the currently set
  * Capabilities
  * 
  * @param list	the filters to check
  * @return		the filtered list of filters
  */
 protected Vector<ExtensionFileFilter> filterSaverFileFilters(Vector<ExtensionFileFilter> list) {
   Vector<ExtensionFileFilter>	result;
   int				i;
   ExtensionFileFilter		filter;
   AbstractSaver		saver;
   
   if (m_CapabilitiesFilter == null) {
     result = list;
   }
   else {
     result = new Vector<ExtensionFileFilter>();
     
     for (i = 0; i < list.size(); i++) {
filter = list.get(i);
saver  = ConverterUtils.getSaverForExtension(filter.getExtensions()[0]);
if (saver.getCapabilities().supports(m_CapabilitiesFilter))
  result.add(filter);
     }
   }

   return result;
 }
 
开发者ID:williamClanton,项目名称:jbossBA,代码行数:30,代码来源:ConverterFileChooser.java

示例15: loadFile

import weka.core.converters.ConverterUtils; //导入依赖的package包/类
/**
 * loads the specified ARFF file
 *
 * @param filename	the file to load
 */
private void loadFile(String filename) {
  AbstractFileLoader          loader;

  loader = ConverterUtils.getLoaderForFile(filename);

  if (loader != null) {
    try {
      loader.setFile(new File(filename));
      m_Data = loader.getDataSet();
    }
    catch (Exception e) {
      ComponentHelper.showMessageBox(
          null,
          Messages.getInstance().getString("ArffTableModel_LoadFile_ComponentHelperShowMessageBox_Text"),
          e.toString(),
          JOptionPane.OK_CANCEL_OPTION,
          JOptionPane.ERROR_MESSAGE );
      System.out.println(Thread.currentThread().getStackTrace()[1].getClassName() +e);
      m_Data = null;
    }
  }
}
 
开发者ID:williamClanton,项目名称:jbossBA,代码行数:28,代码来源:ArffTableModel.java


注:本文中的weka.core.converters.ConverterUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。