Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def train(self, train_data):
self.discretizer = DiscretizeTransformer(self.meta, 8)
self.discretizer.fit(train_data)
train_data_d = self.discretizer.transform(train_data)
self.model = BayesianNetwork.from_samples(train_data_d, algorithm='chow-liu')
def fit(self, data, categoricals=tuple(), ordinals=tuple()):
self.discretizer = DiscretizeTransformer(n_bins=15)
self.discretizer.fit(data, categoricals, ordinals)
discretized_data = self.discretizer.transform(data)
self.model = BayesianNetwork.from_samples(discretized_data, algorithm='chow-liu')