var {class_name} = function(lChilds, rChilds, thresholds, indices, classes) {{

    this.lChilds = lChilds;
    this.rChilds = rChilds;
    this.thresholds = thresholds;
    this.indices = indices;
    this.classes = classes;

    var findMax = function(nums) {{
        var index = 0;
        for (var i = 0; i < nums.length; i++) {{
            index = nums[i] > nums[index] ? i : index;
        }}
        return index;
    }};

    this.{method_name} = function(features, node) {{
        node = (typeof node !== 'undefined') ? node : 0;
        if (this.thresholds[node] != -2) {{
            if (features[this.indices[node]] <= this.thresholds[node]) {{
                return this.{method_name}(features, this.lChilds[node]);
            }} else {{
                return this.{method_name}(features, this.rChilds[node]);
            }}
        }}
        return findMax(this.classes[node]);
    }};

}};

if (typeof process !== 'undefined' && typeof process.argv !== 'undefined') {{
    if (process.argv.length - 2 === {n_features}) {{

        // Features:
        var features = process.argv.slice(2);

        // Parameters:
        {left_childs}
        {right_childs}
        {thresholds}
        {indices}
        {classes}

        // Prediction:
        var clf = new {class_name}(lChilds, rChilds, thresholds, indices, classes);
        var prediction = clf.{method_name}(features);
        console.log(prediction);

    }}
}}