You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use spark to generate libsvm file, then use python sklearn to load it and xgboost to train and save model, finaly use leaves load it and predict.
the predict result was total incorrect between python demo and go.
just want to ask if leve not support or we use leaves wrong.
the python code like:
my_workpath = 'D:\\project\\py\\train_demo\\'
X_train, y_train = load_svmlight_file(my_workpath + 'train')
X_test, y_test = load_svmlight_file(my_workpath + 'validation')
bst = XGBClassifier()
bst.fit(X_train, y_train)
bst.save_model(my_workpath + "train_model")
train_preds = [x[1] for x in bst.predict_proba(X_train)]
test_preds = [x[1] for x in bst.predict_proba(X_test)]
the go code like:
model, e := leaves.XGEnsembleFromFile(model_path,true)
if e != nil{
println(e)
}
if model.Transformation().Type() != transformation.Logistic {
log.Fatalf("expected TransforType = Logistic (got %s)", model.Transformation().Name())
}
csr, err := mat.CSRMatFromLibsvmFile(validate_path, 0, true)
if err != nil{
println(err)
}
predictions := make([]float64, csr.Rows()*model.NOutputGroups())
e = model.PredictCSR(csr.RowHeaders, csr.ColIndexes, csr.Values, predictions, 50, 5)
if e != nil{
println(e)
}
fmt.Printf("Prediction for %v\n", predictions)
The text was updated successfully, but these errors were encountered:
We use spark to generate libsvm file, then use python sklearn to load it and xgboost to train and save model, finaly use leaves load it and predict.
the predict result was total incorrect between python demo and go.
just want to ask if leve not support or we use leaves wrong.
the python code like:
the go code like:
The text was updated successfully, but these errors were encountered: