weka.classifiers.timeseries.eval.graph
Class GraphDriver

java.lang.Object
  extended by weka.classifiers.timeseries.eval.graph.GraphDriver
Direct Known Subclasses:
JFreeChartDriver

public abstract class GraphDriver
extends java.lang.Object


Constructor Summary
GraphDriver()
           
 
Method Summary
static GraphDriver getDefaultDriver()
           
static GraphDriver getDriver(java.lang.String driverName)
          Factory method for obtaining a named graph driver for producing graphs
abstract  javax.swing.JPanel getGraphPanelSteps(TSForecaster forecaster, java.util.List<ErrorModule> preds, java.lang.String targetName, java.util.List<java.lang.Integer> stepsToPlot, int instanceNumOffset, Instances data)
          Return the graph encapsulated in a JPanel.
abstract  javax.swing.JPanel getGraphPanelTargets(TSForecaster forecaster, ErrorModule preds, java.util.List<java.lang.String> targetNames, int stepNumber, int instanceNumOffset, Instances data)
          Return the graph encapsulated in a panel.
abstract  java.awt.Image getImageFromChart(javax.swing.JPanel chart, int width, int height)
          Get an image representation of the supplied chart.
abstract  javax.swing.JPanel getPanelFutureForecast(TSForecaster forecaster, java.util.List<java.util.List<NumericPrediction>> preds, java.util.List<java.lang.String> targetNames, Instances history)
          Return the graph encapsulated in a JPanel
abstract  void saveChartToFile(javax.swing.JPanel chart, java.lang.String filename, int width, int height)
          Save a chart to a file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphDriver

public GraphDriver()
Method Detail

getDriver

public static GraphDriver getDriver(java.lang.String driverName)
                             throws java.lang.IllegalArgumentException
Factory method for obtaining a named graph driver for producing graphs

Parameters:
driverName - the name of the driver to obtain
Returns:
an instance of the named driver
Throws:
java.lang.IllegalArgumentException - if the supplied driver name is unknown.

getDefaultDriver

public static GraphDriver getDefaultDriver()

saveChartToFile

public abstract void saveChartToFile(javax.swing.JPanel chart,
                                     java.lang.String filename,
                                     int width,
                                     int height)
                              throws java.lang.Exception
Save a chart to a file.

Parameters:
chart - the chart to save
filename - the filename to save to
width - width of the saved image
height - height of the saved image
Throws:
java.lang.Exception - if the chart can't be saved for some reason

getImageFromChart

public abstract java.awt.Image getImageFromChart(javax.swing.JPanel chart,
                                                 int width,
                                                 int height)
                                          throws java.lang.Exception
Get an image representation of the supplied chart.

Parameters:
chart - the chart to get an image of.
width - width of the chart
height - height of the chart
Returns:
an Image of the chart
Throws:
java.lang.Exception - if the image can't be created for some reason

getGraphPanelTargets

public abstract javax.swing.JPanel getGraphPanelTargets(TSForecaster forecaster,
                                                        ErrorModule preds,
                                                        java.util.List<java.lang.String> targetNames,
                                                        int stepNumber,
                                                        int instanceNumOffset,
                                                        Instances data)
                                                 throws java.lang.Exception
Return the graph encapsulated in a panel.

Parameters:
width - the width in pixels of the graph
height - the height in pixels of the graph
forecaster - the forecaster
preds - an ErrorModule that contains predictions for all targets for the specified step ahead. Targets are in the same order returned by TSForecaster.getFieldsToForecast()
targetNames - the list of target names to plot
stepNumber - which step ahead to graph for specified targets
instanceNumOffset - how far into the data the predictions start from
data - the instances that these predictions correspond to (may be null)
Returns:
an image of the graph
Throws:
java.lang.Exception

getGraphPanelSteps

public abstract javax.swing.JPanel getGraphPanelSteps(TSForecaster forecaster,
                                                      java.util.List<ErrorModule> preds,
                                                      java.lang.String targetName,
                                                      java.util.List<java.lang.Integer> stepsToPlot,
                                                      int instanceNumOffset,
                                                      Instances data)
                                               throws java.lang.Exception
Return the graph encapsulated in a JPanel.

Parameters:
forecaster - the forecaster
preds - a list of ErrorModules, one for each consecutive step ahead prediction set
targetName - the name of the target field to plot
stepsToPlot - a list of step numbers for the step-ahead prediction sets to plot to plot for the specified target.
instanceNumOffset - how far into the data the predictions start from
data - the instances that these predictions correspond to (may be null)
Returns:
an image of the graph.
Throws:
java.lang.Exception

getPanelFutureForecast

public abstract javax.swing.JPanel getPanelFutureForecast(TSForecaster forecaster,
                                                          java.util.List<java.util.List<NumericPrediction>> preds,
                                                          java.util.List<java.lang.String> targetNames,
                                                          Instances history)
                                                   throws java.lang.Exception
Return the graph encapsulated in a JPanel

Parameters:
forecaster - the forecaster
preds - a list of list of predictions for *all* targets. The outer list is indexed by step number (i.e. the first entry is the 1-step ahead forecasts, the second is the 2-steps ahead forecasts etc.) and the inner list is indexed by target in the same order as the list of targets returned by TSForecaster.getFieldsToForecast().
targetNames - the list of target names to plot
history - a set of instances from which predictions are assumed to follow on from. May be null, in which case just the predictions are plotted.
Returns:
an image of the graph
Throws:
java.lang.Exception