mlrl.testbed.label_vectors module

Author: Michael Rapp (michael.rapp.ml@gmail.com)

Provides classes for printing unique label vectors that are contained in a data set. The label vectors can be written to one or several outputs, e.g., to the console or to a file.

class mlrl.testbed.label_vectors.LabelVectorSetWriter(sinks: List[Sink])

Bases: LabelVectorWriter

Allows to write unique label vectors that are stored as part of a model learned by a rule learning algorithm to one or several sinks.

class Visitor(num_labels: int)

Bases: LabelVectorSetVisitor

Allows to access the label vectors and frequencies store by a LabelVectorSet.

visit_label_vector(label_vector: ndarray, frequency: int)

See mlrl.common.cython.label_space_info.LabelVectorSetVisitor.visit_label_vector()

class mlrl.testbed.label_vectors.LabelVectorWriter(sinks: List[Sink])

Bases: OutputWriter

Allows to write unique label vectors that are contained in a data set to one or severals sinks.

class CsvSink(output_dir: str, options: ~mlrl.common.options.Options = <mlrl.common.options.Options object>)

Bases: CsvSink

Allows to write unique label vectors that are contained in a data set to a CSV file.

class LabelVectors(num_labels: int, y=None)

Bases: Formattable, Tabularizable

Stores unique label vectors that are contained in a data set.

COLUMN_FREQUENCY = 'Frequency'
COLUMN_INDEX = 'Index'
COLUMN_LABEL_VECTOR = 'Label vector'
format(options: Options, **_) str

See mlrl.testbed.output_writer.Formattable.format()

tabularize(options: Options, **_) List[Dict[str, str]] | None

See mlrl.testbed.output_writer.Tabularizable.tabularize()

class LogSink(options: ~mlrl.common.options.Options = <mlrl.common.options.Options object>)

Bases: LogSink

Allows to write unique label vectors that are contained in a data set to the console.