Package weka.djl
Class InstancesDataset
- java.lang.Object
-
- ai.djl.training.dataset.RandomAccessDataset
-
- ai.djl.basicdataset.tabular.TabularDataset
-
- weka.djl.InstancesDataset
-
- All Implemented Interfaces:
ai.djl.training.dataset.Dataset
public class InstancesDataset extends ai.djl.basicdataset.tabular.TabularDataset
InstancesDataset
represents the dataset that is stored in an .arff[.gz] file. Only supports NUMERIC, NOMINAL, STRING and DATE attributes. By default, DATE and STRING attributes get ignored. DATE attributes can be treated as NUMERIC ones: get parsed and the epoch time is stored as NUMERIC string. STRING attributes can be treated as NOMINAL ones. Ignored columns, explicit or via regexps, should be set first.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
InstancesDataset.InstancesBuilder<T extends InstancesDataset.InstancesBuilder<T>>
Used to build aInstancesDataset
.
-
Constructor Summary
Constructors Modifier Constructor Description protected
InstancesDataset(InstancesDataset.InstancesBuilder<?> builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected long
availableSize()
static InstancesDataset.InstancesBuilder<?>
builder()
Creates a builder to build aInstancesDataset
.String
getCell(long rowIndex, String featureName)
weka.core.Instances
getData()
Returns the underlying data.void
prepare(ai.djl.util.Progress progress)
String
toInfo()
Generates a string with information about the features/labels.com.google.gson.JsonObject
toJson()
Returns the feature/labels as json.void
toJson(Path filename)
Writes the features/labels JSON representation to the specified path.-
Methods inherited from class ai.djl.basicdataset.tabular.TabularDataset
get, getFeatures, getFeatureSize, getLabels, getLabelSize, getRowDirect, getRowFeatures, matchingTranslatorOptions, prepareFeaturizers
-
Methods inherited from class ai.djl.training.dataset.RandomAccessDataset
getData, getData, getData, getData, newSubDataset, newSubDataset, randomSplit, size, subDataset, subDataset, subDataset, subDataset, toArray
-
-
-
-
Constructor Detail
-
InstancesDataset
protected InstancesDataset(InstancesDataset.InstancesBuilder<?> builder)
-
-
Method Detail
-
getCell
public String getCell(long rowIndex, String featureName)
- Specified by:
getCell
in classai.djl.basicdataset.tabular.TabularDataset
-
availableSize
protected long availableSize()
- Specified by:
availableSize
in classai.djl.training.dataset.RandomAccessDataset
-
prepare
public void prepare(ai.djl.util.Progress progress) throws IOException
- Throws:
IOException
-
builder
public static InstancesDataset.InstancesBuilder<?> builder()
Creates a builder to build aInstancesDataset
.- Returns:
- a new builder
-
getData
public weka.core.Instances getData()
Returns the underlying data.- Returns:
- the wrapped data
-
toInfo
public String toInfo()
Generates a string with information about the features/labels.- Returns:
- the info
-
toJson
public com.google.gson.JsonObject toJson()
Returns the feature/labels as json.- Returns:
- the generated json
-
toJson
public void toJson(Path filename) throws IOException
Writes the features/labels JSON representation to the specified path.- Parameters:
filename
- the file to write the representation to- Throws:
IOException
- if writing fails
-
-