public class AmesRandomAccess
extends ai.djl.training.dataset.RandomAccessDataset
80 features
Training Set: 1460 Records
Test Set: 1459 Records
Can enable/disable features Set one hot vector for categorical variables
| Modifier and Type | Class and Description |
|---|---|
static class |
AmesRandomAccess.Builder
A builder to construct a
AmesRandomAccess. |
static class |
AmesRandomAccess.FeatureType
An enum represent data type of feature.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAllFeatures()
Move all non set features to be used.
|
void |
addFeature(java.lang.String feature)
Adds a feature if it exists.
|
void |
addFeature(java.lang.String feature,
AmesRandomAccess.FeatureType type)
Adds a feature of the given type to the used features set.
|
protected long |
availableSize() |
static AmesRandomAccess.Builder |
builder()
Creates a builder to build a
AmesRandomAccess. |
ai.djl.training.dataset.Record |
get(ai.djl.ndarray.NDManager manager,
long index) |
java.util.Set<java.lang.String> |
getCategoricalFeatures()
Get categorical feature set.
|
org.apache.commons.csv.CSVRecord |
getCSVRecord(int index)
Returns the CSVRecord for a given index.
|
java.util.Set<java.lang.String> |
getDisabledFeatures()
Get disabled feature set.
|
java.util.Set<java.lang.String> |
getEnabledFeatures()
Get enabled feature set.
|
int |
getFeatureArraySize()
Returns the size of the feature array(column count).
|
ai.djl.ndarray.NDArray |
getFeatureNDArray(ai.djl.ndarray.NDManager manager,
int index)
Return the NDArray at index 'index' with the set features.
|
AmesRandomAccess.FeatureType |
getFeatureType(java.lang.String feature)
Returns the feature type.
|
float[] |
getLabel(int index)
Returns the label value for a given index.
|
float[] |
getValueFloat(org.apache.commons.csv.CSVRecord record,
java.lang.String feature)
Returns the float value of the record's feature Changes based on categorical or numeric and
for categorical if 1 hot encode is enabled.
|
void |
prepare(ai.djl.util.Progress progress) |
void |
removeAllFeatures()
Move all currently set features to available.
|
void |
removeFeature(java.lang.String feature)
Removes a feature from the active set if it exists.
|
void |
setFeatureType(java.lang.String feature,
AmesRandomAccess.FeatureType type)
Sets a feature's type.
|
void |
setLabel(java.lang.String feature)
Sets the label(y).
|
void |
setOneHotEncode(java.lang.String feature,
boolean enable)
Sets a feature's oneHotEncode status if it is categorical.
|
getData, getData, randomSplit, sizepublic static AmesRandomAccess.Builder builder()
AmesRandomAccess.public void setLabel(java.lang.String feature)
feature - feature to set as the labelpublic java.util.Set<java.lang.String> getEnabledFeatures()
public java.util.Set<java.lang.String> getDisabledFeatures()
public java.util.Set<java.lang.String> getCategoricalFeatures()
public float[] getLabel(int index)
index - label indexpublic ai.djl.training.dataset.Record get(ai.djl.ndarray.NDManager manager,
long index)
get in class ai.djl.training.dataset.RandomAccessDatasetpublic org.apache.commons.csv.CSVRecord getCSVRecord(int index)
index - index of recordpublic void setOneHotEncode(java.lang.String feature,
boolean enable)
feature - feature to be one hot encodedenable - Enable/Disable oneHotEncodingpublic float[] getValueFloat(org.apache.commons.csv.CSVRecord record,
java.lang.String feature)
record - The CSVRecord to get the feature fromfeature - The feature value to be acquiredpublic int getFeatureArraySize()
public ai.djl.ndarray.NDArray getFeatureNDArray(ai.djl.ndarray.NDManager manager,
int index)
manager - NDManager to maintain created NDArrayindex - Index of wanted NDArraypublic void removeAllFeatures()
public void addAllFeatures()
public void addFeature(java.lang.String feature,
AmesRandomAccess.FeatureType type)
feature - feature to be addedtype - type of featurepublic void addFeature(java.lang.String feature)
feature - feature to be enabledpublic void setFeatureType(java.lang.String feature,
AmesRandomAccess.FeatureType type)
feature - feature whose type is to be chagnedtype - type for feature to be set topublic void removeFeature(java.lang.String feature)
feature - feature to be disabledpublic AmesRandomAccess.FeatureType getFeatureType(java.lang.String feature)
feature - feature whose type we will getpublic void prepare(ai.djl.util.Progress progress)
throws java.io.IOException
java.io.IOExceptionprotected long availableSize()
availableSize in class ai.djl.training.dataset.RandomAccessDataset