Documentation ¶
Index ¶
- Variables
- type CatBoost
- type Frequency
- type JamesSteinClassification
- type JamesSteinRegression
- type LeaveOneOut
- type OneHot
- func (e *OneHot) Contains(s string) bool
- func (e *OneHot) ContainsCode(code []uint8) bool
- func (e *OneHot) Decode(code []uint8) (string, error)
- func (e *OneHot) Dimension() int
- func (e *OneHot) Encode(s string) []uint8
- func (e *OneHot) MarshalCSV() ([]byte, error)
- func (e *OneHot) MarshalJSON() ([]byte, error)
- func (e *OneHot) UnmarshalCSV(data []byte) error
- func (e *OneHot) UnmarshalJSON(data []byte) error
- type Ordinal
- func (e *Ordinal) Contains(s string) bool
- func (e *Ordinal) ContainsCode(code int) bool
- func (e *Ordinal) Decode(i uint64) string
- func (e *Ordinal) DecodeSlice(s sam.SliceInt) sam.SliceString
- func (e *Ordinal) Encode(s string) uint64
- func (e *Ordinal) EncodeBytes(b []byte) uint64
- func (e *Ordinal) EncodeSlice(s sam.SliceString) []uint64
- func (e *Ordinal) EncodeStringer(s fmt.Stringer) uint64
- func (e *Ordinal) GobDecode(data []byte) error
- func (e *Ordinal) GobEncode() ([]byte, error)
- func (e *Ordinal) Length() int
- func (e *Ordinal) List() sam.SliceString
- func (e *Ordinal) MarshalCSV() ([]byte, error)
- func (e *Ordinal) MarshalJSON() ([]byte, error)
- func (e *Ordinal) UnmarshalCSV(data []byte) error
- func (e *Ordinal) UnmarshalJSON(data []byte) error
- type RollingFrequency
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Frequency ¶
type Frequency struct {
// contains filtered or unexported fields
}
Frequency is a one-way encoder. You cannot decode Frequency values as some values may be encoded with the same numerical value.
func NewFrequency ¶
NewFrequency will return a frequency encoder with the given values encoded.
type JamesSteinClassification ¶
type JamesSteinClassification struct {
// contains filtered or unexported fields
}
JamesSteinClassification is a one way encoder. You cannot decode JamesSteinClassification values as some values may be encoded with the same numerical code. JamesSteinClassification is a target-based encoder.
func NewJamesSteinClassification ¶
func NewJamesSteinClassification(values []string, target []string) (*JamesSteinClassification, error)
NewJamesSteinClassification will create a JamesSteinClassification encoder
func (*JamesSteinClassification) Codes ¶
func (e *JamesSteinClassification) Codes() sam.SliceFloat64
Codes will return the slice of codes for all of the values used in the construction of the JamesSteinClassification encoder.
type JamesSteinRegression ¶
type JamesSteinRegression struct {
// contains filtered or unexported fields
}
JamesSteinRegression is a one way encoder. You cannot decode JamesSteinRegression values as some values may be encoded with the same numerical code. JamesSteinRegression is a target-based encoder.
func NewJamesSteinRegression ¶
func NewJamesSteinRegression(values []string, target []float64) (*JamesSteinRegression, error)
NewJamesSteinRegression will create a JamesSteinRegression encoder
type LeaveOneOut ¶
type LeaveOneOut struct { }
LeaveOneOut ...
func NewLeaveOneOut ¶
func NewLeaveOneOut() *LeaveOneOut
type OneHot ¶
type OneHot struct {
// contains filtered or unexported fields
}
OneHot will encode string values into a unique one-hot vector (binary vector with a single 1). The empty string is ALWAYS the 0-vector. It will also allow for string values to be decoded.
func NewOneHot ¶
func NewOneHot() *OneHot
NewOneHot will return a one-hot encoder that will set the empty string as the first dimension of every one-hot binary codeword. "Binary" here means that every value in the codeword (integer slice) will be either a 0 or a 1.
func (*OneHot) ContainsCode ¶
ContainsCode will check if a codeword is a valid codeword or not.
func (*OneHot) Decode ¶
Decode will return the string for the given binary codeword (one-hot code). If the codeword argument is longer than the encoders codewords then an `ErrLength` error will be returned.
func (*OneHot) Dimension ¶
Dimension returns the current dimension of each one-hot codeword. The dimension increases with every new string that gets encoded.
type Ordinal ¶
Ordinal will encode string values into a unique integer value. The empty string is ALWAYS the 0 value. It will also allow for string values to be decoded.
func NewOrdinal ¶
NewOrdinal will create a new ordinal encoder. If the `init` boolean is specified as true, then the encoder will intialize with the empty string `""` encoded as the `0` value.
func (*Ordinal) Contains ¶
Contains will return whether or not a string has been assigned an ordinal code or not.
func (*Ordinal) Decode ¶
Decode will return an empty string if supplied integer argument is not a valid code.
func (*Ordinal) DecodeSlice ¶
func (e *Ordinal) DecodeSlice(s sam.SliceInt) sam.SliceString
DecodeSlice will decode all the values in the slice of integers provided as an argument. If a string value has no existing encoding then it will be returned as the empty string.
func (*Ordinal) EncodeBytes ¶ added in v0.1.0
EncodeBytes --
func (*Ordinal) EncodeSlice ¶
func (e *Ordinal) EncodeSlice(s sam.SliceString) []uint64
EncodeSlice will encode all the values in the slice of strings provided as an argument.
func (*Ordinal) EncodeStringer ¶ added in v0.1.0
EncodeStringer --
func (*Ordinal) UnmarshalJSON ¶
UnmarshalJSON ...
type RollingFrequency ¶
type RollingFrequency struct {
// contains filtered or unexported fields
}
RollingFrequency is a one-war encoder. You cannot decode RollingFrequency values as some values may be encoded with the same numerical code.
func NewRollingFrequency ¶
func NewRollingFrequency(window int, values []string) *RollingFrequency
NewRollingFrequency will create a codeword for every value in the list of values in the order of those values. The list of values supplied to this function should not be a unique list of categorical values. The list should contain all the individual observation values found in the dataset/sample.
func (*RollingFrequency) Codes ¶
func (e *RollingFrequency) Codes() sam.SliceInt
Codes will return the list of codes generated for the list of values provided in the creation of the RollingFrequency encoder.
func (*RollingFrequency) Get ¶
func (e *RollingFrequency) Get(index int) (int, error)
Get will return the code for the given index, according to the original slice of values provided in the construction of the RollingFrequency encoder.
func (*RollingFrequency) Window ¶
func (e *RollingFrequency) Window() int
Window will return the window used when creating the RollingFrequency encoder.