Package weka.core.json
Class JSONInstances
java.lang.Object
weka.core.json.JSONInstances
Class for transforming Instances objects into JSON
objects and vice versa. Missing values get stored as "?".
- Version:
- $Revision: 9664 $
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
the attributes object.static final String
the class attribute indicator.static final String
the data section.static final String
the dateformat attribute.static final String
the header section.static final String
the labels attribute.static final String
the missing value indicator.static final String
the name attribute.static final String
the relation name.static final String
the sparse attribute.static final String
the separator for index/value in case of sparse instances.static final String
the type attribute.static final String
the values attribute.static final String
the weight attribute. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
For testing only.static Instances
Turns a JSON object, if possible, into an Instances object (only header).static Instances
toInstances
(JSONNode json) Turns a JSON object, if possible, into an Instances object.static JSONNode
Turns the Instances object into a JSON object.
-
Field Details
-
HEADER
the header section.- See Also:
-
DATA
the data section.- See Also:
-
RELATION
the relation name.- See Also:
-
ATTRIBUTES
the attributes object.- See Also:
-
NAME
the name attribute.- See Also:
-
TYPE
the type attribute.- See Also:
-
CLASS
the class attribute indicator.- See Also:
-
LABELS
the labels attribute.- See Also:
-
WEIGHT
the weight attribute.- See Also:
-
DATEFORMAT
the dateformat attribute.- See Also:
-
SPARSE
the sparse attribute.- See Also:
-
VALUES
the values attribute.- See Also:
-
SPARSE_SEPARATOR
the separator for index/value in case of sparse instances.- See Also:
-
MISSING_VALUE
the missing value indicator.- See Also:
-
-
Constructor Details
-
JSONInstances
public JSONInstances()
-
-
Method Details
-
toInstances
Turns a JSON object, if possible, into an Instances object.- Parameters:
json
- the JSON object to convert- Returns:
- the generated Instances object, null if not possible
-
toHeader
Turns a JSON object, if possible, into an Instances object (only header).- Parameters:
json
- the JSON object to convert- Returns:
- the generated Instances header object, null if not possible
-
toJSON
Turns the Instances object into a JSON object.- Parameters:
inst
- the Instances to turn into a JSON object- Returns:
- the JSON object
-
main
For testing only.- Parameters:
args
- expects a dataset as first parameter- Throws:
Exception
- if something goes wrong
-