none commited on
Commit
06a123d
1 Parent(s): 47cdcf5
Files changed (1) hide show
  1. streamlit_viz.py +8 -4
streamlit_viz.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import joblib
2
  import time
3
 
@@ -225,7 +226,7 @@ I trained an ensemble of
225
  [Histogram-based Gradient Boosting Decision Trees](https://scikit-learn.org/stable/modules/ensemble.html#histogram-based-gradient-boosting)
226
  on some
227
  [data](https://research.unsw.edu.au/projects/unsw-nb15-dataset).
228
- That algoritm looks at its mistakes and tries to avoid those mistakes the next time around.
229
 
230
  To do that, it starts off with a decision tree.
231
  From there, it looks at the points that tree got wrong and makes another decision tree that tries
@@ -242,11 +243,11 @@ My model ends up with 10 trees.
242
  I've plotted the progression of those 10 trees as an animated series of interactive Plotly tree maps.
243
  The nodes are color-coded by which feature the decision tree used to make that split.
244
 
245
- I've also labeled each node with the feature name and the decison boundary.
246
  If you click on a node, Plotly will show the path to that node in a banner at the top of the plot so you can see how a point ends up in the node you clicked.
247
 
248
  The numbers and letters in brackets like `[3.L]` refer to the parent node's position in a breadth-first traversal of the tree and whether the current node is a left or right child of that parent.
249
- Plotly unforunately plots everything flipped for some reason, so all the `R` nodes are on the left and vice versa.
250
 
251
  I recommend expanding the plot by clicking the arrows in the top right corner since Streamlit makes the plot really small.
252
  It takes a second to get going after you hit `Play`.
@@ -362,7 +363,7 @@ As far as I can tell, this poster `empet` is the only person in the world who un
362
 
363
  st.markdown('## Check out the data!')
364
  st.markdown("""
365
- This plot is similar to the plot above, but the slider here coordinates with a table to show the data I extracted to plot each tree.
366
  """)
367
 
368
  # This works the way I want
@@ -388,6 +389,9 @@ This plot is similar to the plot above, but the slider here coordinates with a t
388
  st.markdown("""
389
  This section is mostly just to warn you against making the same foolhardy decision to marry the innermost guts of SciKit-Learn to the sparsely documented world of Python Plotly animations.
390
 
 
 
 
391
  """)
392
 
393
  if __name__=='__main__':
 
1
+
2
  import joblib
3
  import time
4
 
 
226
  [Histogram-based Gradient Boosting Decision Trees](https://scikit-learn.org/stable/modules/ensemble.html#histogram-based-gradient-boosting)
227
  on some
228
  [data](https://research.unsw.edu.au/projects/unsw-nb15-dataset).
229
+ That algorithm looks at its mistakes and tries to avoid those mistakes the next time around.
230
 
231
  To do that, it starts off with a decision tree.
232
  From there, it looks at the points that tree got wrong and makes another decision tree that tries
 
243
  I've plotted the progression of those 10 trees as an animated series of interactive Plotly tree maps.
244
  The nodes are color-coded by which feature the decision tree used to make that split.
245
 
246
+ I've also labeled each node with the feature name and the decision boundary.
247
  If you click on a node, Plotly will show the path to that node in a banner at the top of the plot so you can see how a point ends up in the node you clicked.
248
 
249
  The numbers and letters in brackets like `[3.L]` refer to the parent node's position in a breadth-first traversal of the tree and whether the current node is a left or right child of that parent.
250
+ Plotly unfortunately plots everything flipped for some reason, so all the `R` nodes are on the left and vice versa.
251
 
252
  I recommend expanding the plot by clicking the arrows in the top right corner since Streamlit makes the plot really small.
253
  It takes a second to get going after you hit `Play`.
 
363
 
364
  st.markdown('## Check out the data!')
365
  st.markdown("""
366
+ This plot is similar to the plot above, but the slider here coordinates with a table of the data I extracted to plot each tree.
367
  """)
368
 
369
  # This works the way I want
 
389
  st.markdown("""
390
  This section is mostly just to warn you against making the same foolhardy decision to marry the innermost guts of SciKit-Learn to the sparsely documented world of Python Plotly animations.
391
 
392
+ I'm glad it was challenging, though.
393
+ I did go into this hoping for something more interesting than a donut plot.
394
+ Maybe I'll think on the `value` and `gain` fields a bit and come up with a version 2.
395
  """)
396
 
397
  if __name__=='__main__':