Package weka.classifiers.timeseries

Examples of weka.classifiers.timeseries.WekaForecaster$SingleTargetForecaster


          }
        }

        try {
          if (m_configAndBuild) {
            WekaForecaster copiedForecaster =
              (WekaForecaster)AbstractForecaster.makeCopy(m_threadForecaster);
            resultList.add(copiedForecaster);
            Instances trainHeader = new Instances(trainInst, 0);
            resultList.add(trainHeader);
          }
View Full Code Here


        if (filenameN.toLowerCase().endsWith(".gz")) {
          is = new GZIPInputStream(is);
        }
        ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(
            is));
        WekaForecaster forecaster = (WekaForecaster) ois.readObject();

        Instances header = (Instances) ois.readObject();
        is.close();

        loaded.add(forecaster);
View Full Code Here

    List<Object> resultList = null;
    if (selectedName != null) {
      resultList = (List<Object>)m_history.getNamedObject(name);
    }
   
    WekaForecaster saveForecaster = null;
    Instances saveForecasterStructure = null;
    if (resultList != null) {
      for (Object o : resultList) {
        if (o instanceof WekaForecaster){
          saveForecaster = (WekaForecaster)o;
        } else if (o instanceof Instances) {
          saveForecasterStructure = (Instances)o;
        }
      }
    }
   
    final WekaForecaster toSave = saveForecaster;
    final Instances structureToSave = saveForecasterStructure;
    JMenuItem saveForecasterMenuItem = new JMenuItem("Save forecasting model");
    if (saveForecaster != null) {
      saveForecasterMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
View Full Code Here

      }
     
      if (loadOK) {
        String name = (new SimpleDateFormat("HH:mm:ss - ")).format(new Date());
        StringBuffer outBuff = new StringBuffer();
        WekaForecaster wf = (WekaForecaster)f;       
       
        String lagOptions = "";
        if (wf instanceof TSLagUser) {
          TSLagMaker lagMaker = ((TSLagUser)wf).getTSLagMaker();
          lagOptions = Utils.joinOptions(lagMaker.getOptions());
        }
       
        String fname = wf.getAlgorithmName();
        String algoName = fname.substring(0, fname.indexOf(' '));
        if (algoName.startsWith("weka.classifiers.")) {
          name += algoName.substring("weka.classifiers.".length());
        } else {
          name += algoName;
        }
        name += " loaded from '" + sFile.getName() + "'";
       
        outBuff.append("Scheme:\n\t" + fname).append("\n");
        outBuff.append("loaded from '" + sFile.getName() + "'\n\n");
       
        if (lagOptions.length() > 0) {
          outBuff.append("Lagged and derived variable options:\n\t").
          append(lagOptions + "\n\n");
        }
       
        outBuff.append(wf.toString());
       
        m_history.addResult(name, outBuff);
        m_history.setSingle(name);
       
        List<Object> resultList = new ArrayList<Object>();
View Full Code Here

        ramwriter.close();
      
        byte[] data=ramout.toByteArray();
        ByteArrayInputStream   ramStrem=new ByteArrayInputStream(data);
        Instances wine = new Instances(new InputStreamReader(ramStrem));
        WekaForecaster forecaster = new WekaForecaster();
        forecaster.setFieldsToForecast(numberfield.toString());
        forecaster.setBaseForecaster(new GaussianProcesses());
        forecaster.getTSLagMaker().setTimeStampField("thedate"); // date time stamp
        forecaster.getTSLagMaker().setMinLag(1);
        forecaster.getTSLagMaker().setMaxLag(12); // monthly data
        forecaster.getTSLagMaker().setAddMonthOfYear(true);
        forecaster.getTSLagMaker().setAddQuarterOfYear(true);
        forecaster.buildForecaster(wine);
        forecaster.primeForecaster(wine);

        // training data
        List<List<NumericPrediction>> forecast = forecaster.forecast(presize);

       Date startdate=fmt.parse(maxThedate);
       String[] numfieldsarr=numberfield.toString().split(",");
        for (int i = 0; i < presize; i++) {
          List<NumericPrediction> predsAtStep = forecast.get(i);
View Full Code Here

TOP

Related Classes of weka.classifiers.timeseries.WekaForecaster$SingleTargetForecaster

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.