https://github.com/sisl/aa228-cs238-student
Starter code and data files for AA228/CS238 at Stanford University, Autumn 2021
https://github.com/sisl/aa228-cs238-student
Last synced: 9 months ago
JSON representation
Starter code and data files for AA228/CS238 at Stanford University, Autumn 2021
- Host: GitHub
- URL: https://github.com/sisl/aa228-cs238-student
- Owner: sisl
- Created: 2020-09-03T07:07:14.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2024-09-12T21:25:18.000Z (almost 2 years ago)
- Last Synced: 2024-09-13T11:02:36.358Z (almost 2 years ago)
- Language: Julia
- Homepage:
- Size: 3.77 MB
- Stars: 20
- Watchers: 10
- Forks: 102
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AA228-CS238-Student
[](https://www.gradescope.com/courses/814395)
[AA228/CS238: Decision Making under Uncertainty](https://aa228.stanford.edu), Autumn 2024, Stanford University.
This repository provides starter code and data for Projects 1 and 2.
## Project 0:
[](https://aa228.stanford.edu/project-0/)
## Project 1: Bayesian Structure Learning
[](https://aa228.stanford.edu/project-1/) [](https://www.overleaf.com/read/hxwgtnksxtts)
[LaTeX Overleaf template](https://www.overleaf.com/read/hxwgtnksxtts): click the link, go to "Menu", and "Copy Project" (make sure you're signed into Overleaf). Note this is an optional template, you're free to use your own (or not even LaTeX).
project1/
├── data # CSV data files to apply structured learning
│ ├── small.csv # Titanic dataset¹
│ ├── medium.csv # Wine dataset²
│ └── large.csv # Secret dataset
├── example # Helpful examples
│ ├── example.gph # Example graph (3 parents, 2 children with 1 parent each and 1 child with 3 parents)
│ ├── example.csv # Example data generated from "example.gph"
│ ├── example.score # Bayesian score of the "examples.gph" given the data "examples.csv"
│ ├── examples.pdf # Visualized "examples.gph" as a TikZ graph
│ └── titanicexample.pdf # Simple example network using "small.csv"
├── project1.jl # Starter code in Julia (optional, meant to help)
└── project1.py # Starter code in Python (optional, meant to help)
1https://cran.r-project.org/web/packages/titanic/titanic.pdf
2https://archive.ics.uci.edu/ml/datasets/Wine+Quality
### Notes
- The starter code is there to help, but you're free to use any language.
- Use `example.gph` to validate your Bayesian scoring algorithm, not your structure learning algorithm.
### Graph Plotting
Here are some resources for plotting graphs in Julia, Python, and MATLAB.
- Julia:
- [`Graphs.jl`](https://github.com/JuliaGraphs/Graphs.jl/)
- [`TikzGraphs.jl`](https://nbviewer.jupyter.org/github/JuliaTeX/TikzGraphs.jl/blob/master/doc/TikzGraphs.ipynb)
- [`GraphPlot.jl`](https://github.com/JuliaGraphs/GraphPlot.jl)
- [`GraphRecipes.jl`](https://github.com/JuliaPlots/GraphRecipes.jl)
- Python:
- [`NetworkX`](https://networkx.github.io/documentation/stable/tutorial.html)
- MATLAB:
- [`GraphPlot`](https://www.mathworks.com/help/matlab/ref/matlab.graphics.chart.primitive.graphplot.html)
#### Julia Examples
##### TikzGraphs.jl
```julia
using Graphs # for DiGraph and add_edge!
using TikzGraphs # for TikZ plot output
# An example [Chvatal Graph](https://en.wikipedia.org/wiki/Chv%C3%A1tal_graph)
g = wheel_digraph(12)
# Create notional names for the nodes
node_names = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"]
# Create TikZ plot with node labels
p = plot(g, node_names)
# Save as PDF (using TikzPictures)
using TikzPictures # to save TikZ as PDF
save(PDF("wheel_tikz.pdf"), p)
```
##### GraphPlot.jl
```julia
using Graphs
using GraphPlot
g = wheel_digraph(12)
node_names = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"]
p = gplot(g; nodelabel=node_names)
# Save using Compose
using Compose, Cairo, Fontconfig
draw(PDF("wheel_graphplot.pdf", 16cm, 16cm), p)
```
#### GraphRecipes.jl
```julia
using Graphs
using Plots
using GraphRecipes
g = wheel_digraph(12)
node_names = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"]
p = graphplot(g; names=node_names, node_size=0.2)
savefig(p, "wheel_graphrecipes.pdf")
```
## Project 2: Reinforcement Learning
[](https://aa228.stanford.edu/project-2/) [](https://www.overleaf.com/read/gsptsmcrzpdv)
[LaTeX Overleaf template](https://www.overleaf.com/read/gsptsmcrzpdv): click the link, go to "Menu", and "Copy Project" (make sure you're signed into Overleaf). Note this is an optional template, you're free to use your own (or not even LaTeX).
project2/
└── data # CSV data files of (s,a,r,sp)
├── small.csv # 10x10 grid world
├── medium.csv # MountainCarContinuous-v0
└── large.csv # Secret RL problem
*Note: no starter code provided for Project 2.*
## Contact
Please post on [Ed](https://edstem.org/) with any questions regarding this code, the data, and the projects in general. We'd be happy to help!