Skip to content

Instantly share code, notes, and snippets.

@emjun
Created July 14, 2020 16:14
Show Gist options
  • Save emjun/52a5f3c7f5c3fdf14af9a238b6324647 to your computer and use it in GitHub Desktop.
Save emjun/52a5f3c7f5c3fdf14af9a238b6324647 to your computer and use it in GitHub Desktop.
Another possible API design for V1
# Declare Variables, Design, Assumptions, and Hypothesis at the time of construction
import tea
file_path = "./datasets/UScrime.csv"
variables = [{
'name': 'Class',
'data type': 'ordinal',
'categories': ['0', '1', '2']
},
{
'name': 'Score',
'data type': 'numeric'
}]
design = {
'study type': 'experiment',
'independent variable': 'Class',
'dependent variable': 'Score'
}
# No Assumptions (Assumptions are optional)
# OPTION 1: Declare Tea object all at once
tea_obj = tea.Tea(variables, design, hypothesis="Score~Class", file_path) # order could be changed
# OPTION 2: Add Variables, Design, Assumptions, and Hypotheses incrementally
tea_obj = tea.Tea()
tea_obj.load_data(file_path) # Data must be associated with a Tea obj
tea_obj.define_variables(variables)
tea_obj.define_study_design(design, variables)
results = tea_obj.hypothesize("Score~Class")
print(results) # could pretty print, visualize, etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment