Package weka.core.converters

Examples of weka.core.converters.AbstractFileLoader


      m_IOThread = new Thread() {
  public void run() {

    try {
      m_Log.statusMessage("Reading from URL...");
      AbstractFileLoader loader = ConverterUtils.getURLLoaderForFile(u.toString());
      if (loader == null)
        throw new Exception("No suitable URLSourcedLoader found for URL!\n" + u);
      ((URLSourcedLoader) loader).setURL(u.toString());
      setInstances(loader.getDataSet());
    } catch (Exception ex) {
      ex.printStackTrace();
      m_Log.statusMessage("Problem reading " + u);
      JOptionPane.showMessageDialog(PreprocessPanel.this,
            "Couldn't read from URL:\n"
View Full Code Here


      m_tempUndoIndex = m_tempUndoFiles.length-1;
    }
   
    if (m_tempUndoFiles[m_tempUndoIndex] != null) {
      // load instances from the temporary file
      AbstractFileLoader loader = ConverterUtils.getLoaderForFile(m_tempUndoFiles[m_tempUndoIndex]);
      try {
  loader.setFile(m_tempUndoFiles[m_tempUndoIndex]);
  setInstancesFromFile(loader);
      }
      catch (Exception e) {
  e.printStackTrace();
  m_Log.logMessage(e.toString());
View Full Code Here

   * 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,
            "Error loading file...",
View Full Code Here

        getImage(m_explorer.getClass().getClassLoader().getResource("weka/gui/weka_icon_new_48.png"));
      jf.setIconImage(icon);

      if (args.length == 1) {
        System.err.println(Messages.getInstance().getString("Explorer_Main_Run_Error_Text") + args[0]);
        AbstractFileLoader loader = ConverterUtils.getLoaderForFile(args[0]);
  loader.setFile(new File(args[0]));
        m_explorer.m_PreprocessPanel.setInstancesFromFile(loader);
      }

      Thread memMonitor = new Thread() {
        public void run() {
View Full Code Here

      m_IOThread = new Thread() {
  public void run() {

    try {
      m_Log.statusMessage(Messages.getInstance().getString("PreprocessPanel_SetInstancesFromURL_Run_Log_StatusMessage_Text_First"));
      AbstractFileLoader loader = ConverterUtils.getURLLoaderForFile(u.toString());
      if (loader == null)
        throw new Exception(Messages.getInstance().getString("PreprocessPanel_SetInstancesFromURL_Run_Exception_Text_First") + u);
      ((URLSourcedLoader) loader).setURL(u.toString());
      setInstances(loader.getDataSet());
    } catch (Exception ex) {
      ex.printStackTrace();
      m_Log.statusMessage(Messages.getInstance().getString("PreprocessPanel_SetInstancesFromURL_Run_Log_StatusMessage_Text_Second") + u);
      JOptionPane.showMessageDialog(PreprocessPanel.this,
          Messages.getInstance().getString("PreprocessPanel_SetInstancesFromDB_Run_JOptionPaneShowMessageDialog_Text_Fifth")
View Full Code Here

      m_tempUndoIndex = m_tempUndoFiles.length-1;
    }
   
    if (m_tempUndoFiles[m_tempUndoIndex] != null) {
      // load instances from the temporary file
      AbstractFileLoader loader = ConverterUtils.getLoaderForFile(m_tempUndoFiles[m_tempUndoIndex]);
      try {
  loader.setFile(m_tempUndoFiles[m_tempUndoIndex]);
  setInstancesFromFile(loader);
      }
      catch (Exception e) {
  e.printStackTrace();
  m_Log.logMessage(e.toString());
View Full Code Here

      ConverterFileChooser fc = new ConverterFileChooser(System.getProperty("user.dir"));
      fc.setDialogTitle("Set Data File");
      int rval = fc.showOpenDialog(GUI.this);

      if (rval == JFileChooser.APPROVE_OPTION) {
        AbstractFileLoader loader = fc.getLoader();
        try {
          if (loader != null)
            m_Instances = loader.getDataSet();
          if (m_Instances.classIndex() == -1)
            m_Instances.setClassIndex(m_Instances.numAttributes() - 1);
          a_learn.setEnabled(true);
          a_learnCPT.setEnabled(true);
          repaint();
View Full Code Here

      }
    }
   
    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());
      // only set class attribute if not already done by loader
      if (data.classIndex() == -1) {
  if (m_ClassFirst) {
    data.setClassIndex(0);
  } else {
View Full Code Here

   * @throws Exception  if something goes wrong with loading/saving
   */
  public static void main(String[] args) throws Exception {
    ConverterFileChooser  fc;
    int        retVal;
    AbstractFileLoader    loader;
    AbstractFileSaver    saver;
    Instances      data;
   
    fc     = new ConverterFileChooser();
    retVal = fc.showOpenDialog(null);
   
    // load file
    if (retVal == ConverterFileChooser.APPROVE_OPTION) {
      loader = fc.getLoader();
      data   = loader.getDataSet();
      retVal = fc.showSaveDialog(null);

      // save file
      if (retVal == ConverterFileChooser.APPROVE_OPTION) {
  saver = fc.getSaver();
View Full Code Here

   * 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"),
View Full Code Here

TOP

Related Classes of weka.core.converters.AbstractFileLoader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.