Codec

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:

  1. 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"))
)
  1. 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

Inherited types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Inherited from
Mirror
type MirroredLabel <: String

The name of the type

The name of the type

Inherited from
Mirror

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.

def apply(json: String): Codec

Parses a codec.

Parses a codec.

Value Params
json

The JSON representation of a codec.

Returns

A codec that can encode and decode every data point.