Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Commit

Permalink
Regression tutorials (#1195) (#1195)
Browse files Browse the repository at this point in the history
Summary:
allow-large-files

### Motivation
Tutorial improvements for OSS release

### Changes proposed
* Merges robust and ordinary linear regression tutorials
* Cleans up robust regression to run without errors

Pull Request resolved: #1195

Pull Request resolved: #1276

Test Plan:
Manual review

### Types of changes
- [x] Docs change / refactoring / dependency upgrade
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

### Checklist
- [x] My code follows the code style of this project.
- [x] My change requires a change to the documentation.
- [x] I have updated the documentation accordingly.
- [x] I have read the **[CONTRIBUTING](https://github.com/facebookincubator/BeanMachine/blob/master/CONTRIBUTING.md)** document.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
- [x] The title of my pull request is a short description of the requested changes.

**Static Docs Preview: beanmachine**
|[Full Site](https://our.intern.facebook.com/intern/staticdocs/eph/D33124449/V5/beanmachine/)|

|**Modified Pages**|
|[docs/tutorials](https://our.intern.facebook.com/intern/staticdocs/eph/D33124449/V5/beanmachine/docs/tutorials/)|
Please provide clear instructions on how the changes were verified. Attach screenshots if applicable.

### Types of changes
- [ ] Docs change / refactoring / dependency upgrade
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

### Checklist
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have read the **[CONTRIBUTING](https://github.com/facebookresearch/beanmachine/blob/main/CONTRIBUTING.md)** document.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
- [ ] The title of my pull request is a short description of the requested changes.

Reviewed By: neerajprad

Differential Revision: D33124449

Pulled By: feynmanliang

fbshipit-source-id: 2a02cb073d87e7959e3c05ffc199e3a6bab8921b
  • Loading branch information
Feynman Tsing-Yang Liang authored and facebook-github-bot committed Dec 20, 2021
1 parent b5a7301 commit 4d80c84
Show file tree
Hide file tree
Showing 3 changed files with 32,373 additions and 33,234 deletions.
6 changes: 6 additions & 0 deletions docs/overview/tutorials/tutorials.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ This tutorial demonstrates modeling and running inference on a simple coin-flipp

This tutorial demonstrates modeling and running inference on a simple univariate linear regression model in Bean Machine. This should offer an accessible introduction to models that use PyTorch tensors and Newtonian Monte Carlo inference in Bean Machine. It will also teach you effective practices for prediction on new datasets with Bean Machine.

### Robust Linear Regression

[Open in GitHub](https://github.com/facebookresearch/beanmachine/blob/master/tutorials/Robust_Linear_Regression.ipynb)[Run in Google Colab](https://colab.research.google.com/github/facebookresearch/beanmachine/blob/master/tutorials/Robust_Linear_Regression.ipynb)

This tutorial illustrates a robust extension to the Linear Regression tutorial. A similar setup is employed except here the dataset is explicitly corrupted through the addition of outliers. You will learn how to modify the model such that correct inferences are recovered despite the presence of outliers.


### Logistic Regression

Expand Down
2 changes: 1 addition & 1 deletion src/beanmachine/ppl/diagnostics/common_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def std(query_samples: Tensor) -> Tensor:
def confidence_interval(query_samples: Tensor) -> Tensor:
percentile_list = [2.5, 50, 97.5]
query_dim = query_samples.shape[2:]
query_samples = query_samples.view(-1, *query_dim)
query_samples = query_samples.reshape(-1, *query_dim)
return torch.tensor(
np.percentile(query_samples.detach().numpy(), percentile_list, axis=0)
)
Expand Down
Loading

0 comments on commit 4d80c84

Please sign in to comment.