Documentation ¶
Index ¶
- func Fit(ctx *core.Context, stateName string, bucket []data.Value) (data.Value, error)
- func Flush(ctx *core.Context, stateName string) (data.Value, error)
- func Predict(ctx *core.Context, stateName string, dt data.Value) (data.Value, error)
- type MLParams
- type State
- func (s *State) Fit(ctx *core.Context, bucket []data.Value) (data.Value, error)
- func (s *State) Load(ctx *core.Context, r io.Reader, params data.Map) error
- func (s *State) Predict(ctx *core.Context, dt data.Value) (data.Value, error)
- func (s *State) Save(ctx *core.Context, w io.Writer, params data.Map) error
- func (s *State) Terminate(ctx *core.Context) error
- func (s *State) Write(ctx *core.Context, t *core.Tuple) error
- type StateCreator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fit ¶
Fit trains the model. It applies tuples that bucket has in a batch manner. The return value of this function depends on the implementation of Python UDS.
Types ¶
type MLParams ¶
type MLParams struct { // BatchSize is number of tuples in a single batch training. Write method, // which is usually called by an INSERT INTOT statement via uds Sink, stores // tuples without training until it has tuples as many as batch_train_size. // This is an optional parameter and its default value is 10. BatchSize int `codec:"batch_train_size"` }
MLParams is parameters pymlstate defines in addition to those pystate does. These parameters come from a WITH clause of a CREATE STATE statement.
type State ¶
type State struct {
// contains filtered or unexported fields
}
State is python instance specialized to multiple layer classification. The python instance and this struct must not be coppied directly by assignment statement because it doesn't increase reference count of instance.
func (*State) Fit ¶
Fit receives `data.Array` type but it assumes `[]data.Map` type for passing arguments to `fit` method.
func (*State) Load ¶
Load loads the model of the state. pystate calls `load` method and pass to the model data by using method parameter.
func (*State) Predict ¶
Predict applies the model to the data. It returns a result returned from Python script.
func (*State) Save ¶
Save saves the model of the state. pystate calls `save` method and use its return value as dumped model.
type StateCreator ¶
type StateCreator struct { }
StateCreator is used by BQL to create or load Multiple Layer Classification State as a UDS.
func (*StateCreator) CreateState ¶
func (c *StateCreator) CreateState(ctx *core.Context, params data.Map) ( core.SharedState, error)
CreateState creates `core.SharedState`. Some parameters are from pystate package. See the document of pystate.BaseParams for details. pymlstate has its own parameters, which is defined at MLParams.