conv

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package conv provides functions for converting between various data types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClassesToIndices

func ClassesToIndices[T comparable](classes []T, noData T) (columns []T, indices []int)

ClassesToIndices converts a slice of class labels to a slice of class indices and a slice of unique class labels.

func ClassesToTable

func ClassesToTable[T comparable](classes []T, columns []T, noData T) (*table.Table, error)

ClassesToTable creates a table.Table from a slice of class labels. If the columns parameter is empty, the table will have a column for each unique class label. If the columns parameter is provided, the table will have a column for each provided class label, and an error will be returned if any duplicate class labels are found.

func LayerToClasses

func LayerToClasses(l *layer.Layer) ([]string, []int)

LayerToClasses converts a layer.Layer into a slice of class labels and a slice of class indices. For each node in the layer, the function finds the column with the maximum value and returns the index of that column as the class label. The function returns two slices: the first slice contains the column names (class labels), and the second slice contains the class indices for each node.

func TableToClasses

func TableToClasses(table *table.Table) ([]string, []int)

TableToClasses converts a table.Table into a slice of class labels and a slice of class indices. For each row in the table, the function finds the column with the maximum value and returns the index of that column as the class label. The function returns two slices: the first slice contains the column names (class labels), and the second slice contains the class indices for each row.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL