Package adams.ml.data
Class WekaConverter
- java.lang.Object
-
- adams.ml.data.WekaConverter
-
public class WekaConverter extends Object
Helper class for converting data to and fro Weka.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Constructor Summary
Constructors Constructor Description WekaConverter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static adams.ml.capabilities.Capabilities
convertCapabilities(weka.core.Capabilities caps)
Converts Weka capabilities into ADAMS ones.static adams.ml.data.Dataset
toDataset(weka.core.Instances data)
Converts a Weka Instances object into an ADAMS Dataset.static weka.core.Instance
toInstance(weka.core.Instances data, adams.data.spreadsheet.Row row)
Turns an ADAMS dataset row into a Weka Instance.static weka.core.Instances
toInstances(adams.ml.data.Dataset data)
Converts an ADAMS Dataset to Weka Instances.protected static void
transferCapability(weka.core.Capabilities fromCaps, weka.core.Capabilities.Capability fromCap, adams.ml.capabilities.Capabilities toCaps, adams.ml.capabilities.Capability toCap)
Transfers the specified capability if enabled.
-
-
-
Method Detail
-
toInstances
public static weka.core.Instances toInstances(adams.ml.data.Dataset data) throws Exception
Converts an ADAMS Dataset to Weka Instances. Only sets the class attribute if the dataset has exactly one defined.- Parameters:
data
- the data to convert- Returns:
- the generated data
- Throws:
Exception
- if conversion fails
-
toDataset
public static adams.ml.data.Dataset toDataset(weka.core.Instances data) throws Exception
Converts a Weka Instances object into an ADAMS Dataset.- Parameters:
data
- the data to convert- Returns:
- the generated data
- Throws:
Exception
- if conversion fail
-
toInstance
public static weka.core.Instance toInstance(weka.core.Instances data, adams.data.spreadsheet.Row row) throws Exception
Turns an ADAMS dataset row into a Weka Instance.- Parameters:
data
- the dataset to use as templaterow
- the row to convert- Returns:
- the generated instance
- Throws:
Exception
- if conversion fails
-
transferCapability
protected static void transferCapability(weka.core.Capabilities fromCaps, weka.core.Capabilities.Capability fromCap, adams.ml.capabilities.Capabilities toCaps, adams.ml.capabilities.Capability toCap)
Transfers the specified capability if enabled. Also checks whether dependency is flagged.- Parameters:
fromCaps
- the Weka capabilitiesfromCap
- the Weka capability to checktoCaps
- the ADAMS capabilitiestoCap
- the ADAMS capability to set, if necessary
-
convertCapabilities
public static adams.ml.capabilities.Capabilities convertCapabilities(weka.core.Capabilities caps)
Converts Weka capabilities into ADAMS ones.- Parameters:
caps
- the capabilities to convert- Returns:
- the converted capabilities
-
-