|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.experiment.Experiment
weka.experiment.RemoteExperiment
Holds all the necessary configuration information for a distributed experiment. This object is able to be serialized for storage on disk.
This class is experimental at present. Has been tested using CSVResultListener (sending results to standard out) and DatabaseResultListener (InstantDB + RmiJdbc bridge).
Getting started:
Start InstantDB (with the RMI bridge) on some machine. If using java2
then specify -Djava.security.policy=db.policy to the
virtual machine. Where db.policy is as follows:
grant { permission java.security.AllPermission; };
Start RemoteEngine servers on x machines as per the instructons in the README_Experiment_Gui file. There must be a DatabaseUtils.props in either the HOME or current directory of each machine, listing all necessary jdbc drivers.
The machine where a RemoteExperiment is started must also have a copy of DatabaseUtils.props listing the URL to the machine where the database server is running (RmiJdbc + InstantDB).
Here is an example of starting a RemoteExperiment:
java -Djava.rmi.server.codebase=file:/path to weka classes/ \ weka.experiment.RemoteExperiment -L 1 -U 10 \ -T /home/ml/datasets/UCI/iris.arff \ -D "weka.experiment.DatabaseResultListener" \ -P "weka.experiment.RandomSplitResultProducer" \ -h rosebud.cs.waikato.ac.nz -h blackbird.cs.waikato.ac.nz -r -- \ -W weka.experiment.ClassifierSplitEvaluator -- \ -W weka.classifiers.bayes.NaiveBayes
The "codebase" property tells rmi where to serve up weka classes from. This can either be a file url (as long as a shared file system is being used that is accessable by the remoteEngine servers), or http url (which of course supposes that a web server is running and you have put your weka classes somewhere that is web accessable). If using a file url the trailing "/" is *most* important unless the weka classes are in a jar file.
Field Summary | |
protected static int |
AVAILABLE
|
protected static int |
CONNECTION_FAILED
|
protected static int |
IN_USE
|
private Experiment |
m_baseExperiment
The base experiment to split up into sub experiments for remote execution |
private boolean |
m_experimentAborted
Set to true if MAX_FAILURES exceeded on all hosts or connections fail on all hosts or user aborts experiment (via gui) |
private int |
m_failedCount
The count of failed sub-experiments |
private int |
m_finishedCount
The count of successfully completed sub-experiments |
private FastVector |
m_listeners
The list of objects listening for remote experiment events |
private int[] |
m_remoteHostFailureCounts
The number of times tasks have failed on each remote host |
protected javax.swing.DefaultListModel |
m_remoteHosts
Holds the names of machines with remoteEngine servers running |
private Queue |
m_remoteHostsQueue
The queue of available hosts |
private int[] |
m_remoteHostsStatus
The status of each of the remote hosts |
private int |
m_removedHosts
The number of hosts removed due to exceeding max failures |
protected boolean |
m_splitByDataSet
If true, then sub experiments are created on the basis of data sets rather than run number. |
protected int[] |
m_subExpComplete
The status of each of the sub-experiments |
protected Experiment[] |
m_subExperiments
The sub experiments |
private Queue |
m_subExpQueue
The queue of sub experiments waiting to be processed |
protected static int |
MAX_FAILURES
allow at most 3 failures on a host before it is removed from the list of usable hosts |
protected static int |
SOME_OTHER_FAILURE
|
Fields inherited from class weka.experiment.Experiment |
FILE_EXTENSION, m_AdditionalMeasures, m_AdvanceDataSetFirst, m_ClassFirst, m_CurrentInstances, m_CurrentProperty, m_DatasetNumber, m_Datasets, m_Finished, m_m_AdvanceRunFirst, m_Notes, m_PropertyArray, m_PropertyNumber, m_PropertyPath, m_ResultListener, m_ResultProducer, m_RunLower, m_RunNumber, m_RunUpper, m_UsePropertyIterator |
Constructor Summary | |
RemoteExperiment(Experiment base)
Construct a new RemoteExperiment using a base Experiment |
Method Summary | |
void |
abortExperiment()
Set the abort flag |
void |
addRemoteExperimentListener(RemoteExperimentListener r)
Add an object to the list of those interested in recieving update information from the RemoteExperiment |
void |
addRemoteHost(java.lang.String hostname)
Add a host name to the list of remote hosts |
void |
advanceCounters()
overides the one in Experiment |
protected void |
availableHost(int hostNum)
Pushes a host back onto the queue of available hosts and attempts to launch a waiting experiment (if any). |
private boolean |
checkForAllFailedHosts()
Check to see if we have failed to connect to all hosts |
Experiment |
getBaseExperiment()
Get the base experiment used by this remote experiment |
javax.swing.DefaultListModel |
getRemoteHosts()
Get the list of remote host names |
boolean |
getSplitByDataSet()
Returns true if sub experiments are to be created on the basis of data set.. |
protected void |
incrementFailed(int hostNum)
Increment the overall number of failures and the number of failures for a particular host |
protected void |
incrementFinished()
Increment the number of successfully completed sub experiments |
void |
initialize()
Prepares a remote experiment for running, creates sub experiments |
void |
launchNext(int wexp,
int ah)
Launch a sub experiment on a remote host |
static void |
main(java.lang.String[] args)
Configures/Runs the Experiment from the command line. |
void |
nextIteration()
Overides the one in Experiment |
private void |
notifyListeners(boolean status,
boolean log,
boolean finished,
java.lang.String message)
Inform all listeners of progress |
private java.lang.String |
postExperimentInfo()
Returns some post experiment information. |
void |
postProcess()
overides the one in Experiment |
void |
runExperiment()
Overides runExperiment in Experiment |
void |
setBaseExperiment(Experiment base)
Set the base experiment. |
void |
setDatasets(javax.swing.DefaultListModel ds)
Set the datasets to use in the experiment |
void |
setNotes(java.lang.String newNotes)
Set the user notes. |
void |
setPropertyArray(java.lang.Object newPropArray)
Sets the array of values to set the custom property to. |
void |
setPropertyPath(PropertyNode[] newPropertyPath)
Sets the path of properties taken to get to the custom property to iterate over. |
void |
setResultListener(ResultListener newResultListener)
Sets the result listener where results will be sent. |
void |
setResultProducer(ResultProducer newResultProducer)
Set the result producer used for the current experiment. |
void |
setRunLower(int newRunLower)
Set the lower run number for the experiment. |
void |
setRunUpper(int newRunUpper)
Set the upper run number for the experiment. |
void |
setSplitByDataSet(boolean sd)
Set whether sub experiments are to be created on the basis of data set. |
void |
setUsePropertyIterator(boolean newUsePropertyIterator)
Sets whether the custom property iterator should be used. |
java.lang.String |
toString()
Overides toString in Experiment |
protected void |
waitingExperiment(int expNum)
Push an experiment back on the queue of waiting experiments |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private FastVector m_listeners
protected javax.swing.DefaultListModel m_remoteHosts
private Queue m_remoteHostsQueue
private int[] m_remoteHostsStatus
private int[] m_remoteHostFailureCounts
protected static final int AVAILABLE
protected static final int IN_USE
protected static final int CONNECTION_FAILED
protected static final int SOME_OTHER_FAILURE
protected static final int MAX_FAILURES
private boolean m_experimentAborted
private int m_removedHosts
private int m_failedCount
private int m_finishedCount
private Experiment m_baseExperiment
protected Experiment[] m_subExperiments
private Queue m_subExpQueue
protected int[] m_subExpComplete
protected boolean m_splitByDataSet
Constructor Detail |
public RemoteExperiment(Experiment base) throws java.lang.Exception
base
- the base experiment to use
java.lang.Exception
- if the base experiment is nullMethod Detail |
public boolean getSplitByDataSet()
boolean
value indicating whether sub
experiments are to be created on the basis of data set (true) or
run number (false).public void setSplitByDataSet(boolean sd)
sd
- true if sub experiments are to be created on the basis
of data set. Otherwise sub experiments are created on the basis of
run number.public void addRemoteExperimentListener(RemoteExperimentListener r)
r
- a listenerpublic Experiment getBaseExperiment()
public void setBaseExperiment(Experiment base) throws java.lang.Exception
base
- the base experiment to use.
java.lang.Exception
- if supplied base experiment is nullpublic void setNotes(java.lang.String newNotes)
setNotes
in class Experiment
newNotes
- New user notes.public void setRunLower(int newRunLower)
setRunLower
in class Experiment
newRunLower
- the lower run number for the experiment.public void setRunUpper(int newRunUpper)
setRunUpper
in class Experiment
newRunUpper
- the upper run number for the experiment.public void setResultListener(ResultListener newResultListener)
setResultListener
in class Experiment
newResultListener
- the result listener where results will be sent.public void setResultProducer(ResultProducer newResultProducer)
setResultProducer
in class Experiment
newResultProducer
- result producer to use for the current
experiment.public void setDatasets(javax.swing.DefaultListModel ds)
setDatasets
in class Experiment
ds
- the list of datasets to usepublic void setUsePropertyIterator(boolean newUsePropertyIterator)
setUsePropertyIterator
in class Experiment
newUsePropertyIterator
- true if sopublic void setPropertyPath(PropertyNode[] newPropertyPath)
setPropertyPath
in class Experiment
newPropertyPath
- an array of PropertyNodespublic void setPropertyArray(java.lang.Object newPropArray)
setPropertyArray
in class Experiment
newPropArray
- a value of type Object which should be an
array of the appropriate values.public void initialize() throws java.lang.Exception
initialize
in class Experiment
java.lang.Exception
- if an error occursprivate void notifyListeners(boolean status, boolean log, boolean finished, java.lang.String message)
status
- true if this is a status type of messagelog
- true if this is a log type of messagefinished
- true if the remote experiment has finishedmessage
- the message.public void abortExperiment()
protected void incrementFinished()
protected void incrementFailed(int hostNum)
hostNum
- the index of the host to increment failure countprotected void waitingExperiment(int expNum)
expNum
- the index of the experiment to push onto the queueprivate boolean checkForAllFailedHosts()
private java.lang.String postExperimentInfo()
protected void availableHost(int hostNum)
hostNum
- the index of the host to push back onto the queue of
available hostspublic void launchNext(int wexp, int ah)
wexp
- the index of the sub experiment to launchah
- the index of the available host to launch onpublic void nextIteration() throws java.lang.Exception
nextIteration
in class Experiment
java.lang.Exception
public void advanceCounters()
advanceCounters
in class Experiment
public void postProcess()
postProcess
in class Experiment
public void addRemoteHost(java.lang.String hostname)
hostname
- the host name to add to the listpublic javax.swing.DefaultListModel getRemoteHosts()
public java.lang.String toString()
toString
in class Experiment
public void runExperiment()
runExperiment
in class Experiment
public static void main(java.lang.String[] args)
args
- command line arguments to the Experiment.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |