Ejemplo n.º 1
0
 def test_instantiate_associator(self):
     """
     Tests the instantiation of an Associator class.
     """
     cname = "weka.associations.Apriori"
     options = None
     cls = associations.Associator(classname=cname, options=options)
     self.assertIsNotNone(cls,
                          msg="Failed to instantiate: " + cname + "/" +
                          str(options))
     self.assertEqual(cname, cls.classname, "Classnames differ!")
Ejemplo n.º 2
0
    def test_capabilities(self):
        """
        Tests the capabilities.
        """
        cname = "weka.associations.Apriori"
        options = None
        cls = associations.Associator(classname=cname, options=options)
        self.assertIsNotNone(cls,
                             msg="Failed to instantiate: " + cname + "/" +
                             str(options))
        self.assertEqual(cname, cls.classname, "Classnames differ!")

        caps = cls.capabilities
        self.assertIsNotNone(caps, msg="Capabilities are None!")
Ejemplo n.º 3
0
 def test_make_copy(self):
     """
     Tests the make_copy class method of the Associator class.
     """
     cname = "weka.associations.Apriori"
     options = None
     cls = associations.Associator(classname=cname, options=options)
     self.assertIsNotNone(cls,
                          msg="Failed to instantiate: " + cname + "/" +
                          str(options))
     self.assertEqual(cname, cls.classname, "Classnames differ!")
     cls2 = associations.Associator.make_copy(cls)
     self.assertIsNotNone(cls2,
                          msg="Failed to instantiate: " + cname + "/" +
                          str(options))
     self.assertEqual(cname, cls2.classname, "Classnames differ!")
Ejemplo n.º 4
0
    def test_build_associator(self):
        """
        Tests the build_classifier method.
        """
        loader = converters.Loader(classname="weka.core.converters.ArffLoader")
        data = loader.load_file(self.datafile("nursery.arff"))
        self.assertIsNotNone(data)
        data.class_is_last()

        cname = "weka.associations.Apriori"
        options = None
        cls = associations.Associator(classname=cname, options=options)
        self.assertIsNotNone(cls,
                             msg="Failed to instantiate: " + cname + "/" +
                             str(options))

        cls.build_associations(data)