Documentation ¶
Overview ¶
Package tables implements immutable tables abstraction
Index ¶
- type AnyData
- type Batch
- type Column
- func (c *Column) Bool(row int) bool
- func (c *Column) Bools() []bool
- func (c *Column) ExtractAs(tp reflect.Type, nocopy ...bool) interface{}
- func (c *Column) Float(row int) float64
- func (c *Column) Floats() []float64
- func (c *Column) Index(i int) fu.Cell
- func (c *Column) Inspect() interface{}
- func (c *Column) Int(row int) int
- func (c *Column) Int16(row int) int16
- func (c *Column) Int32(row int) int32
- func (c *Column) Int64(row int) int64
- func (c *Column) Int8(row int) int8
- func (c *Column) Interface(row int) interface{}
- func (c *Column) Ints() []int
- func (c *Column) Ints16() []int16
- func (c *Column) Ints32() []int32
- func (c *Column) Ints64() []int64
- func (c *Column) Ints8() []int8
- func (c *Column) IsFloat() bool
- func (c *Column) Len() int
- func (c *Column) Matrix(docopy ...bool) [][]float32
- func (c *Column) Max() fu.Cell
- func (c *Column) MaxIndex() int
- func (c *Column) Min() fu.Cell
- func (c *Column) MinIndex() int
- func (c *Column) Na(i int) bool
- func (c *Column) Raw() (reflect.Value, fu.Bits)
- func (c *Column) Real(row int) float32
- func (c *Column) Reals() []float32
- func (c *Column) Strings() []string
- func (c *Column) Table(n string) *Table
- func (c *Column) Tensor(row int) fu.Tensor
- func (c *Column) Text(row int) string
- func (c *Column) Type() reflect.Type
- func (c *Column) Uint(row int) uint
- func (c *Column) Uint16(row int) uint16
- func (c *Column) Uint32(row int) uint32
- func (c *Column) Uint64(row int) uint64
- func (c *Column) Uint8(row int) uint8
- func (c *Column) Uints() []uint
- func (c *Column) Uints16() []uint16
- func (c *Column) Uints32() []uint32
- func (c *Column) Uints64() []uint64
- func (c *Column) Uints8() []uint8
- func (c *Column) Unique() *Column
- func (c *Column) Value(i int) reflect.Value
- type Enum
- type Enumerator
- type Enumset
- type FeaturesMapper
- type Float32Enumerator
- type IntegerEnumerator
- type LambdaMapper
- type Lazy
- func (zf Lazy) Alias(c string, a string) Lazy
- func (zf Lazy) Batch(length int) Batch
- func (zf Lazy) BatchReduce(batch int, tf func(*Table) (fu.Struct, bool, error)) Lazy
- func (zf Lazy) BatchTransform(batch int, tf func(int) (FeaturesMapper, error)) Lazy
- func (zf Lazy) Chain(zx Lazy) Lazy
- func (zf Lazy) Collect() (t *Table, err error)
- func (zf Lazy) Count() (int, error)
- func (zf Lazy) Drain(sink Sink) (err error)
- func (zf Lazy) False(c string) Lazy
- func (zf Lazy) Filter(f interface{}) Lazy
- func (zf Lazy) First(n int) Lazy
- func (zf Lazy) Foreach(f func(fu.Struct) error) (err error)
- func (zf Lazy) IfEq(c string, v ...interface{}) Lazy
- func (zf Lazy) IfFlag(c string) Lazy
- func (zf Lazy) IfGt(c string, v interface{}) Lazy
- func (zf Lazy) IfLt(c string, v interface{}) Lazy
- func (zf Lazy) IfNe(c string, v interface{}) Lazy
- func (zf Lazy) IfNotFlag(c string) Lazy
- func (Lazy) IsLazy() bool
- func (zf Lazy) Kfold(seed int, kfold int, k int, name string) Lazy
- func (zf Lazy) Lazy() Lazy
- func (zf Lazy) LuckyCollect() *Table
- func (zf Lazy) LuckyCount() int
- func (zf Lazy) LuckyDrain(sink Sink)
- func (zf Lazy) LuckyReals() []float32
- func (zf Lazy) Map(f interface{}) Lazy
- func (zf Lazy) Only(c ...string) Lazy
- func (zf Lazy) Parallel(concurrency ...int) Lazy
- func (zf Lazy) Rand(seed int, prob float64) Lazy
- func (zf Lazy) RandSkip(seed int, prob float64) Lazy
- func (zf Lazy) RandomFlag(c string, seed int, prob float64) Lazy
- func (zf Lazy) Reals() ([]float32, error)
- func (zf Lazy) Round(prec int) Lazy
- func (zf Lazy) Table() *Table
- func (zf Lazy) Transform(f func(fu.Struct) (fu.Struct, bool, error)) Lazy
- func (zf Lazy) True(c string) Lazy
- func (zf Lazy) TrueIfEq(c string, v interface{}, flag string) Lazy
- func (zf Lazy) TrueIfNe(c string, v interface{}, flag string) Lazy
- func (zf Lazy) UnpackTensor(c string) Lazy
- func (zf Lazy) Update(f interface{}) Lazy
- type Matrix
- type Meta
- type Raw
- type Sink
- type Table
- func (t *Table) Append(o interface{}) *Table
- func (t *Table) Col(c string) *Column
- func (t *Table) ColIfExists(c string) (*Column, bool)
- func (t *Table) Collect() (*Table, error)
- func (t *Table) Concat(a *Table) *Table
- func (t *Table) Display(from, to int) string
- func (t *Table) DropNa(names ...string) *Table
- func (t *Table) Except(column ...string) *Table
- func (t *Table) Fetch(i int, r interface{})
- func (t *Table) FillNa(r interface{}) *Table
- func (t *Table) FillRow(i int, tp reflect.Type, p reflect.Value)
- func (t *Table) FilteredLen(f func(int) bool) int
- func (t *Table) GetRow(i int, tp reflect.Type) reflect.Value
- func (t *Table) Head(n int) string
- func (t *Table) Index(r int) fu.Struct
- func (*Table) IsLazy() bool
- func (t *Table) Last(n ...int) fu.Struct
- func (t *Table) Lazy() Lazy
- func (t *Table) Len() int
- func (t *Table) List(f interface{})
- func (t *Table) Matrix(features []string, least ...int) (m Matrix, err error)
- func (t *Table) MatrixIf(features []string, ifName string, ifValue interface{}) (m0, m1 Matrix, err error)
- func (t *Table) MatrixWithLabel(features []string, label string, least ...int) (m Matrix, err error)
- func (t *Table) MatrixWithLabelIf(features []string, label string, ifName string, ifValue interface{}, ...) (test, train Matrix, err error)
- func (t *Table) Names() []string
- func (t *Table) Only(column ...string) *Table
- func (t *Table) OnlyNames(column ...string) []string
- func (t *Table) Raw() Raw
- func (t *Table) Round(prec int) *Table
- func (t *Table) Row(row int) map[string]reflect.Value
- func (t *Table) Set(c string, value interface{}) *Table
- func (t *Table) Shuffle() *Table
- func (t *Table) Slice(slice ...int) *Table
- func (t *Table) Sort(opt interface{}) *Table
- func (t *Table) String() string
- func (t *Table) Table() *Table
- func (t *Table) Tail(n int) string
- func (t *Table) With(column *Column, name string) *Table
- func (t *Table) Without(name string) *Table
- type TextEnumerator
- type Xtensor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnyData ¶
type AnyData interface { // IsLazy specifies is it lazy datasource or a table IsLazy() bool // Use it as lazy datasource Lazy() Lazy // Use it as a table, if it's really lazy and collect returns an error panic will occur Table() *Table // Use it as a table, if it's a lazy data source it will be collected to a table Collect() (*Table, error) }
AnyData represents both tables and lazy-streams as common data source type. Any one of them can be used as Table or Lazy stream via this interface. Although, if it's matter, user can decided to use real form of the data by IsLazy selector.
type Batch ¶
Batch is batching abstraction to process lazy streams
func (Batch) Reduce ¶
Reduce batches to values
type Column ¶
type Column struct {
// contains filtered or unexported fields
}
func (*Column) Bool ¶
Bool returns column' value converted to bool
func (*Column) ExtractAs ¶
ExtractAs extracts values as array with specified type
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Age").ExtractAs(reflect.TypeOf("")).([]string)[0] -> "32" t.Col("Rate").ExtractAs(reflect.TypeOf(int(0))).([]int)[0] -> 1
func (*Column) Float ¶
Float returns column' value converted to float64
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Rate").Float(0) -> 1.2
func (*Column) Floats ¶
Floats extracts column' values as []float64
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Rate").Floats() -> {1.2,1.5}
func (*Column) Index ¶
Index returns cell with value at specified index
t := tables.New([]struct{Age int}{{"33"}}) c := t.Col("Age").Index(0) c.String() -> "33" c.Float32() -> 33.0 c.TzeInt() -> 33
func (*Column) Inspect ¶
func (c *Column) Inspect() interface{}
Inspect returns raw array of column's values
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Name").Inspect().([]string)[0] -> "Ivanov" t.Col("Age").Inspect().([]int)[0] -> 32 t.Col("Rate").Inspect().([]float32)[0] -> 1.2
func (*Column) Int ¶
TzeInt returns column' value converted to int
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Age").TzeInt(0) -> 32 t.Col("Age").Index(0).TzeInt() -> 32
func (*Column) Int16 ¶
Int16 returns column' value converted to int16
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Age").Int16(0) -> 32 t.Col("Age").Index().Int16() -> 32
func (*Column) Int32 ¶
Int32 returns column' value converted to int32
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Age").Int32(0) -> 32 t.Col("Age").Index(0).Int32() -> 32
func (*Column) Int64 ¶
Int64 returns column' value converted to int64
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Age").Int64(0) -> 32 t.Col("Age").Index(0).Int64() -> 32
func (*Column) Int8 ¶
Int8 returns column' value converted to int8
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Age").Int8(0) -> 32 t.Col("Age").Index().Int8() -> 32
func (*Column) Interface ¶
Interface returns column' value as is
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Rate").Interface(0).(float32) -> 1.2 t.Col("Rate").Index(0).Interface().(float32) -> 1.2
func (*Column) Ints ¶
Ints extracts column' values as []int
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Age").Ints() -> {32,44}
func (*Column) Ints16 ¶
Ints16 extracts column' values as []int16
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Age").Ints16() -> {32,44}
func (*Column) Ints32 ¶
Ints32 extracts column' values as []int32
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Age").Ints32() -> {32,44}
func (*Column) Ints64 ¶
Ints64 extracts column' values as []int64
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Age").Ints64() -> {32,44}
func (*Column) Ints8 ¶
Ints8 extracts column' values as []int8
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Age").Ints8() -> {32,44}
func (*Column) Len ¶
Len returns length of column
t := tables.New([]struct{Name string}{{"Ivanov"}}) c1 := t.Col("Name") t.Append([]struct{Name string}{{"Petrov"}}) c2 := t.Col("Name") c1.Len() -> 1 c2.Len() -> 2
func (*Column) Max ¶
Max returns cell with max column' maximal value
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Age").Max().TzeInt() -> 44 t.Col("Rate").Max().Float32() -> 1.5
func (*Column) MaxIndex ¶
MaxIndex returns index of first column' maximal value
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Age").MaxIndex() -> 1
func (*Column) Min ¶
Min returns cell with column' minimal value
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Age").Min().TzeInt() -> 32 t.Col("Rate").Min().Float32() -> 1.2
func (*Column) MinIndex ¶
MinIndex returns index of first column' minimal value
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Age").MinIndex() -> 0
func (*Column) Real ¶
Float32 returns column' value converted to float32
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Rate").Float32(0) -> 1.2
func (*Column) Reals ¶
Reals extracts column' values as []float32
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Rate").Reals() -> {1.2,1.5}
func (*Column) Strings ¶
Strings extracts column' values as []string
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Name").Strings() -> {"Ivanov","Petrow"}
func (*Column) Tensor ¶
Tensor returns column' values as Tensor if it's a Tensor
func (*Column) Text ¶
Text returns column' value converted to string
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Name").Text(0) -> "Ivanov" t.Col("Name").Index(0).String() -> "Ivanov"
func (*Column) Type ¶
Type returns (reflect) type of column' values
func (*Column) Uint ¶
Uint returns column' value converted to uint
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Age").Uint(0) -> 32
func (*Column) Uint16 ¶
Uint16 returns column' value converted to uint16
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Age").Uint16(0) -> 32
func (*Column) Uint32 ¶
Uint32 returns column' value converted to uint32
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Age").Uint32(0) -> 32
func (*Column) Uint64 ¶
Uint64 returns column' value converted to uint64
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Age").Uint64(0) -> 32 t.Col("Age").Index(0).Uint64() -> 32
func (*Column) Uint8 ¶
Uint8 returns column' value converted to uint8
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Age").Uint8(0) -> 32
func (*Column) Uints ¶
Uints extracts column' values as []uint
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Age").Uints() -> {32,44}
func (*Column) Uints16 ¶
Uints16 extracts column' values as []uint16
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Age").Uints16() -> {32,44}
func (*Column) Uints32 ¶
Uints32 extracts column' values as []uint32
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Age").Uints32() -> {32,44}
func (*Column) Uints64 ¶
Uints64 extracts column' values as []uint64
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Age").Uints64() -> {32,44}
func (*Column) Uints8 ¶
Uints8 extracts column' values as []uint8
t := table.New([]struct{Name string; Age int; Rate float}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Col("Age").Uints8() -> {32,44}
func (*Column) Unique ¶
Unique returns column with only unique values
t := tables.New([]struct{Name string}{{"Ivanov"}}) u1 := t.Col("Name").Unique() t = t.Append([]struct{Name string}{{"Petrov"},{"Petrov"}}) u2 := t.Col("Name").Unique() u1.Unique().Inspect() -> {} u2.Unique().Len() -> 2
type Enum ¶
Enum encapsulate enumeration abstraction in relation to tables
type Enumerator ¶
type Enumerator struct {
// contains filtered or unexported fields
}
Enumerator the object enumerates enums in data stream
func (Enumerator) Convert ¶
type Enumset ¶
Enumset is a set of values belongs to one enumeration
func (Enumset) Enum ¶
Enum defines enumerated meta-column with the Enum tipe
func (Enumset) Float32 ¶
Enum defines enumerated meta-column with the float32 type
func (Enumset) Integer ¶
Enum defines enumerated meta-column with the int type
func (Enumset) Len ¶
Len returns length of enumset aka count of enum values
type FeaturesMapper ¶
type FeaturesMapper interface { // MapFeature returns new table with all original columns except features // adding one new column with prediction/calculation MapFeatures(*Table) (*Table, error) // Cloase releases all bounded resources Close() error }
FeaturesMapper interface is a features transformation abstraction
type Float32Enumerator ¶
type Float32Enumerator struct{ IntegerEnumerator }
func (Float32Enumerator) Convert ¶
func (Float32Enumerator) Type ¶
func (ce Float32Enumerator) Type() reflect.Type
type IntegerEnumerator ¶
type IntegerEnumerator struct { Enumerator // contains filtered or unexported fields }
func (IntegerEnumerator) Convert ¶
func (IntegerEnumerator) Format ¶
func (ce IntegerEnumerator) Format(x reflect.Value, na bool) string
func (IntegerEnumerator) Type ¶
func (ce IntegerEnumerator) Type() reflect.Type
type LambdaMapper ¶
func (LambdaMapper) Close ¶
func (LambdaMapper) Close() error
func (LambdaMapper) MapFeatures ¶
func (l LambdaMapper) MapFeatures(t *Table) (*Table, error)
type Lazy ¶
func (Lazy) Batch ¶
Batch transforms lazy stream to a batching flow
func (Lazy) BatchReduce ¶
func (Lazy) BatchTransform ¶
type Matrix ¶
type Matrix struct { Features []float32 Labels []float32 Width, Length int LabelsWidth int // 0 means no labels defined }
Matrix the presentation of features and labels as plane []float32 slices
func (Matrix) AsColumn ¶
AsColumn converts raw features representation into Column
func (Matrix) AsLabelColumn ¶
AsLabelColumn converts raw labels representation into Column
type Meta ¶
type Raw ¶
Raw is the row presentation of a table, can be accessed by the Table.Raw method
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table implements column based typed data structure Every values in a column has the same type.
func MakeTable ¶
MakeTable creates ne non-empty table
func New ¶
func New(o interface{}) *Table
New creates new Table object
from empty list of structs or empty struct tables.New([]struct{Name string; Age int; Rate float32}{}) for empty table.
from list of structs tables.New([]struct{Name string; Age int; Rate float32}{{"Ivanov",32,1.2},{"Petrov",44,1.5}})
from map tables.New(map[string]interface{}{"Name":[]string{"Ivanov","Petrov"},"Age":[]int{32,44},"Rate":[]float32{1.2,1.5}})
from channel of structs type R struct{Name string; Age int; Rate float32} c := make(chan R) go func(){ c <- R{"Ivanov",32,1.2} c <- R{"Petrov",44,1.5} close(c) }() tables.New(c)
func (*Table) Append ¶
Append adds data to table
t := tables.Empty() - from list of structs t = t.Append([]struct{Name string; Age int; Rate: float32}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) - from map of values t = t.Append(map[string]interface{}{"Name":[]string{"Ivanov","Petrov"},"Age":[]int{32,44},"Rate":[]float32{1.2,1.5}}) - from channel type R struct{Name string; Age int; Rate float32} c := make(chan R) go func(){ c <- R{"Ivanov",32,1.2} c <- R{"Petrov",44,1.5} close(c) }() t.Append(c)
Or inserts empty column
- by empty list of structs t = t.Append([]struct{Info string}{})
- by map of values t = t.Append(map[string]interface{}{"Info":[]string{})
func (*Table) Col ¶
Col returns Column object for the table' column selected by the name
t := tables.New([]struct{Name string; Age int; Rate float32}{{"Ivanov",42,1.2},{"Petrov",42,1.5}}) t.Col("Name").String(0) -> "Ivanov" t.Col("Name").Len() -> 2
func (*Table) Collect ¶
Collect returns self, because Table is a table it's the tables.AnyData interface implementation
func (*Table) Concat ¶
Concat concats two tables into new one
t1 := tables.New(struct{Name string; Age int; Rate float32}{"Ivanov",32,1.2}) t2 := tables.New(struct{Name string; Age int; Rate float32}{"Petrov",44}) q := t1.Concat(t2) q.Row(0) -> {"Ivanov",32,1.2} q.Row(1) -> {"Petrov",44,0}
func (*Table) Fetch ¶
Fetch fills struct with table' row data
t := tables.New([]struct{Name string; Age int; Rate float32}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) r := struct{Name string; Age int}{} t.Fetch(0,&r) r.Name -> "Ivanov" r.Age -> 32
func (*Table) FillRow ¶
FillRow fills row as a struct
func (*Table) GetRow ¶
GetRow gets row as a struct wrapped by reflect.Integer
func (*Table) IsLazy ¶
IsLazy returns false, because Table is not lazy it's the tables.AnyData interface implementation
func (*Table) Lazy ¶
Lazy returns new lazy stream sourcing from the table it's the tables.AnyData interface implementation
func (*Table) List ¶
func (t *Table) List(f interface{})
List executes function for every row
t := tables.New([]struct{Name string; Age int; Rate float32}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.List(func(r struct{Rate float}, i int){ fmt.Println(i, r.Rate) })
func (*Table) Matrix ¶
Matrix returns matrix without labels
func (*Table) MatrixIf ¶
func (t *Table) MatrixIf(features []string, ifName string, ifValue interface{}) (m0, m1 Matrix, err error)
MatrixIf returns two matrices without labels the first one contains samples with column ifName equal ifValue the second one - samples with column ifName not equal ifValue
func (*Table) MatrixWithLabel ¶
func (t *Table) MatrixWithLabel(features []string, label string, least ...int) (m Matrix, err error)
MatrixWithLabel returns matrix with labels
func (*Table) MatrixWithLabelIf ¶
func (t *Table) MatrixWithLabelIf(features []string, label string, ifName string, ifValue interface{}, least ...int) (test, train Matrix, err error)
MatrixWithLabelIf returns two matrices with labels the first one contains samples with column ifName equal ifValue the second one - samples with column ifName not equal ifValue
func (*Table) Only ¶
Only takes specified Columns as new table
t := tables.New([]struct{Name string; Age int; Rate float32}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t2 := t.Only("Age","Rate") t2.Names() -> ["Age", "Rate"] t2.Row(0) -> {"Age": 32, "Rate": 1.2}
func (*Table) Row ¶
Row returns table row as a map of reflect.Integer
t := tables.New([]struct{Name string; Age int; Rate float32}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Row(0)["Name"].String() -> "Ivanov"
func (*Table) Slice ¶
Slice takes a row slice from table
t := tables.New([]struct{Name string; Age int; Rate float32}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Slice(0).Row(0) -> {"Ivanov",32,1.2} t.Slice(1).Row(0) -> {"Petrov",44,1.5} t.Slice(0,2).Len() -> 2 t.Slice(1,2).Len() -> 1
func (*Table) Sort ¶
Sort sorts rows by specified Columns and returns new sorted table
t := tables.New([]struct{Name string; Age int; Rate float32}{{"Ivanov",32,1.2},{"Petrov",44,1.5}}) t.Row(0) -> {Name: "Ivanov", "Age": 32, "Rate", 1.2} q := t.Sort("Name",tables.DESC) q.Row(0) -> {Name: "Petrov", "Age": 44, "Rate", 1.5}
func (*Table) Table ¶
Table returns self, because Table is a table it's the tables.AnyData interface implementation
type TextEnumerator ¶
type TextEnumerator struct{ Enumerator }
func (TextEnumerator) Convert ¶
func (TextEnumerator) Type ¶
func (ce TextEnumerator) Type() reflect.Type