# Agency

You can change the world.

You are powerful.
You are a critical thinker.
You solve problems.

Agency.
You have it.

# Teaching algorithms: a one-step look-ahead

### What does a one-step look-ahead for teaching discussion/recitation look like?

(And first off, what is a one-step look-ahead? It’s a technical term used in planning algorithms in artificial intelligence, used here to mean that although it’s hard to plan out exactly what to teach for the whole semester, what if we instead plan locally (in time) by looking at what students will need until you see them next? So, let’s plan one step ahead. In this case, since we have weekly discussion sections, this means one step = one week.)

Suppose the primary goal of discussion sections (recitations) are to prepare students for their homework and the next lecture. (The true primary goal is to make sure students learn the material, and the aforementioned is a proxy for doing so. In a well-designed class, these should be well aligned, but that won’t always be the case. [1]) “Prepare” is meant loosely and can include intuition, mathematical background, mechanics of problem solving, concrete examples and applications, visual/graphical explanations. Secondary goals of discussion sections may be to complement/supplement lecture, encourage students, gauge the class atmosphere, get some feedback on how the class is going, solidify your own knowledge of the material, practice public speaking, etc.

Then, to prepare for the next discussion, a one-step lookahead means:
– Anticipate the content of the lecture following the next discussion. This is happening in simulation because it’s not really possible to know exactly what the professor will cover, days in advance. Then, figure out what background students may likely need in advance. (On second thought, this can be pre-planned, with some coordination.)
– Go through the full homework due the following week (following Monday), in order to anticipate techniques and concepts helpful for the homework.
– Go through the discussion worksheet prepared by the course staff.
– Then, put everything together. Pick and choose from the discussion worksheet, with the selection guided by the first 2 items.
– Time permitting (though I believe this is very important), then try as much as possible to find alternative ways to present and explain the material — visually, through demonstration, through simulation, through math, through analogy, through concrete examples.

Let’s try out this policy!

[1] Thanks Shray for the feedback!

# Teaching Algorithms: Part 1

I want to write about teaching CS170 (Intro to CS Theory), but I don’t know how I feel about students reading my thoughts quiet yet, so maybe I’ll make these posts available later on. So that means that for now I can say anything. 🙂

EDIT (2016-07-10): Made the post public!

Here’s what I tried today.

## Let the students know that I’m on their side

I introduced myself, told them that I was a ugrad not too long ago, almost went into industry but then got sucked back into school. I told them that this is my first time teaching at Berkeley, and I’ll try to infer how they learn best, but please tell me and give me feedback on how to help better.

## Learn my audience

This is a continued lesson from my 6.UAT class on technical communication — always know who you are speaking to. My first class is about 1/2 sophomores and the rest is split among the other class years. My second section is split evenly among sophomores, juniors, and seniors. I asked if anyone is taking the class in preparation for more theory classes — there were no definitive hand raises in either of my sections. And about 60-70% of the students are interested in being more prepared for their technical interviews through this class.

## Get them talking

At the same time that I was learning my audience, I took this as an opportunity to get them all participating from the very beginning. It’s fairly innocuous — all they had to do was raise their arm. And then I asked them some more easy questions: How did you like yesterday’s lecture? (That was the first lecture of the semester.) I got some nods. What did you learn? Some noted the history of the word “algorithm” (named after Al Khwarizmi) and some noted a new way to multiply numbers. Did you enjoy the streaming algorithm example? (Umesh started the lecture right off with a concrete streaming problem.) Students nodded and a student exclaimed that he was asked the exact question during an interview. Then, an amazing thing happened. Another student agreed. A student followed saying that he enjoyed the applications of algorithms in the first lecture. Another student agreed, several more nodded in unison. Now they are in deep, they’re already participating in full! 🙂

If this doesn’t sound amazing… well, it was to me. I have a stark memory of the first recitation I taught of 6.004 (“Computational Structures”) back in 2012. It was a blank wall of stares. Expressionless, voiceless. I vaguely recall taking weeks to get the students participating at the same level that my students already are here. Not only is it sort of scary, it’s also impossible to get feedback with a class that doesn’t respond.

## Let the students learn themselves

One of the other instructors brought up that even though the students want you to lecture at them as much as possible, it’s really best for them to be doing problems. Doing problems is what prepares them for the homework. I tried this out, and the students really taught themselves. They defined BigO notation and gave every answer and every explanation (with small exceptions). And I learned from them too. (Though to be fair, this might not be the best gauge, since the material was review of prerequisite material.)

This was not my approach when teaching 6.004. Instead, I covered a small fraction of the problems piece by piece — sometimes actively participating with me on the board, sometimes in small groups — and I spend a good chunk of the recitation storytelling. I call it storytelling, but it was basically a more interactive lecture, because my goal was to tie the super high level and abstract concepts presented in lecture to the very concrete and nitty gritty problems we were doing in recitation. I felt that it was possible to succeed in 6.004 without making the tie, but in doing so, the students may lose out on a lifetime of understanding (ok, maybe an exaggeration). I tried my best to show why we are doing something, rather than how we are doing it. I forewent most of the “recommended” problems, hoping that if the students had some tangible understanding of the lecture material after I tied up some loose ends, then they would be more able and engaged in tackling the remaining problems.

I can already see some opportunity for augmenting the lectures with a bit more content in recitation. Only time will tell, but I suspect that the lectures will be fairly well tied to the problems. I believe the opportunity this time around is in taking the time to make precise some material from lecture, instilling mathematical understanding in a bite-sized way, and perhaps filling in the gaps where the lecture glosses over motivation. Reduce the hand-waving, tie some knots. Prepare these kids for definitely rocking those interviews. Perhaps inspire them to take more theoretical and mathematical courses.

Well, I’m still on the fence for now. These approaches aren’t necessarily conflicting, but there is a trade-off in preparation time.

## Get the students comfortable..?

Too comfortable, perhaps? One of the students came up at the end and apologized for falling asleep and then asked a question. And then I learned that this is probably a tiring day for them all because it’s the day of the Spring career fair!

# Happy New Year!

It was a pretty decent year, not without downs by any means, but certainly with many ups. It was a different year. It was a year of relatively little work (and motivation, alas), peace and solitary, and I finally managed to push health up from the dead bottom of the priority list. Wooo being an adult.

### Ups

• I got alone time (woah)! I got away from it all for a few months, and took the opportunity to take time for myself — read, game, think, whatever. I absolutely loved Pride and Prejudice, which was a total surprise to me. I found exercise I enjoy! Swimming and hiking! And renewed interest in learning Chinese!
• I traveled alone (briefly) for the first time! Kyoto was possibly one of the best choices for this because it gave me the opportunity to spend as damn long as I pleased to stare into the raked piles of sand and rock. On the other hand, I became very quickly tired of not being able to understand Japanese, so much so that I actually very much welcomed the fact that the temples were swarming with Chinese tourists.
• I killed my too-many-years-old email habit (checking email every 5 minutes)! I tried many many things, but the biggest thanks (or the last straw) goes to Inbox by Google, which allowed me to throttle the email pipe, subsequently making email uneventful (and boring) enough for me to wean myself off. My brother poses an interesting question — what bad habit has replaced it?
• And I gave my first ever conference talk in Kobe, Japan! The conference was super fun, and I met a lot of cool and fun people. It was also awesome that the conference folks took us out to see the longest suspension bridge in the world — perfect for a transportation crowd!
• A few friends from the department got together for our first magazine article!
• The year certainly ended on a strong note; not sure where that came from at all, but I’m very glad for it. NIPS15 was definitely my favorite conference yet and a great way to end the year — fun, inspiring, welcoming, and pleasantly surprising throughout. Afterwards, I thoroughly enjoyed my short visit to NYC to see friends old and older, stumbling into a TV show set, getting a sneak peak behind the scenes of the MTA (thanks robj!), and asking the secret service if Bill Clinton would please sign his book (they said no). And of course, we had lots of family time at home — watching the Star Wars trilogy and prequel in preparation.

### Mixed

• I grew up a little, learned a bunch about people and their motivations; I learned some things about my place in the world, so to say. And I learned even more about mental illness, depression, anxiety. But I’ll spare you the details.
• I finally tried out online dating! There was definitely a novelty factor, but I’m pretty mixed on presuming structure on the dating process. I can see how it’s desirable for some people, but it might not be for me.

### Downs

• I spend a fraction of it being stressed and unhappy about my work, and I got sick because of it for a while.
• I also spent most of the year not enjoying the things I usually enjoy or otherwise not doing them for some reason that escapes me — cooking, art, socializing, partying/hosting, etc.

Thanks to all of you, who were a part of this year. 🙂 And the downs are really opportunities in disguise, paving the path to trying new things, different things.

### Onwards to 2016

Last year, I may have leaned too far in the direction of keeping to myself, though I enjoy many aspects of it still. This year, I hope, will be a year of balance. I look forward to getting better in touch with friends. I look forward to teaching at Berkeley for the first time. I look forward to awesome and unknown projects — with friends, internships, and beyond. I look forward to reinvigorated research projects and findings, with research collaborations new and old. Everything is a learning process, and I’m grateful for this mindset.

Finally, these aren’t really resolutions for the new year, but reminders and intentions:

# Streamlining Anki with LaTeX

I recently started using Anki (open source spaced repetition flashcard tool) for reviewing, learning, and remembering technical material that I’ve learned over the years. Given the nature of optimization, machine learning, control theory, etc., it’s usually the case that I want to easily include expressions/equations in my flashcards. By default, any LaTeX code in an Anki flashcard needs to be wrapped in [latex] [/latex] tags, which is cumbersome and leads to stylistic inconsistencies. Additionally, in order to use your own custom commands and common packages, by default, they need to be added manually to an Anki note type header; that is, you cannot include them with an input{} command. This makes maintaining these commands cumbersome.

So, the solution is to
1. configure Anki to use LaTeX as its default typesetting system (the default Anki card editor is a light WYSIWYG editor), and
2. create and install a custom package that allows you to use and, importantly, maintain your custom commands with Anki.
Let’s go through how to setup both.

##### Requirements

This tutorial assumes that you have installed
Anki
– LaTeX distribution (e.g. for OSX, Windows).

## LaTeX as Anki’s default typesetting system [1]

### Create a LaTeX note type

1. Tools > Manage Note Types > Add
3. Name: LaTeX

### Modify the card format

Find “LaTeX” in the Note Types dialog list. Select “Cards…” button. Now surround the {{Front}} and {{Back}} tags in [latex] [/latex] tags, and add your preferred styling to the cards. (Sorry, you’ll have to remove the space in [ latex] in the instructions below because the same tag convert text to LaTeX in these posts too.)

#### Front Template:

[ latex]{{Front}}[/latex]


#### Styling:

.card {
font-family: arial;
font-size: 10px;
text-align: center;
color: black;
background-color: white;
}
img {
width: auto;
height: auto;
max-height:1000px;
}


#### Back Template:

{{FrontSide}}

[ latex]{{Back}}[/latex]


## Custom commands in LaTeX note type

The next thing you’ll want to do is modify your LaTeX note type’s Header and Footer with the commands you commonly use. To edit the Header/Footer, return to the Note Types dialog and select “Options…”. The default looks like this:

\documentclass[10pt]{article}
\usepackage{amssymb,amsmath,amsfonts,mathrsfs}
\usepackage[paperwidth=5in, paperheight=100in]{geometry}
\pagestyle{empty}
\setlength{\parindent}{0in}
\begin{document}


#### Footer:

\end{document}


### Creating your own LaTeX package [2]

While adding your commonly used packages and commands is useful, I like to maintain a common set of commands/packages that I can simply include in my new documents (without needing to update the Header/Footer in Anki every time I add something new). However, by default, Anki does not allow for input or def in its preamble, so including your (self-updating) custom and usual commands is not so straightforward. Fortunately, you can include your commands in a custom LaTeX package and invoke that package instead. For example, a LaTeX package called giraffemath.sty is defined by including the line \ProvidesPackage{giraffemath}. Here is a barebones example:

\ProvidesPackage{giraffemath}
\newcommand{\R}{\ensuremath{\mathbb{R}}}
\newcommand{\C}{\ensuremath{\mathbb{C}}}
\newcommand{\Z}{\ensuremath{\mathbb{Z}}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\F}{\mathbb{F}}
\newcommand{\W}{\mathbb{W}}


### Installing and including the package [3]

Now, let’s add your custom package(s) to your local latex packages directory. We’ll first create a directory to house all your custom packages, and then we’ll symlink it to your local distribution installation directory’s texmf-dist subdirectory. On my machine (OSX), my path is /usr/local/texlive/2013/texmf-dist.

mkdir ~/Dropbox/custom-tex-packages
cp giraffemath.sty ~/Dropbox/custom-tex-packages
ln -s ~/Dropbox/custom-tex-packages/ kpsewhich -var-value TEXMFHOME/tex/latex/custom-tex-packages


### Refreshing the LaTeX tree [4]

Next, we will need to refresh the tex packages to pick up the changes you have made to the packages. NOTE: You will need to run this command each time you make a change to your custom packages.

sudo texhash
sudo mktexlsr


\documentclass[10pt]{article}
\usepackage{amssymb,amsmath,amsfonts,mathrsfs}
\usepackage[paperwidth=5in, paperheight=100in]{geometry}
\pagestyle{empty}
\setlength{\parindent}{0in}

\usepackage{giraffemath}

\begin{document}


That’s it! Now when you create a new Anki card, you can choose LaTeX as your note type. LaTeX away! (Wrap inline math in .) Here’s an example: