Package weka.classifiers

Examples of weka.classifiers.EnsembleLibraryModel


 
  //This method will invoke the classifier's setOptions
  //method to see if the current set of options was
  //valid. 
 
  EnsembleLibraryModel model = m_ListModelsPanel.getLibrary().createModel(classifier);
 
  model.testOptions();
 
  if (!model.getOptionsWereValid())
    invalid++;
 
  dataModel.add(model);
      }
     
      //update the message text with model generation info
      String generateString = new String("  " + total
    + " models generated");
      generateString += ", " + invalid + " had errors";
      m_GenerateLabel.setText(generateString);
     
    } else if (e.getSource() == m_RemoveSelectedButton) {
     
      //here we simply get the list of models that are
      //currently selected and ten remove them from the list
     
      Object[] currentModels = m_ModelList.getSelectedValues();
     
      for (int i = 0; i < currentModels.length; i++) {
  dataModel.removeElement(currentModels[i]);
      }
     
      //Shrink the selected range to the first index that was selected
      if (m_ModelList.getSelectedIndices().length > 0) {
  int selected[] = new int[1];
  selected[0] = m_ModelList.getSelectedIndices()[0];
  m_ModelList.setSelectedIndices(selected);
      }
     
    } else if (e.getSource() == m_RemoveInvalidButton) {
     
      //here we simply remove all the models that were not
      //valid
     
      Vector toRemove = new Vector();
     
      for (int i = 0; i < dataModel.getSize(); i++) {
 
  EnsembleLibraryModel currentModel = (EnsembleLibraryModel) dataModel.getElementAt(i);
  if (!currentModel.getOptionsWereValid()) {
    toRemove.add(currentModel);
  }
      }
     
      for (int i = 0; i < toRemove.size(); i++)
  dataModel.removeElement(toRemove.get(i));
     
    } else if (e.getSource() == m_AddAllButton) {
     
      //here we just need to add all of the models to the
      //ListModelsPanel object
     
      Iterator it = dataModel.iterator();
     
      while (it.hasNext()) {
  EnsembleLibraryModel currentModel = (EnsembleLibraryModel) it.next();
  if (currentModel.getOptionsWereValid()) {
    m_ListModelsPanel.addModel(currentModel);
  }
      }
     
      int size = dataModel.getSize();
View Full Code Here


     
      Component modelComponent = null;
     
      if (value instanceof EnsembleLibraryModel) {
 
  EnsembleLibraryModel model = ((EnsembleLibraryModel) value);
 
  String modelString = index
  + ": "
  + model.getStringRepresentation().replaceAll(
      "weka.classifiers.", "");
 
  modelComponent = super.getListCellRendererComponent(list,
      modelString, index, isSelected, cellHasFocus);
 
  if (!model.getOptionsWereValid()) {
    modelComponent.setBackground(Color.pink);
  }
 
  ((JComponent) modelComponent).setToolTipText(model
      .getDescriptionText());
 
      }
     
      return modelComponent;
View Full Code Here

      // ListModelsPanel object
     
      Iterator it = dataModel.iterator();
     
      while (it.hasNext()) {
  EnsembleLibraryModel currentModel = (EnsembleLibraryModel) it
  .next();
 
  m_ListModelsPanel.addModel(currentModel);
      }
     
View Full Code Here

      }
     
      classifiers = (Vector) serialization.read(ClassLoader.getSystemResourceAsStream(defaultFileString));
     
      for (Iterator it = classifiers.iterator(); it.hasNext();) {
  EnsembleLibraryModel model = m_ListModelsPanel.getLibrary().createModel((Classifier) it.next());
  model.testOptions();
  ((ModelList.SortedListModel) m_ModelList.getModel()).add(model);
      }
     
    } catch (Exception e) {
      // TODO Auto-generated catch block
View Full Code Here

      //ListModelsPanel object
     
      Iterator it = dataModel.iterator();
     
      while (it.hasNext()) {
  EnsembleLibraryModel currentModel = (EnsembleLibraryModel) it.next();
  m_ListModelsPanel.addModel(currentModel);
      }
     
      dataModel.clear();
     
View Full Code Here

    //if they match one of the patterns
   
    Iterator it = dataModel.iterator();
   
    while (it.hasNext()) {
      EnsembleLibraryModel currentModel = (EnsembleLibraryModel) it.next();
     
      for (int i = 0; i < patterns.length; i++) {
  if (patterns[i].matcher(currentModel.getStringRepresentation()).matches()) {
    toRemove.add(currentModel);
    break;
  }
      }
    }
View Full Code Here

TOP

Related Classes of weka.classifiers.EnsembleLibraryModel

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.