Package weka.core.converters

Examples of weka.core.converters.ArffLoader$ArffReader


    }

    public double classify(LinkedHashMap<Integer, Double> sample) {
        try {
            Classifier cModel = (LibSVM) loadClassifier();
            ArffLoader loader = new ArffLoader();
            loader.setFile(new File(PropertiesGetter.getProperty("TrainingDataSetObject")));
            Instances structure = loader.getStructure();
            structure.setClassIndex(structure.numAttributes() - 1);
            int numAtts = structure.numAttributes();
            Instance instanceToClassify = getNewInstance(numAtts);
            Iterator<Entry<Integer, Double>> currentIt = sample.entrySet().iterator();
            Entry<Integer, Double> tempEntry;
View Full Code Here


    queryAnalyser = new QueryAnalyser();
    loadDataset();
  }
 
  private void loadDataset(){
    ArffLoader loader = new ArffLoader();
    try {
      loader.setFile(new File(WekaParam.TRAINING_DATA_FILE));
      dataSet = loader.getDataSet();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    dataSet.setClassIndex(dataSet.numAttributes() - 1);
View Full Code Here

    }
    return configProperties;
  }
 
  private Instances loadDataset(String datasetPath){
    ArffLoader loader = new ArffLoader();
    Instances dataset = null;
    try {
      loader.setFile(new File(datasetPath));
      dataset = loader.getDataSet();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    return dataset;
View Full Code Here

      final long endTime;
      final float duration;

     
       // load data
       ArffLoader loader = new ArffLoader();
       loader.setFile(new File("./src/trust/weka/BelWeka.arff"));
       Instances data = loader.getDataSet();
      
       WekaClusterClassifier classifier = new WekaClusterClassifier();
       classifier.setDataset(data);
       classifier.getClassifier();
      
View Full Code Here

      final long endTime;
      final float duration;

     
       // load data
       ArffLoader loader = new ArffLoader();
       loader.setFile(new File("./src/trust/weka4jason/trainingSet.arff"));
       Instances data = loader.getDataSet();
      
       WekaBinClassifier classifier = new WekaBinClassifier();
       classifier.setWekaOptions("-F -B 10 -M -1.0 -R last");
       //classifier.setDataset(data);
View Full Code Here

      final long endTime;
      final float duration;

     
       // load data
       ArffLoader loader = new ArffLoader();
       loader.setFile(new File("./src/trust/weka4jason/trainingSet.arff"));
       Instances data = loader.getDataSet();
      
       WekaPerceptronClassifier classifier= new WekaPerceptronClassifier();
      
       System.out.println(classifier);
      
View Full Code Here

   * Beliefbase becomes the imput for WEKA algorithms.
   */
  public void test3(){
    try{
     // load data
     ArffLoader loader = new ArffLoader();
     loader.setFile(new File("BelWeka.arff"));
     Instances structure = loader.getStructure();
    
     Instances data = loader.getDataSet();
    
     structure.addAll(data);
    
    
    // System.out.println(" Structure: " + structure);
View Full Code Here

      buffer.append("  Password: " + "?" + "\n")
      buffer.append("  Query: " + databaseLoader.getQuery() + "\n");
      buffer.append("  Key columns' name: " + databaseLoader.getKeys() + "\n");       
    }
    else if(className.equalsIgnoreCase(ArffLoader.class.getName())) {
      ArffLoader arffLoader = (ArffLoader)loader.getLoader();
      buffer.append("  Loader type: ArffLoader" + "\n");
    }
    else if(className.equalsIgnoreCase(CSVLoader.class.getName())) {
      CSVLoader csvLoader = (CSVLoader)loader.getLoader();
      buffer.append("  Loader type: CSVLoader" + "\n");
View Full Code Here

        DatabaseLoader databaseLoader = (DatabaseLoader)loader.getLoader();
        if(env.getOutConnection() != null) {
          databaseLoader.setSource(env.getInConnection());
        }
      } else if(className.equalsIgnoreCase(ArffLoader.class.getName())) {
        ArffLoader arffLoader = (ArffLoader)loader.getLoader();
        // setup operation goes here
      } else if(className.equalsIgnoreCase(CSVLoader.class.getName())) {
        CSVLoader csvLoader = (CSVLoader)loader.getLoader();
        // setup operation goes here       
      }   
View Full Code Here

    private Instances loadInstancesFromARFF(String filename, String className) throws IOException {
        File file = new File(TEST_RESOURCES, filename);
        assertTrue(file.exists());

        ArffLoader loader = new ArffLoader();
        loader.setFile(file);
        Instances insts = loader.getDataSet();
        Attribute classAttribute = insts.attribute(className);
        insts.setClass(classAttribute);
        return insts;
    }
View Full Code Here

TOP

Related Classes of weka.core.converters.ArffLoader$ArffReader

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.