Created
July 29, 2020 18:02
-
-
Save emjun/d433241ce3a9a7e18445c361ffd00004 to your computer and use it in GitHub Desktop.
Possible refactor to make each statistical test an object/class.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Idea: Make each statistical test its own class with an execute and visualization function | |
# For example: | |
class Students_T(): | |
def execute(dataset, design, predictions, combined_data: CombinedData): | |
# perform statistical test | |
pass | |
def visualize(): | |
# add visualization code | |
pass | |
def text_output(): | |
# create the text template here | |
pass | |
def __str___(): | |
# provide the text_output and visualization | |
text_output() | |
visualize() | |
# If we have this, then we could refactor __create_relate_vardata function (line 368, https://github.com/tea-lang-org/tea-lang/blob/master/tea/vardata_factory.py) | |
# One option: Keep everything the same until line 427 and do something like this: | |
valid_tests = [] | |
for test in tests: | |
test_obj = create_test_object(test) # some function like this that takes as input the list of tests that are valid (from the solver) and then instantates an object for each valid test | |
valid_tests.append(test_obj) | |
for vt in valid_tests: | |
vt.execute(...) # pass all the needed parameters | |
# handle multiple comparisons | |
return valid_tests # returning a list will likely break Tea V0, but would be fine for V1. Also, Tea V0 could work around returning a list for testing. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment