Also, there is an effort on converting trained scikit-learn models to other languages (e.g. C) in https://github.com/nok/sklearn-porter
but it does not support GradientBoostingRegressor (yet).

On 13/04/17 23:27, federico vaggi wrote:
If you want to use the model from C++ code, the easiest way is to
probably use Boost/Python
(http://www.boost.org/doc/libs/1_62_0/libs/python/doc/html/index.html).
Alternatively, use another gradient boosting library that has a C++ API
(like XGBoost).

Keep in mind, if you want to call Python code from C++ you will have to
bundle a Python interpreter as well as all the dependencies.

On Thu, 13 Apr 2017 at 14:23 Sebastian Raschka <se.rasc...@gmail.com
<mailto:se.rasc...@gmail.com>> wrote:

    Hi,

    not sure how this could generally work. However, you could at least
    dump the model parameters for e.g., linear models and compute the
    prediction via

    w_1 * x1 + w_2 * x_2 + … + w_n * x_n + bias

    over the n features.

    To write various model attributes to text files, you could use json,
    e.g., see https://cmry.github.io/notes/serialize
    However, I don’t think that this approach will solve the problem of
    loading the model into C++.

    Best,
    Sebastian

    > On Apr 13, 2017, at 4:58 PM, 老陈 <26743...@qq.com
    <mailto:26743...@qq.com>> wrote:
    >
    > Hi,
    >
    > I am working on GradientBoostingRegressor these days and I am
    wondering if there is a way to dump the model into txt file, or any
    other format that can be processed by c++
    >
    > My production system is in c++, so I want use the python-trained
    tree model in c++ for production.
    >
    > Has anyone ever done this before?
    >
    > thanks
    > _______________________________________________
    > scikit-learn mailing list
    > scikit-learn@python.org <mailto:scikit-learn@python.org>
    > https://mail.python.org/mailman/listinfo/scikit-learn

    _______________________________________________
    scikit-learn mailing list
    scikit-learn@python.org <mailto:scikit-learn@python.org>
    https://mail.python.org/mailman/listinfo/scikit-learn



_______________________________________________
scikit-learn mailing list
scikit-learn@python.org
https://mail.python.org/mailman/listinfo/scikit-learn


_______________________________________________
scikit-learn mailing list
scikit-learn@python.org
https://mail.python.org/mailman/listinfo/scikit-learn

Reply via email to