I fit a one hot encoder in Python. I can save it using pickle or joblib for instance. I wonder if I can load it in golang to preprocess my data.
import (
"io"
"os"
"github.com/hydrogen18/stalecucumber"
prep "github.com/pa-m/sklearn/preprocessing"
"gonum.org/v1/gonum/mat"
)
func main() {
var ohe prep.OneHotEncoder
oheFilePath := "one_hot_encoder.pkl"
var r io.Reader
r, _ = os.Open(oheFilePath)
stalecucumber.UnpackInto(&ohe).From(stalecucumber.Unpickle(r))
}
Then I would like to one-hot encode my string vector :
input := []string{"ios", "US"}
So I would have done something like that
ohe.Transform(input)
But the Transform function takes two mat.Matrix as input, and I can't define a matrix of strings, and I also have only one input (I don't encode any labels).