Package weka.core.json
Class JSONInstances
- java.lang.Object
-
- weka.core.json.JSONInstances
-
public class JSONInstances extends java.lang.ObjectClass 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:
MISSING_VALUE
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringATTRIBUTESthe attributes object.static java.lang.StringCLASSthe class attribute indicator.static java.lang.StringDATAthe data section.static java.lang.StringDATEFORMATthe dateformat attribute.static java.lang.StringHEADERthe header section.static java.lang.StringLABELSthe labels attribute.static java.lang.StringMISSING_VALUEthe missing value indicator.static java.lang.StringNAMEthe name attribute.static java.lang.StringRELATIONthe relation name.static java.lang.StringSPARSEthe sparse attribute.static java.lang.StringSPARSE_SEPARATORthe separator for index/value in case of sparse instances.static java.lang.StringTYPEthe type attribute.static java.lang.StringVALUESthe values attribute.static java.lang.StringWEIGHTthe weight attribute.
-
Constructor Summary
Constructors Constructor Description JSONInstances()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidmain(java.lang.String[] args)For testing only.static InstancestoHeader(JSONNode json)Turns a JSON object, if possible, into an Instances object (only header).static InstancestoInstances(JSONNode json)Turns a JSON object, if possible, into an Instances object.static JSONNodetoJSON(Instances inst)Turns the Instances object into a JSON object.
-
-
-
Field Detail
-
HEADER
public static final java.lang.String HEADER
the header section.- See Also:
- Constant Field Values
-
DATA
public static final java.lang.String DATA
the data section.- See Also:
- Constant Field Values
-
RELATION
public static final java.lang.String RELATION
the relation name.- See Also:
- Constant Field Values
-
ATTRIBUTES
public static final java.lang.String ATTRIBUTES
the attributes object.- See Also:
- Constant Field Values
-
NAME
public static final java.lang.String NAME
the name attribute.- See Also:
- Constant Field Values
-
TYPE
public static final java.lang.String TYPE
the type attribute.- See Also:
- Constant Field Values
-
CLASS
public static final java.lang.String CLASS
the class attribute indicator.- See Also:
- Constant Field Values
-
LABELS
public static final java.lang.String LABELS
the labels attribute.- See Also:
- Constant Field Values
-
WEIGHT
public static final java.lang.String WEIGHT
the weight attribute.- See Also:
- Constant Field Values
-
DATEFORMAT
public static final java.lang.String DATEFORMAT
the dateformat attribute.- See Also:
- Constant Field Values
-
SPARSE
public static final java.lang.String SPARSE
the sparse attribute.- See Also:
- Constant Field Values
-
VALUES
public static final java.lang.String VALUES
the values attribute.- See Also:
- Constant Field Values
-
SPARSE_SEPARATOR
public static final java.lang.String SPARSE_SEPARATOR
the separator for index/value in case of sparse instances.- See Also:
- Constant Field Values
-
MISSING_VALUE
public static final java.lang.String MISSING_VALUE
the missing value indicator.- See Also:
- Constant Field Values
-
-
Method Detail
-
toInstances
public static Instances toInstances(JSONNode json)
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
public static Instances toHeader(JSONNode json)
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
public static JSONNode toJSON(Instances inst)
Turns the Instances object into a JSON object.- Parameters:
inst- the Instances to turn into a JSON object- Returns:
- the JSON object
-
main
public static void main(java.lang.String[] args) throws java.lang.ExceptionFor testing only.- Parameters:
args- expects a dataset as first parameter- Throws:
java.lang.Exception- if something goes wrong
-
-