Skip to content

Commit

Permalink
fix for colab
Browse files Browse the repository at this point in the history
  • Loading branch information
amakelov committed Jul 7, 2024
1 parent e0b4e96 commit 7115126
Show file tree
Hide file tree
Showing 7 changed files with 1,541 additions and 1,527 deletions.
49 changes: 28 additions & 21 deletions docs/docs/blog/01_cf.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ replaced by a computation graph of variables and operations, and rows are


```python
# for Google Colab
try:
import google.colab
!pip install git+https://github.com/amakelov/mandala
except:
pass

from mandala.imports import *

@op(output_names=['y'])
Expand Down Expand Up @@ -67,10 +74,10 @@ print(cf.df().to_markdown())
| | x | increment | y | add | w |
|---:|----:|:--------------------------------------------|----:|:--------------------------------------|----:|
| 0 | 1 | Call(increment, cid='948...', hid='6e2...') | 2 | | nan |
| 1 | 0 | Call(increment, cid='d47...', hid='230...') | 1 | Call(add, cid='89c...', hid='247...') | 1 |
| 2 | 2 | Call(increment, cid='bfb...', hid='5dd...') | 3 | Call(add, cid='a81...', hid='626...') | 5 |
| 3 | 4 | Call(increment, cid='928...', hid='adf...') | 5 | Call(add, cid='a54...', hid='deb...') | 9 |
| 4 | 3 | Call(increment, cid='9b4...', hid='df2...') | 4 | | nan |
| 1 | 4 | Call(increment, cid='928...', hid='adf...') | 5 | Call(add, cid='a54...', hid='deb...') | 9 |
| 2 | 3 | Call(increment, cid='9b4...', hid='df2...') | 4 | | nan |
| 3 | 0 | Call(increment, cid='d47...', hid='230...') | 1 | Call(add, cid='89c...', hid='247...') | 1 |
| 4 | 2 | Call(increment, cid='bfb...', hid='5dd...') | 3 | Call(add, cid='a81...', hid='626...') | 5 |


This small example illustrates the main components of the CF workflow:
Expand Down Expand Up @@ -249,10 +256,10 @@ print(cf.df()[['accuracy', 'scale_data', 'train_svc', 'train_random_forest']].so

| | accuracy | scale_data | train_svc | train_random_forest |
|---:|-----------:|:---------------------------------------------|:--------------------------------------------|:------------------------------------------------------|
| 1 | 0.915 | Call(scale_data, cid='09f...', hid='d6b...') | | Call(train_random_forest, cid='e26...', hid='c42...') |
| 2 | 0.915 | Call(scale_data, cid='09f...', hid='d6b...') | | Call(train_random_forest, cid='e26...', hid='c42...') |
| 3 | 0.885 | | | Call(train_random_forest, cid='519...', hid='997...') |
| 0 | 0.82 | Call(scale_data, cid='09f...', hid='d6b...') | Call(train_svc, cid='6f4...', hid='7d9...') | |
| 2 | 0.82 | | Call(train_svc, cid='ddf...', hid='6a0...') | |
| 0 | 0.82 | | Call(train_svc, cid='ddf...', hid='6a0...') | |
| 1 | 0.82 | Call(scale_data, cid='09f...', hid='d6b...') | Call(train_svc, cid='6f4...', hid='7d9...') | |


So is this the full story of this dataset? We might want to investigate further
Expand Down Expand Up @@ -363,20 +370,20 @@ print(cf.df()[['n_estimators', 'kernel', 'accuracy', ]].sort_values('accuracy',

| | n_estimators | kernel | accuracy |
|---:|:-----------------------------|:-------------------------------------------|-----------:|
| 1 | | rbf | 0.915 |
| 5 | 5 | | 0.915 |
| 9 | | rbf | 0.91 |
| 2 | 20 | | 0.9 |
| 4 | 10 | | 0.9 |
| 6 | 10 | | 0.9 |
| 7 | 20 | | 0.9 |
| 0 | ValueCollection([20, 10, 5]) | ValueCollection(['linear', 'rbf', 'poly']) | 0.895 |
| 11 | ValueCollection([20, 10, 5]) | ValueCollection(['linear', 'rbf', 'poly']) | 0.895 |
| 13 | 5 | | 0.885 |
| 10 | | poly | 0.835 |
| 3 | | linear | 0.82 |
| 8 | | linear | 0.82 |
| 12 | | poly | 0.82 |
| 2 | 5 | | 0.915 |
| 11 | | rbf | 0.915 |
| 13 | | rbf | 0.91 |
| 0 | 10 | | 0.9 |
| 3 | 10 | | 0.9 |
| 6 | 20 | | 0.9 |
| 9 | 20 | | 0.9 |
| 8 | ValueCollection([20, 10, 5]) | ValueCollection(['linear', 'rbf', 'poly']) | 0.895 |
| 12 | ValueCollection([20, 10, 5]) | ValueCollection(['linear', 'rbf', 'poly']) | 0.895 |
| 4 | 5 | | 0.885 |
| 1 | | poly | 0.835 |
| 5 | | poly | 0.82 |
| 7 | | linear | 0.82 |
| 10 | | linear | 0.82 |


Columns where `n_estimators` is `None` correspond to the SVC models, and columns
Expand Down
Loading

0 comments on commit 7115126

Please sign in to comment.