Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(?): right now there is a small chance that corner data are wrongly predicted (t... #122

Open
github-actions bot opened this issue Aug 10, 2022 · 0 comments
Labels

Comments

@github-actions
Copy link

In other words, if we use the extracted rules (with a specific default accuracy fo float)

and compare their result with the one obtained by the actual decision tree (thresholds do not have truncated float)

they may be different. To avoid this, when we will refactor all extractor we will also address this issue.

TODO (?): right now there is a small chance that corner data are wrongly predicted (that is fine for now).

from parameterized import parameterized_class
from psyke.utils import get_default_precision
from psyke import logger
from test.psyke import initialize
import unittest

""" 
    TODO (?): right now there is a small chance that corner data are wrongly predicted (that is fine for now).
    In other words, if we use the extracted rules (with a specific default accuracy fo float)
    and compare their result with the one obtained by the actual decision tree (thresholds do not have truncated float)
    they may be different. To avoid this, when we will refactor all extractor we will also address this issue.
"""


@parameterized_class(initialize('cart'))
class TestCart(unittest.TestCase):

    def test_extract(self):
        logger.info(self.expected_theory)
        logger.info(self.extracted_theory)
        self.assertTrue(self.expected_theory.equals(self.extracted_theory, False))

    def test_predict(self):
        # self.assertEqual(self.extracted_test_y_from_theory, self.extracted_test_y_from_pruned_theory)
        if isinstance(self.extracted_test_y_from_theory[0], str):
            self.assertTrue(all(self.extracted_test_y_from_theory == self.extracted_test_y_from_extractor))
        else:
            self.assertTrue(max(abs(self.extracted_test_y_from_theory - self.extracted_test_y_from_extractor)) <
                            get_default_precision())


if __name__ == '__main__':
    unittest.main()
@github-actions github-actions bot added the todo label Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

0 participants