StatQuest: t-SNE, clearly explained!

Here’s how to create a t-SNE graph in R (this is copied from the help file for Rtsne)…

library("Rtsne")
iris_unique <- unique(iris) # Remove duplicates
iris_matrix <- as.matrix(iris_unique[,1:4])
set.seed(42) # Set a seed if you want reproducible results
tsne_out <- Rtsne(iris_matrix) # Run TSNE
 
# Show the objects in the 2D tsne representation
plot(tsne_out$Y,col=iris_unique$Species)
Advertisements

StatQuest: How to make a Mean Pizza Crust!

Here’s the link to a PDF of the recipe.

Dough for Pizzas or Bread

Based on a recipe in Flour, Water, Salt, Yeast by Ken Forkish.

Poolish

  • 500 grams bread flour
  • ⅛ tsp. instant yeast
  • 500 grams water (cold in summer, room temp. in winter)

First thing in the morning use a rubber or silicone spatula to mix together the poolish in a large bowl and cover the bowl. Go to work. When you get home in the evening, add:

  • 500 grams bread flour
  • 20 grams salt
  • 200 grams water (room temp.) – at 8,000+ feet above sea level, add 300 grams of water.
  • (optional) ¼ tsp. yeast

Combine and knead with one hand. The easiest way to combine the ingredients is to squeeze together clumps of dry flour and poolish until everything is incorporated. Kneading this wet dough means grabbing a handful of it, stretching it out and folding it over the remaining dough. The dough will stick to your hands like crazy. Just go with it. After a few minutes of kneading, run your sticky hand under the tap, just enough to get it wet, and then knead a little more. A lot of the dough that was stuck to your hand before will come off.

  1. 1 ) Let the dough rest for 15 minutes. Wet your hand and grab one side of the dough. Pull it up and fold it over. Rotate the dough 90 degrees and fold again. Repeat until you’ve folded all four sides of the dough over on itself.
  2. 2)  Let rest for 15 minutes. Fold four times
  3. 3)  Let rest for 15 minutes. Fold four times.
  4. 4)  Let rest for 15 minutes. Fold four times.

Alternatively, you can fold the dough every 30 minutes for 2 hours. The goal is to get the dough stretchy and for the yeast to start working. You know when the yeast is ready when you can feel little bubbles of air in the dough.

If making pizza dough: Put oil in the bottom of 5 tuppers (1 tsp. per container). Divide the dough into five pieces. Working with one piece at a time, shape it into a ball and put in a tupper, using the dough to rub the oil around the tupper. Put a lid on the tupper and put it in the fridge.  The next day (or up to 3 days later), when you get home from work, put a pizza stone on the top rack in the oven and preheat it under the broiler (high temp) for 10 minutes. Shape and top the pizza. (NOTE: The first time you do this, add less sauce, cheese and toppings than you think you’ll need – that might be just about perfect). Cook for 5 minutes under a low broiler, then turn the heat back up to high for the last minute. (NOTE: If your oven doesn’t have multiple broiler settings, alternate between bake (or convection bake) and broil.)

If making 2 loaves of bread: Prepare two round bannetons by generously sprinkling rice flour and bran flakes in them. Divide the dough in half. Working with one piece at a time, shape it into a ball and place into a banneton. Sprinkle rice flour and bran flakes on top and put the whole thing in a plastic bag (like the bags you put produce in at the grocery store) and then into the fridge. Either the next morning or the next evening bake. Take the loaves out of the fridge and preheat the oven to 500F (457 convection). When the oven is hot, flip one loaf into a dutch oven, score the top with a sharp knife, put the lid on and bake for 30 minutes. Take the lid off and bake for another 20 minutes. Bake the second loaf the same way. (NOTE: If you have two dutch ovens, you can bake both at the same time.) NOTE: As crazy as this might sound, these loaves taste better if, once they have cooled, you reheat them in an oven set at 400 for about 20 minutes. Personally, I like to eat one of the loaves fresh and freeze the other in a large plastic bag. When I’m ready for the second loaf, I toss it directly from the freezer to a cold oven and set it to bake at 400F for 20 to 30 minutes. You can tell if it’s done if you stick a thermometer into the center of the loaf and it is measuring anything from 170F or higher. This loaf will be even better than the first!

If making 1 loaf and 3 pizzas: Divide the dough in half and use one half to make a loaf as described above. Divide the remaining dough into 3 pieces and prepare as described above.

Alternative Schedule: Mix the poolish at night, mix the dough and shape the loaves/pizza dough in the morning, bake in the evening.
BONUS PIZZA SAUCE RECIPE!!!!

  • 1 28 oz. can of crushed tomatoes
  • 1 tsp. dried oregano
  • 1 tsp. dried basil
  • 1 tsp. garlic powder
  • 1 Tbs. red wine vinegar
  • Salt to taste.

Mix everything but the salt together in a medium sized non-reactive (i.e. plastic or glass) bowl. Taste. Add a little salt (up to one tsp.) if it needs it.

StatQuest: Linear Regression (aka GLMs, part 1)

Linear regression is the first part in a bunch of videos I’m going to do about General Linear Models.

I also made a companion StatQuest that shows how to do linear regression in R:

Here’s the code from the video if you want to try it out yourself:

## Here's the data from the example:
mouse.data <- data.frame(
  weight=c(0.9, 1.8, 2.4, 3.5, 3.9, 4.4, 5.1, 5.6, 6.3),
  size=c(1.4, 2.6, 1.0, 3.7, 5.5, 3.2, 3.0, 4.9, 6.3))

mouse.data # print the data to the screen in a nice format

## plot a x/y scatter plot with the data
plot(mouse.data$weight, mouse.data$size)

## create a "linear model" - that is, do the regression
mouse.regression <- lm(size ~ weight, data=mouse.data)
## generate a summary of the regression
summary(mouse.regression)

## add the regression line to our x/y scatter plot
abline(mouse.regression, col="blue")