Skip to content

Commit

Permalink
Fix book workflow mistakes
Browse files Browse the repository at this point in the history
  • Loading branch information
Baxter Eaves committed Jan 17, 2024
1 parent 696c14d commit 9b5bdcc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions book/lace_preprocess_mdbook_yaml/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ path = "src/main.rs"
anyhow = "1.0"
clap = "4.2"
env_logger = "0.10"
lace_codebook = { path = "../../lace/lace_codebook", version = "0.4.0" }
lace_stats = { path = "../../lace/lace_stats", version = "0.2.0" }
lace_codebook = { path = "../../lace/lace_codebook", version = "0.5.0" }
lace_stats = { path = "../../lace/lace_stats", version = "0.2.1" }
log = "0.4"
mdbook = "0.4"
pulldown-cmark = { version = "0.9", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion book/src/pcc/pred.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ To visualize a higher uncertainty prediction, well use `given` conditions from a
<div class=tabbed-blocks>

```python
given = sats["Intelsat 902", :].to_dicts()[0]
given = satellites["Intelsat 902", :].to_dicts()[0]

# remove all missing data
given = { k: v for k, v in given.items() if not pd.isnull(v) }
Expand Down
22 changes: 11 additions & 11 deletions book/src/workflow/analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ animals.predict("swims")
animals.predict(
"swims",
&Given::<usize>::Nothing,
Some(PredictUncertaintyType::JsDivergence),
true,
None,
);
```
Expand All @@ -94,7 +94,7 @@ animals.predict(
Which outputs

```python
(0, 0.008287057807910558)
(0, 0.04384630488890182)
```

The first number is the prediction. Lace predicts that *an* animal does not
Expand All @@ -121,7 +121,7 @@ animals.predict(
&Given::Conditions(vec![
("flippers", Datum::Categorical(lace::Category::U8(1)))
]),
Some(PredictUncertaintyType::JsDivergence),
true,
None,
);
```
Expand All @@ -130,10 +130,10 @@ animals.predict(
Output:

```python
(1, 0.05008037071634858)
(1, 0.09588592928237495)
```

The uncertainty is higher, but still quite low.
The uncertainty is a little higher, but still quite low.

Let's add some more conditions that are indicative of a swimming animal and see
how that effects the uncertainty.
Expand All @@ -151,7 +151,7 @@ animals.predict(
("flippers", Datum::Categorical(lace::Category::U8(1))),
("water", Datum::Categorical(lace::Category::U8(1))),
]),
Some(PredictUncertaintyType::JsDivergence),
true,
None,
);
```
Expand All @@ -160,10 +160,10 @@ animals.predict(
Output:

```python
(1, 0.05116664361415335)
(1, 0.06761776764962134)
```

The uncertainty is basically the same.
The uncertainty is a bit lower now that we've added swim-consistent evidence.

How about we try to mess with Lace? Let's try to confuse it by asking it to
predict whether an animal with flippers that does not go in the water swims.
Expand All @@ -181,7 +181,7 @@ animals.predict(
("flippers", Datum::Categorical(lace::Category::U8(1))),
("water", Datum::Categorical(lace::Category::U8(0))),
]),
Some(PredictUncertaintyType::JsDivergence),
true,
None,
);
```
Expand All @@ -190,14 +190,14 @@ animals.predict(
Output:

```python
(0, 0.32863593091906085)
(0, 0.36077426258767503)
```

The uncertainty is really high! We've successfully confused lace.

## Evaluating likelihoods

Let's compute the likemportlihood to see what is going on
Let's compute the likelihood to see what is going on

<div class=tabbed-blocks>

Expand Down
1 change: 1 addition & 0 deletions pylace/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ maintainers = [
dependencies = [
'numpy ~= 1.21',
'matplotlib ~= 3.7.1',
'seaborn ~= 0.13',
'pandas ~= 1.3',
'polars ~= 0.16.14',
'scipy ~= 1.7',
Expand Down

0 comments on commit 9b5bdcc

Please sign in to comment.