this.{method_name} = function(atts) {{

    {priors}
    {sigmas}
    {thetas}
    var likelihoods = new Array({n_classes});

    for (var i = 0; i < {n_classes}; i++) {{
        var sum = 0.;
        for (var j = 0; j < {n_features}; j++) {{
            sum += Math.log(2. * Math.PI * sigmas[i][j]);
        }}
        var nij = -0.5 * sum;
        sum = 0.;
        for (var j = 0; j < {n_features}; j++) {{
            sum += Math.pow(atts[j] - thetas[i][j], 2.) / sigmas[i][j];
        }}
        nij -= 0.5 * sum;
        likelihoods[i] = Math.log(priors[i]) + nij;
    }}

    var highest_likeli = Number.NEGATIVE_INFINITY;
    var classIndex = -1;
    for (var i = 0; i < {n_classes}; i++) {{
        if (likelihoods[i] > highest_likeli) {{
            highest_likeli = likelihoods[i];
            classIndex = i;
        }}
    }}
    return classIndex;
}};