Skip to content

Commit

Permalink
Initial prep
Browse files Browse the repository at this point in the history
  • Loading branch information
cgpotts committed Mar 18, 2022
1 parent 23b120f commit d205976
Show file tree
Hide file tree
Showing 67 changed files with 1,363 additions and 2,750 deletions.
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@

Code for [the Stanford course](http://web.stanford.edu/class/cs224u/).

Spring 2021
Spring 2022

# Instructors

* [Bill MacCartney](http://nlp.stanford.edu/~wcmac/)
* [Christopher Potts](http://web.stanford.edu/~cgpotts/)
[Christopher Potts](http://web.stanford.edu/~cgpotts/)


# Core components
Expand Down
2 changes: 1 addition & 1 deletion colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import matplotlib.patches as mpatch

__author__ = "Christopher Potts"
__version__ = "CS224u, Stanford, Spring 2021"
__version__ = "CS224u, Stanford, Spring 2022"


TURN_BOUNDARY = " ### "
Expand Down
30 changes: 14 additions & 16 deletions colors_overview.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"outputs": [],
"source": [
"__author__ = \"Christopher Potts\"\n",
"__version__ = \"CS224u, Stanford, Spring 2021\""
"__version__ = \"CS224u, Stanford, Spring 2022\""
]
},
{
Expand All @@ -26,23 +26,21 @@
"1. [Overview](#Overview)\n",
"1. [Set-up](#Set-up)\n",
"1. [The corpus](#The-corpus)\n",
" 1. [Corpus reader](#Corpus-reader)\n",
" 1. [ColorsCorpusExample instances](#ColorsCorpusExample-instances)\n",
" 1. [Displaying examples](#Displaying-examples)\n",
" 1. [Color representations](#Color-representations)\n",
" 1. [Utterance texts](#Utterance-texts)\n",
" 1. [Far, Split, and Close conditions](#Far,-Split,-and-Close-conditions)\n",
" 1. [Corpus reader](#Corpus-reader)\n",
" 1. [ColorsCorpusExample instances](#ColorsCorpusExample-instances)\n",
" 1. [Far, Split, and Close conditions](#Far,-Split,-and-Close-conditions)\n",
"1. [Toy problems for development work](#Toy-problems-for-development-work)\n",
"1. [Core model](#Core-model)\n",
" 1. [Toy dataset illustration](#Toy-dataset-illustration)\n",
" 1. [Predicting sequences](#Predicting-sequences)\n",
" 1. [Listener-based evaluation](#Listener-based-evaluation)\n",
" 1. [Other prediction and evaluation methods](#Other-prediction-and-evaluation-methods)\n",
" 1. [Cross-validation](#Cross-validation)\n",
" 1. [Toy dataset illustration](#Toy-dataset-illustration)\n",
" 1. [Predicting sequences](#Predicting-sequences)\n",
" 1. [Listener-based evaluation](#Listener-based-evaluation)\n",
" 1. [BLEU scores](#BLEU-scores)\n",
" 1. [Other prediction and evaluation methods](#Other-prediction-and-evaluation-methods)\n",
" 1. [Cross-validation](#Cross-validation)\n",
"1. [Baseline SCC model](#Baseline-SCC-model)\n",
"1. [Modifying the core model](#Modifying-the-core-model)\n",
" 1. [Illustration: LSTM Cells](#Illustration:-LSTM-Cells)\n",
" 1. [Illustration: Deeper models](#Illustration:-Deeper-models)"
" 1. [Illustration: LSTM Cells](#Illustration:-LSTM-Cells)\n",
" 1. [Illustration: Deeper models](#Illustration:-Deeper-models)"
]
},
{
Expand Down Expand Up @@ -1822,7 +1820,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -1836,7 +1834,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down
40 changes: 20 additions & 20 deletions evaluation_methods.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"outputs": [],
"source": [
"__author__ = \"Christopher Potts\"\n",
"__version__ = \"CS224u, Stanford, Spring 2021\""
"__version__ = \"CS224u, Stanford, Spring 2022\""
]
},
{
Expand All @@ -35,28 +35,28 @@
"1. [Your projects](#Your-projects)\n",
"1. [Set-up](#Set-up)\n",
"1. [Data organization](#Data-organization)\n",
" 1. [Train/dev/test](#Train/dev/test)\n",
" 1. [No fixed splits](#No-fixed-splits)\n",
" 1. [Train/dev/test](#Train/dev/test)\n",
" 1. [No fixed splits](#No-fixed-splits)\n",
"1. [Cross-validation](#Cross-validation)\n",
" 1. [Random splits](#Random-splits)\n",
" 1. [K-folds](#K-folds)\n",
" 1. [Random splits](#Random-splits)\n",
" 1. [K-folds](#K-folds)\n",
"1. [Baselines](#Baselines)\n",
" 1. [Baselines are crucial for strong experiments](#Baselines-are-crucial-for-strong-experiments)\n",
" 1. [Random baselines](#Random-baselines)\n",
" 1. [Task-specific baselines](#Task-specific-baselines)\n",
" 1. [Baselines are crucial for strong experiments](#Baselines-are-crucial-for-strong-experiments)\n",
" 1. [Random baselines](#Random-baselines)\n",
" 1. [Task-specific baselines](#Task-specific-baselines)\n",
"1. [Hyperparameter optimization](#Hyperparameter-optimization)\n",
" 1. [Rationale](#Rationale)\n",
" 1. [The ideal hyperparameter optimization setting](#The-ideal-hyperparameter-optimization-setting)\n",
" 1. [Practical considerations, and some compromises](#Practical-considerations,-and-some-compromises)\n",
" 1. [Hyperparameter optimization tools](#Hyperparameter-optimization-tools)\n",
" 1. [Rationale](#Rationale)\n",
" 1. [The ideal hyperparameter optimization setting](#The-ideal-hyperparameter-optimization-setting)\n",
" 1. [Practical considerations, and some compromises](#Practical-considerations,-and-some-compromises)\n",
" 1. [Hyperparameter optimization tools](#Hyperparameter-optimization-tools)\n",
"1. [Classifier comparison](#Classifier-comparison)\n",
" 1. [Practical differences](#Practical-differences)\n",
" 1. [Confidence intervals](#Confidence-intervals)\n",
" 1. [Wilcoxon signed-rank test](#Wilcoxon-signed-rank-test)\n",
" 1. [McNemar's test](#McNemar's-test)\n",
" 1. [Practical differences](#Practical-differences)\n",
" 1. [Confidence intervals](#Confidence-intervals)\n",
" 1. [Wilcoxon signed-rank test](#Wilcoxon-signed-rank-test)\n",
" 1. [McNemar's test](#McNemar's-test)\n",
"1. [Assessing models without convergence](#Assessing-models-without-convergence)\n",
" 1. [Incremental dev set testing](#Incremental-dev-set-testing)\n",
" 1. [Learning curves with confidence intervals](#Learning-curves-with-confidence-intervals)\n",
" 1. [Incremental dev set testing](#Incremental-dev-set-testing)\n",
" 1. [Learning curves with confidence intervals](#Learning-curves-with-confidence-intervals)\n",
"1. [The role of random parameter initialization](#The-role-of-random-parameter-initialization)\n",
"1. [Closing remarks](#Closing-remarks)"
]
Expand Down Expand Up @@ -1009,7 +1009,7 @@
"metadata": {
"celltoolbar": "Slideshow",
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -1023,7 +1023,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down
42 changes: 21 additions & 21 deletions evaluation_metrics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"outputs": [],
"source": [
"__author__ = \"Christopher Potts\"\n",
"__version__ = \"CS224u, Stanford, Spring 2021\""
"__version__ = \"CS224u, Stanford, Spring 2022\""
]
},
{
Expand All @@ -34,26 +34,26 @@
"1. [Overview](#Overview)\n",
"1. [Set-up](#Set-up)\n",
"1. [Classifier metrics](#Classifier-metrics)\n",
" 1. [Confusion matrix](#Confusion-matrix)\n",
" 1. [Accuracy](#Accuracy)\n",
" 1. [Precision](#Precision)\n",
" 1. [Recall](#Recall)\n",
" 1. [F scores](#F-scores)\n",
" 1. [Macro-averaged F scores](#Macro-averaged-F-scores)\n",
" 1. [Weighted F scores](#Weighted-F-scores)\n",
" 1. [Micro-averaged F scores](#Micro-averaged-F-scores)\n",
" 1. [Precision–recall curves](#Precision–recall-curves)\n",
" 1. [Average precision](#Average-precision)\n",
" 1. [Receiver Operating Characteristic (ROC) curve](#Receiver-Operating-Characteristic-(ROC)-curve)\n",
" 1. [Confusion matrix](#Confusion-matrix)\n",
" 1. [Accuracy](#Accuracy)\n",
" 1. [Precision](#Precision)\n",
" 1. [Recall](#Recall)\n",
" 1. [F scores](#F-scores)\n",
" 1. [Macro-averaged F scores](#Macro-averaged-F-scores)\n",
" 1. [Weighted F scores](#Weighted-F-scores)\n",
" 1. [Micro-averaged F scores](#Micro-averaged-F-scores)\n",
" 1. [Precision–recall curves](#Precision–recall-curves)\n",
" 1. [Average precision](#Average-precision)\n",
" 1. [Receiver Operating Characteristic (ROC) curve](#Receiver-Operating-Characteristic-(ROC)-curve)\n",
"1. [Regression metrics](#Regression-metrics)\n",
" 1. [Mean squared error](#Mean-squared-error)\n",
" 1. [R-squared scores](#R-squared-scores)\n",
" 1. [Pearson correlation](#Pearson-correlation)\n",
" 1. [Spearman rank correlation](#Spearman-rank-correlation)\n",
" 1. [Mean squared error](#Mean-squared-error)\n",
" 1. [R-squared scores](#R-squared-scores)\n",
" 1. [Pearson correlation](#Pearson-correlation)\n",
" 1. [Spearman rank correlation](#Spearman-rank-correlation)\n",
"1. [Sequence prediction](#Sequence-prediction)\n",
" 1. [Word error rate](#Word-error-rate)\n",
" 1. [BLEU scores](#BLEU-scores)\n",
" 1. [Perplexity](#Perplexity)\n",
" 1. [Word error rate](#Word-error-rate)\n",
" 1. [BLEU scores](#BLEU-scores)\n",
" 1. [Perplexity](#Perplexity)\n",
"1. [Other resources](#Other-resources)"
]
},
Expand Down Expand Up @@ -3926,7 +3926,7 @@
"metadata": {
"celltoolbar": "Slideshow",
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -3940,7 +3940,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions feature_attribution.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"outputs": [],
"source": [
"__author__ = \"Christopher Potts\"\n",
"__version__ = \"CS224u, Stanford, Summer 2021\""
"__version__ = \"CS224u, Stanford, Summer 2022\""
]
},
{
Expand Down Expand Up @@ -1027,7 +1027,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -1041,7 +1041,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down
16 changes: 8 additions & 8 deletions finetuning.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"outputs": [],
"source": [
"__author__ = \"Christopher Potts\"\n",
"__version__ = \"CS224u, Stanford, Spring 2021\""
"__version__ = \"CS224u, Stanford, Spring 2022\""
]
},
{
Expand All @@ -27,12 +27,12 @@
"1. [General set-up](#General-set-up)\n",
"1. [Hugging Face BERT models and tokenizers](#Hugging-Face-BERT-models-and-tokenizers)\n",
"1. [BERT featurization with Hugging Face](#BERT-featurization-with-Hugging-Face)\n",
" 1. [Simple feed-forward experiment](#Simple-feed-forward-experiment)\n",
" 1. [A feed-forward experiment with the sst module](#A-feed-forward-experiment-with-the-sst-module)\n",
" 1. [An RNN experiment with the sst module](#An-RNN-experiment-with-the-sst-module)\n",
" 1. [Simple feed-forward experiment](#Simple-feed-forward-experiment)\n",
" 1. [A feed-forward experiment with the sst module](#A-feed-forward-experiment-with-the-sst-module)\n",
" 1. [An RNN experiment with the sst module](#An-RNN-experiment-with-the-sst-module)\n",
"1. [BERT fine-tuning with Hugging Face](#BERT-fine-tuning-with-Hugging-Face)\n",
" 1. [HfBertClassifier](#HfBertClassifier)\n",
" 1. [HfBertClassifier experiment](#HfBertClassifier-experiment)"
" 1. [HfBertClassifier](#HfBertClassifier)\n",
" 1. [HfBertClassifier experiment](#HfBertClassifier-experiment)"
]
},
{
Expand Down Expand Up @@ -996,7 +996,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -1010,7 +1010,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down
8 changes: 4 additions & 4 deletions hw_colors.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"outputs": [],
"source": [
"__author__ = \"Christopher Potts\"\n",
"__version__ = \"CS224u, Stanford, Summer 2021\""
"__version__ = \"CS224u, Stanford, Summer 2022\""
]
},
{
Expand Down Expand Up @@ -651,7 +651,7 @@
"\n",
"The above model uses a random initial embedding, as configured by the decoder used by `ContextualColorDescriber`. This homework question asks you to consider using GloVe inputs. \n",
"\n",
"__Your task__: Complete `create_glove_embedding` so that it creates a GloVe embedding based on your model vocabulary. This isn't mean to be analytically challenging, but rather just to create a basis for you to try out other kinds of rich initialization."
"__Your task__: Complete `create_glove_embedding` so that it creates a GloVe embedding based on your model vocabulary. This isn't meant to be analytically challenging, but rather just to create a basis for you to try out other kinds of rich initialization."
]
},
{
Expand Down Expand Up @@ -1287,7 +1287,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -1301,7 +1301,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.8"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down
14 changes: 7 additions & 7 deletions hw_formatting_guide.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"outputs": [],
"source": [
"__author__ = \"Insop\"\n",
"__version__ = \"CS224u, Stanford, Spring 2021\""
"__version__ = \"CS224u, Stanford, Spring 2022\""
]
},
{
Expand All @@ -25,10 +25,10 @@
"\n",
"1. [Overview](#Overview)\n",
"1. [Original system code](#Original-system-code)\n",
" 1. [Modifying provided code in the original notebook](#Modifying-provided-code-in-the-original-notebook)\n",
" 1. [External imports](#External-imports)\n",
" 1. [Custom code](#Custom-code)\n",
" 1. [Long running test code](#Long-running-test-code)"
" 1. [Modifying provided code in the original notebook](#Modifying-provided-code-in-the-original-notebook)\n",
" 1. [External imports](#External-imports)\n",
" 1. [Custom code](#Custom-code)\n",
" 1. [Long running test code](#Long-running-test-code)"
]
},
{
Expand Down Expand Up @@ -289,7 +289,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -303,7 +303,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.9.7"
},
"widgets": {
"state": {},
Expand Down
4 changes: 2 additions & 2 deletions hw_rel_ext.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -760,7 +760,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.9.7"
},
"widgets": {
"state": {},
Expand Down
Loading

0 comments on commit d205976

Please sign in to comment.