def train_self(self):
        # for each numeric column, we need to record mean and std for both classes
        for col in self.num_cols:
            self.prob_hub[col] = {}
            for claz in self.class_list:
                mean, std = get_mean_std(self.data[self.data[self.class_column] == claz][col])
                self.prob_hub[col][claz] = (mean, std)

        # for each categorical columns, we need to record P(X=x|Y=y)
        for col in self.cat_cols:
            ulist = unique_list(self.data[col])
            self.prob_hub[col] = {}
            stat = self.data.groupby(self.class_column)[col].value_counts() / self.data.groupby(self.class_column)[col].count()
            # for each class
            for claz in self.class_list:
                self.prob_hub[col][claz] = {}
                for uni_element in ulist:
                    self.prob_hub[col][claz][uni_element] = stat[claz][uni_element]

        self.predict(self.data, True)
Do not treat NaN and infinities as valid polynomial coefficients.
dataset/ETHPy150Open LargePanda/LearnPy/learnpy/models/NaiveBayes.py/NaiveBayes.train_self--crossover with--dataset/ETHPy150Open sympy/sympy/sympy/polys/polyutils.py/_not_a_coeff