> 2021年07月28日信息消化 ### 每天学点算法 ### Week 6 Evaluating a Hypothesis ###### Follow-Up Test Once we have done some trouble shooting for errors in our predictions by: - Getting more training examples - Trying smaller sets of features - Trying additional features - Trying polynomial features - Increasing or decreasing λ A hypothesis may have a low error for the training examples but still be inaccurate (because of overfitting). Thus, to evaluate a hypothesis, given a dataset of training examples, we can split up the data into two sets: a **training set** and a **test set**. Typically, the training set consists of 70 % of your data and the test set is the remaining 30 %. The new procedure using these two sets is then: 1. Learn $\Theta$ and minimize $J_{train}(\Theta)$ using the training set 2. Compute the test set error $J_{test}(\Theta)$ ##### The test set error For linear regression: $$ J_{test}(\Theta)=\frac{1}{2m_{test}}\sum_{i=1}^{m_{test}}(h_{\theta}(x_{test}^{(i)})-y_{test}^{(i)})^2 $$ For classification ~ Misclassification error (aka 0/1 misclassification error): $$ err(hΘ(x),y)= \\ 1\ \ \ if\ hΘ(x)≥0.5\ and\ y=0\ or\ hΘ(x)<0.5\ and\ y=1 \\ 0\ \ \ otherwise $$ This gives us a binary 0 or 1 error result based on a misclassification. The average test error for the test set is: $Test Error=\frac{1}{m_{test}}\sum_{i=1}^{m_{test}}err(h_{\theta}(x_{test}^{(i)}),y_{test}^{(i)})$ This gives us the proportion of the test data that was misclassified. Mark as completed # Model Selection and Train/Validation/Test Sets Just because a learning algorithm fits a training set well, that does not mean it is a good hypothesis. It could over fit and as a result your predictions on the test set would be poor. The error of your hypothesis as measured on the data set with which you trained the parameters will be lower than the error on any other data set. Given many models with different polynomial degrees, we can use a systematic approach to identify the 'best' function. In order to choose the model of your hypothesis, you can test each degree of polynomial and look at the error result. One way to break down our dataset into the three sets is: - Training set: 60% - Cross validation set: 20% - Test set: 20% We can now calculate three separate error values for the three different sets using the following method: 1. Optimize the parameters in Θ using the training set for each polynomial degree. 2. Find the polynomial degree d with the least error using the cross validation set. 3. Estimate the generalization error using the test set with $J_{test}(\Theta^{(d)})$, (d = theta from polynomial with lower error); This way, the degree of the polynomial d has not been trained using the test set. ###### Follow-up Test  ### Pairing fonts – 3 ways to find great typeface combinations origin: [Pairing fonts – 3 ways to find great typeface combinations](https://pimpmytype.com/pairing-fonts/?ref=betterwebtype&mc_cid=c2c6151c78) ##### Level 1: Use type families Type families or super families are designed in different typographic styles with the aim to **fit together.** Popular examples are: ##### Level 2: Make it obviously different **Try to avoid very similar combinations.** Avoid to combine two fonts from the same category, a sans-serif with another sans-serif, or one script font for your ``, and another script font for your `` and ``. Make it the same or make it different. ##### Level 3: Look at the typeface’s construction - **Letter forms** – are the lower case a and g single-story or two-story? - **Apertures** – is the inner space of the letter shapes more open or closed (see the e, a and s)? - **Angle** – what’s the angle (look at the o to see this)? - **Contrast** – are the strokes even or contrasting? - **x-height** – How’s the relationship of the lower case letters to the upper case letters? - **Width** – are the characters narrow, regular or wide? **Not every criterion hast to fit here,** I find the apertures, letter shapes, and angle are the most important. Árida with its two-story a and g has opened apertures to the surrounding (look at the e and s), is pretty angled (see the thinnest parts of the o) and has contrasting strokes. ### Why Math Class Is Boring—and What to Do About It origin: [Why Math Class Is Boring—and What to Do About It](https://fs.blog/2021/07/mathematicians-lament/) There are two types of people in the world: those who enjoyed math class in school, and the other 98% of the population. And what if art students spent years studying paints and brushes, without ever getting to unleash their imaginations on a blank canvas? > “After class I spoke with the teacher. ‘So your students don’t actually do any painting?’ I asked. > ‘Well, next year they take Pre-Paint-by-Numbers. That prepares them for the main Paint-by-Numbers sequence in high school. So they’ll get to use what they’ve learned here and apply it to real-life painting situations—dipping the brush into paint, wiping it off, stuff like that. Of course we track our students by ability. The really excellent painters—the ones who know their colors and brushes backwards and forwards—they get to the actual painting a little sooner, and some of them even take the Advanced Placement classes for college credit. But mostly we’re just trying to give these kids a good foundation in what painting is all about, so when they get out there in the real world and paint their kitchen they don’t make a total mess of it.'” As laughable as we may find these vignettes, Lockhart considers them analogous to how we teach math as something devoid of expression, exploration, or discovery. Few who have spent countless hours on the equivalent of paint-by-numbers in the typical math class could understand that “there is nothing as dreamy and poetic, nothing as radical, subversive, and psychedelic, as mathematics.” Like other arts, its objective is the creation of patterns. The material mathematical patterns are made from is not paint or musical notes, however, but ideas. 尽管我们可能觉得这些小插曲很可笑,但洛克哈特认为它们类似于我们把数学教成没有表达、探索或发现的东西。 很少有人在典型的数学课上花了无数个小时去研究相当于按数字画图的东西,他们能够理解,"没有什么比数学更梦幻和诗意,没有什么比数学更激进、更颠覆和更迷幻"。像其他艺术一样,它的目标是创造模式。然而,数学模式的材料不是油漆或音符,而是思想。 In mathematics, Lockhart explains, there is no reality to get in your way. You can imagine a geometric shape with perfect edges, even though such a thing could never exist in the physical, three-dimensional world. Then you can ask questions of it and discover new things through experimentation with the imaginary. That process—“*asking simple and elegant questions about our imaginary creations, and crafting satisfying and beautiful explanations*”—is mathematics itself. What we learn in school is merely the end product. **We don’t teach the process of creating math. We teach only the steps to repeat someone else’s creation, without exploring how they got there—or why.** > “What other subject is routinely taught without any mention of its history, philosophy, thematic development, aesthetic criteria, and current status? What other subject shuns its primary sources—beautiful works of art by some of the most creative minds in history—in favor of third-rate textbook bastardizations?” Efforts to engage students with mathematics often take the form of trying to make it relevant to their everyday lives or presenting problems as saccharine narratives. Once again, Lockhart doesn’t believe this would be problems if students got to engage in the actual creative process: “We don’t need to bend over backwards to give mathematics relevance. It has relevance in the same way that any art does: that of being a meaningful human experience.” An escape from daily life is generally more appealing than an emphasis on it. Children would have as much fun playing with symbols as they have playing with paints. > “The trouble is that math, like painting or poetry, is hard creative work. That makes it very difficult to teach. Mathematics is a slow, contemplative process. It takes time to produce a work of art, and it takes a skilled teacher to recognize one. Of course it’s easier to post a set of rules than to guide aspiring young artists, and it’s easier to write a VCR manual than to write an actual book with a point of view.“ **We should probably let go of the idea that doing math is about getting the right answer. Being creative is never about getting to a destination.** Above all, mathematics should be something we engage with because we find it to be a fun, challenging process capable of teaching us new ways to think or allowing us to express ourselves. The less practical utility or relevance to the rest of our lives it has, the more we’re truly engaging with it as an art. ### The 10 Best Tools to Stay Mentally Sharp at Work origin: [The 10 Best Tools to Stay Mentally Sharp at Work](https://www.scotthyoung.com/blog/2021/07/26/the-10-best-tools-to-stay-mentally-sharp-at-work/) - Take “Smart” Breaks - Briefly meditating or just sitting with your eyes closed - Going for a ten-minute walk - Stretching or doing push-ups - Getting a glass of water - Shift to the “Meta” Task - Say you’re writing an essay, and you’ve been staring at a blank page for an hour. Switching to the meta task would mean, instead of writing the essay, write about how you don’t know what to write. - Apply the Yerkes-Dodson Law - The Yerkes–Dodson law is an empirical relationship between pressure and performance, originally developed by psychologists Robert M. Yerkes and John Dillingham Dodson in 1908. The law dictates that performance increases with physiological or mental arousal, but only up to a point.[Wikipedia](https://en.wikipedia.org/wiki/Yerkes-Dodson_law) - Set Specific, Achievable, Short-Term Targets - Cultivate an Interruption-Free Environment - The key to improving focus is to negotiate your environment in advance. Most of the time, the people around you would like you to be more productive. The problem is one of communicating what you need and making concessions to keep your relationships smooth. A boss might be fine with a reply in an hour, provided she knows you haven’t forgotten the new task. Colleagues (and many children) can respect a closed door if they know it means you’re doing deep work. The difficulty is often one of planning the environment ahead of time, not just getting frustrated afterward. - Don’t Play the Polar Bear Game - Some days you’ll feel sharp—the writing will flow, the code will compile and your problems will seem easy. Other days will feel more like a slog. When the latter come, don’t beat yourself up. Just calm your mind and let yourself gently return to the task. ### 一点收获 - [**@Ross Simmonds**](https://click.mlsend.com/link/c/YT0xNzM5MjIyNzIzMTIyNDM1Nzk2JmM9bjhyNSZlPTE5MjgmYj02Njk4MTkyODMmZD10OXI5bjhn.SMvvhpaJIG8gbnxdDAhQkzbSvsRQIvupxgRQOI58sZU) — Copy Experiment: Don’t write a “call to action” Write a “call to value” — Here’s what I mean… [Get started] -> [Plan your finances] [Sign up] -> [Grow your following] [Try Now] -> [Launch your site] See the difference? Test it and see what works best for you.