eabf2d7ea984e75cc898326317be8cc3b5e13183,code/classifiers/gaussian_naive_bayes.py,GaussianNaiveBayes,train,#GaussianNaiveBayes#Any#Any#,26

Before Change


            // elements of the input set belonging to the i^th class!
            // Note: np.mean is vectorized i.e. computes the nr_x means
            //       simultaneously.
            means[i,0:2]=np.mean(x[idx,:],0)

        // Note: Remark 1.2 explains that the parameters of a Naive
        // Bayes classifier can be expressed as a linear classifier. We
        // will return the parameters in that format to be used later.
        params = np.zeros((nr_f+1,nr_c))
        for i in xrange(nr_c):
            params[0,i] = -1/2 * np.dot(means[i,:],means[i,:]) + np.log(prior[i])
            params[1:,i] = means[i].transpose()

        // Store classifier parameters.
        self.means = means

After Change


        for i in xrange(nr_c):
            idx,_ = np.nonzero(y == classes[i])
            prior[i] = 1.0*len(idx)/len(y)
            for f in xrange(nr_f):
                g = estimate_gaussian(x[idx,f])
                means[i,f] = g.mean
                variances[i,f] = g.variance
        //// Take the mean of the covariance for each matric
        variances = np.mean(variances,1)
        params = np.zeros((nr_f+1,nr_c))
        for i in xrange(nr_c):
            params[0,i] = -1/2 * np.dot(means[i,:],means[i,:]) + np.log(prior[i])
            params[1:,i] = means[i].transpose()
            //params[0,i] = -1/(2*variances[i]) * np.dot(means[i,:],means[i,:]) + np.log(prior[i])
            //params[1:,i] = (1/variances[i] * means[i]).transpose()
        self.means = means
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: LxMLS/lxmls-toolkit
Commit Name: eabf2d7ea984e75cc898326317be8cc3b5e13183
Time: 2013-07-09
Author: ramon@astudillo.com
File Name: code/classifiers/gaussian_naive_bayes.py
Class Name: GaussianNaiveBayes
Method Name: train


Project Name: bambinos/bambi
Commit Name: 5bb62768d064583aef9efaf5b0838878e11f71e3
Time: 2016-08-14
Author: tyarkoni@gmail.com
File Name: bambi/models.py
Class Name: RandomTerm
Method Name: _setup


Project Name: automl/auto-sklearn
Commit Name: 8bdcba15caa28cb4336d9cb6ee4108078ab6d8a2
Time: 2018-11-12
Author: feurerm@informatik.uni-freiburg.de
File Name: autosklearn/ensembles/ensemble_selection.py
Class Name: EnsembleSelection
Method Name: _fast