def code_gen_ensemble(trees, individual_learner_weight, initial_value,
                      gen=None, n_jobs=1):

    if gen is None:
        gen = CodeGenerator()

    tree_files =[_gen_tree(i, tree) for i, tree in enumerate(trees)]

    with gen.bracketed('extern "C" {', "}"):
        # add dummy definitions if you will compile in parallel
        for i, tree in enumerate(trees):
            name = "{name}_{index}".format(name=EVALUATE_FN_NAME, index=i)
            gen.write("float {name}(float* f);".format(name=name))

        fn_decl = "float {name}(float* f) {{".format(name=EVALUATE_FN_NAME)
        with gen.bracketed(fn_decl, "}"):
            gen.write("float result = {0}f;".format(initial_value))
            for i, _ in enumerate(trees):
                increment = "result += {name}_{index}(f) * {weight}f;".format(
                    name=EVALUATE_FN_NAME,
                    index=i,
                    weight=individual_learner_weight)
                gen.write(increment)
            gen.write("return result;")
    return tree_files + [gen.file]
Writes code similar to:
dataset/ETHPy150Open ajtulloch/sklearn-compiledtrees/compiledtrees/code_gen.py/code_gen_ensemble