jinlow / forust

A lightweight gradient boosted decision tree package.
https://jinlow.github.io/forust/
Apache License 2.0
56 stars 6 forks source link

[Bug] Issue loading model trained in rust from python #94

Closed The-Mr-L closed 6 months ago

The-Mr-L commented 6 months ago

Hi :) just a quick heads up, I have not had the time yet to troubleshoot it , but I can without any problems train a model from python and load it from both python and rust but the trained model from rust can only be loaded from rust. well the error is just a panic like this "PanicException: called Option::unwrap() on a None value" . I will report back if I find the problem

The-Mr-L commented 6 months ago

btw the model setup is like so

  let mut model = GradientBooster::default()
        .set_iterations(151)
        .set_objective_type(forust_ml::objective::ObjectiveType::LogLoss)
        .set_learning_rate(0.01)
        .set_max_depth(5)
        .set_gamma(0.)
        .set_initialize_base_score(false)
        .set_base_score(0.5)
        .set_min_leaf_weight(1.)
        .set_l2(1.);
    model.fit_unweighted(&matrix, &y, None)?;
    model.save_booster("./model.json")?;
jinlow commented 6 months ago

Thanks for reporting this! I see the problem, will close this when the fix is released.

jinlow commented 6 months ago

Please try again with version 0.4.5.

The-Mr-L commented 6 months ago

it works now :) thanks !