def create_gaussiannb(self, override=False): """Creates a GaussianNB classifier, and exports the json file. Parameters ---------- override : bool Overrides an existing export. Returns ------- None Raises ------ FileExists """ clf = self.create_classifier("GaussianNB") path = f"{TESTPATH}/GaussianNB.json" ex = LazyExport(clf) return ex.save(path, force_override=override)
def test_exportlinearsvc(self): """Attempts to export a LinearSVC classifier""" ex = LazyExport(self.create_classifier("LinearSVC")) self.assertIsNone(ex.save(f"{TESTPATH}/linearsvc.json"))
def test_testdecisiontree(self): """Attempts to export a DecisionTreeClassifier classifier""" ex = LazyExport(self.create_classifier("DecisionTreeClassifier")) self.assertIsNone(ex.save(f"{TESTPATH}/decisiontree.json"))
def test_exprtmlp(self): """Attempts to export a MLPClassifier classifier""" ex = LazyExport(self.create_classifier("MLPClassifier")) self.assertIsNone(ex.save(f"{TESTPATH}/mlp.json"))
def test_exportkneighbors(self): """Attempts to export a KNeighborsClassifier classifier""" ex = LazyExport(self.create_classifier("KNeighborsClassifier")) self.assertIsNone(ex.save(f"{TESTPATH}/knn.json"))
def test_exportbernoullinb(self): """Attempts to export a BernoulliNB classifier""" clf = self.create_classifier("BernoulliNB") ex = LazyExport(clf) self.assertIsNone(ex.save(f"{TESTPATH}/bnb.json"))
def test_randomrandomforest(self): """Attempts to export a random forest classifier.""" ex = LazyExport(self.create_classifier("RandomForestClassifier")) self.assertIsNone(ex.save(f"{TESTPATH}/rf.json"))
def test_exportgaussiannb(self): """Exports a GaussianNB model.""" clf = self.create_classifier("GaussianNB") path = f"{TESTPATH}/GaussianNB.json" ex = LazyExport(clf) self.assertIsNone(ex.save(path))