poloclub / timbertrek Goto Github PK
View Code? Open in Web Editor NEWExplore and compare 1K+ accurate decision trees in your browser!
Home Page: https://poloclub.github.io/timbertrek
License: MIT License
Explore and compare 1K+ accurate decision trees in your browser!
Home Page: https://poloclub.github.io/timbertrek
License: MIT License
Source URL: https://github.com/poloclub/timbertrek/blob/master/README.md
You can use the web demo to explore your own Rashomon Sets! You just need to choose the my own set tab below the tool and upload a JSON file containing all decision paths in your Rashomon Set.
Check out this example notebook to see how to generate this JSON file.
This link is broken. I liked the paper, and wanted to see if I could use my own data, but it is unclear how to do this. On the timbertek github.io page, in the widget that lets you pick your own data also, the link to how to do this is broken. it redirects to the readme and the link in the readme is broken.
Thank you
Trying to convert a trie calculated by the treeFARMS package into a rules JSON for timbertrek using code suggested in another ticket (#2), but getting an error. The trie has 80739 trees according to the message.
Code:
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.model_selection import train_test_split
from treefarms.model.threshold_guess import compute_thresholds, cut
from treefarms import TREEFARMS
from treefarms.model.model_set import ModelSetContainer
import timbertrek
X = data
# h = list(X.columns)
for met in metric_cols:
y = df[met]
config = {
"regularization": 0.02, # regularization penalizes the tree with more leaves. We recommend to set it to relative high value to find a sparse tree.
"rashomon_bound_multiplier": 0.25, "depth_budget": 0} # rashomon bound multiplier indicates how large of a Rashomon set would you like to get}
model = TREEFARMS(config)
print('configed')
model.fit(X, y)
print('fitted')
# Get the rashomon in a trie structure
trie = model.model_set.to_trie()
print('trie-d')
df = model.dataset
# Convert the trie to decision paths
feature_names = df.columns
decision_paths = timbertrek.transform_trie_to_rules(trie,df,feature_names=feature_names)
# Save the decision paths in a JSON file
dump(decision_paths, open('tree_for_'+str(met)+'.json', 'w'))
IndexError Traceback (most recent call last)
/tmp/ipykernel_16824/365095990.py in
26 trie,
27 df,
---> 28 feature_names=feature_names,
29 )
30 # Save the decision paths in a JSON file
/opt/conda/lib/python3.7/site-packages/timbertrek/timbertrek.py in transform_trie_to_rules(trie, data_df, feature_names, feature_description)
683 # Construct trees
684 decision_rule_hierarchy, tree_map = get_decision_rule_hierarchy_dict(
--> 685 trie, keep_position=False
686 )
687 new_tree_map = get_tree_map_hierarchy(tree_map)
/opt/conda/lib/python3.7/site-packages/timbertrek/timbertrek.py in get_decision_rule_hierarchy_dict(trie, keep_position)
483 for i in tree_map["map"]:
484 cur_string = tree_map["map"][i][0]
--> 485 all_rules = get_decision_rules(cur_string)
486
487 # Iterate the set and build the hierarchy dict
/opt/conda/lib/python3.7/site-packages/timbertrek/timbertrek.py in get_decision_rules(tree_strings)
238 cur_feature, pre_features = working_queue.popleft()
239
--> 240 cur_string = tree_strings[i]
241 cur_string_split = cur_string.split()
242
IndexError: list index out of range
Thank you so much for the awesome tool!
How exactly do I generate the JSON file? I don't think the example notebook covers this.
Thanks!
Hi there!
Thank you once again for developing this amazing tool.
Would it be possible to embed the interactive in a Qualtrics Survey?
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.