object Codec
The constructors of a codec.
One hot encoding is a process that turns discrete attributes into a list of 0.0 and 1.0. Minmax normalization scales continuous attributes into values between 0.0 and 1.0.
A codec can encode and decode every data point.
There are two ways to create a codec:
- By providing a list of pairs that define the name and the type of each attribute:
val codec = Codec(
List( ("petal_length", false),
("species", true) ),
Iterator(Map("petal_length" -> "1.5",
"species" -> "setosa"),
Map("petal_length" -> "3.8",
"species" -> "versicolor"))
)
- By providing its JSON representation.
val codec = Codec(
"""[{"Case":"SerializableContinuous",
"Fields":[{"key":"petal_length","min":1.5,"max":3.8}]},
{"Case":"SerializableDiscrete",
"Fields":[{"key":"species","values":["setosa","versicolor"]}]}]"""
)
- Companion
- class
trait Product
trait Mirror
class Object
trait Matchable
class Any
Type members
Value members
Concrete methods
def apply(attributesWithFlag: List[(String, Boolean)], datapoints: Iterator[Map[String, String]]): Codec
Creates a codec by consuming an iterator of data points.
Creates a codec by consuming an iterator of data points.
- Value Params
- attributesWithFlag
A list of pairs that define the name and the type (discrete or not) of each attribute.
- datapoints
An iterator that contains the data points.
- Returns
A codec that can encode and decode every data point.