avatarMazen Ahmed

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

5548

Abstract

th, food scientists simply build on what we are wired to crave.</p><p id="a8dc">From <a href="https://www.webmd.com/diet/features/13-ways-to-fight-sugar-cravings#1">WebMD</a>:</p><p id="958f"><i>…Americans do overconsume, averaging about 22 teaspoons of added sugars per day, according to the American <a href="https://www.webmd.com/heart/picture-of-the-heart">Heart</a> Association, which recommends limiting added sugars to about 6 teaspoons per day for women and 9 for men.</i></p><p id="4b06">There is sugar in damned near everything, if it’s processed, along with additional salts and other crap you and I can’t pronounce. So it was easy to pack it on as some of us had to turn to packaged foods when getting to the grocer, or at least doing it safely, got harder.</p><p id="f572">Under Covid, many if not most of us packed on pounds, feeding ourselves “comfort foods,” many if not most of which included added sugars, if not were pure sugar, as in candies and chocolate bars. I know I did.</p><figure id="9904"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/0*2Yle9ir1P2JupdYN"><figcaption>Photo by <a href="https://unsplash.com/@heatherbarnes?utm_source=medium&amp;utm_medium=referral">Heather Barnes</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p id="713b">For me, however, it was more about pure stress. It’s hard to make a huge cross-country move. That’s one of life’s biggest stressors. Add to that a trip to the hospital with a kidney infection and stones, then a nasty car accident, well. It’s been quite the year and it ain’t done yet. Hardly.</p><p id="2bc7">The extreme stressors of those events were just part of the overall circumstance set.</p><p id="a524">I had to completely overhaul my diet at 67, given that I have Interstitial Cystitis and kidney stones. IC is, to my mind, a catch-all phrase that means <i>we have no clue but we’ll give it a name to sound official.</i></p><p id="3708">I know what IC is like in practice. Bad enough so that when handed a long list of Do Not Eats, I was happy to comply.</p><p id="4e89">Now handed a much, much longer additional list to prevent a recurrence of oxalate kidney stones, I was also told in no uncertain terms that salt, and my beloved sugar, were off the table. Worse, NO MORE CHOCOLATE.</p><p id="7147">Even worse, NO MORE CHOCOLATE ALMONDS. As in <b>ever</b>.</p><p id="685d">Well. <i>Shit</i>.</p><p id="3ad0">While in some ways this is a blessing, I will confess that the forced divorce from one of Life’s Great Joys- milk chocolate almonds-was hard.</p><figure id="4e2b"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/0*lngsYribIcdTKR5w"><figcaption>Photo by <a href="https://unsplash.com/@grimnoire?utm_source=medium&amp;utm_medium=referral">emy</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p id="8e44">Unlike a friend, who, when faced with the same list I got, he intoned with great gravity, that he would “eat what I want and deal with the stones,” I like being alive. Those stones nearly killed me. Imagine eating what you want, but living with a potentially deadly Sword of Damocles over your head.</p><p id="8231">I can’t speak for anyone else, but kidney stones equal suffering. At least for me they do, and for anyone else I’ve ever spoken with who has experienced them. To that, and again I can only speak for myself, stuffing my favorite foods down my gullet out of the need to put my gustatory delights ahead of both my personal safety and that of others seems stupid at best, and foolish at worst.</p><p id="9c1c">The reason, at least in my case, that such decisions have the potential to hurt others, there’s this: I flipped my car because of a kidney stone in July. It was only stupid damned luck I didn’t land on top of a car full of kids, or cause oncoming traffic to swerve and kill off those occupants. You see my point.</p><p id="fb17">Our self-serving selfishness can indeed affect others in ways that we most certainly don’t intend. If, however, you and I learn that our desires can hurt others, and I am just teasing out food here, then it seems incumbent upon us to <i>back the fuck off.</i></p><p id="12f6">If what you and I ingest makes us unhealthy, causes us disease and other issues, then it’s most certainly not just about us. It’s very much about those who count on us, love us and want us to stick around a bit longer.</p><p id="cd30">But that’s just me.</p><p id="7086">In a country full of folks who can’t be bothered to wear masks because it protects OTHER people, why on earth should I expect those same folks to make better choices about their health for the same reasons?</p><p id="bc02">But I digress.</p><figure id="eb2f"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/0*G9hwJ4RPM6v3rvvE"><figcaption>Photo by <a href="https://unsplash.com/@ahungryblonde_?utm_source=medium&amp;utm_medium=referral">Sara Dubler</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p id="4089">In my favorite <a href="https://www.amazon.com/Heart-Buddhas-Teaching-Transforming-Liberation/dp/0767903692">book </a>by Vietnamese Buddhist monk Thich Nhat Hanh, he points out that you and I, when and if we are able to identify the source of our suffering, in this case for me both IC and kidney stones, we can choose not to ingest those things which cause us suffering. While in the largest sense this

Options

would be just as applicable to ingesting doom material, hate speech and the like, let’s just keep this to sugar, my beloved nemesis.</p><p id="f7b9">I was given long and difficult lists to redirect my eating habits to prevent stones. But also those nasty IC flareups which mean long nights on the toilet with no relief in sight and the unhappy prospect of having to wear Certain Undergarments. Look. For me it was easy. I have no interest in making myself suffer physically any more than necessary.</p><p id="5603">What that meant was that those foods were off the menu. Yeah, and forever this time. No more <i>next time</i>, or <i>just a little. Just one</i>. Because for me and my compulsive nature, Just One is an invitation to the Whole Damned Bag.</p><p id="e78b">I am as bad as a reformed alcoholic invited into a bar. Just a sip, that’s all.</p><p id="8e80">Not on your life, especially if it really does mean your life.</p><p id="fcfc">Since July, I’ve not had any of the foods on the May Not Have List.</p><p id="6458">Several things have happened. Not only has my weight, which had risen some 23 pounds, dropped back down (at first to sheer stress, and now it’s maintenance). The other gift, which has been echoed by fellow Medium writers, is that the tongue gets retrained naturally to enjoy what Nature has always offered us as natural candy: berries, bananas, apples, the sweet treats without the damaging <a href="https://www.medicalnewstoday.com/articles/323818">fructose</a>. Honey in my hot milk, for I had to give up tea and coffee because of the oxalates and tannins, is sweet enough.</p><p id="8033">A big handful of green grapes is about as sweet as I can handle. Those are my big, big treats. A Honey Crisp apple is nearly a meal unto itself. I have found immense joy in scarfing down a six ounce package of huge blackberries, and I never leave the house without two big apples in the console when I need consolation.</p><p id="a3e6">Why apples? There are all kinds of reasons that the old saw of an apple a day really is based on solid science:</p><div id="c1b4" class="link-block"> <a href="https://www.besthealthmag.ca/best-eats/nutrition/health-benefits-apples/"> <div> <div> <h2>13 Surprising Health Benefits of Apples That'll Have You Eating One (or More) a Day</h2> <div><h3>Sometimes the simplest foods are the best foods for us. You don't have to be a nutritionist to realize that apples are…</h3></div> <div><p>www.besthealthmag.ca</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*nwBspeSWAwx2gW2Q)"></div> </div> </div> </a> </div><p id="30e6">If you can eat apples, have at it. As with all issues dietary, know what you can and can’t have.</p><p id="ba78">You may do that research and STILL eat shit. At that point, when the body rebels and we get sick, or get stones, or expire early, there really is just one person to blame.</p><p id="95c5">One Medium buddy had to do much the same thing with her body. She told me I could retrain my sweet tooth, and she’s right. While I will still use sweetener (certain kinds, not all), I have noticed that in the largest sense, giving up sugar has given me back two things: the body I had, which is much happier where I am now; better health from taking out those substances that make me feel heavy and logey; and better long-term health by removing substances that my particular body doesn’t like.</p><figure id="4e78"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/0*mIPHlZYL_YbLhX2a"><figcaption>Photo by <a href="https://unsplash.com/@elldot_?utm_source=medium&amp;utm_medium=referral">Leon Ell'</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p id="6eb0">That last is likely true for all of us. I’ve written elsewhere that as we age, our dietary needs change. For some it’s just fewer calories. For others, for whatever reason, as we shift into life’s later gears, nutritional needs shift with us. Not paying attention can cost us dearly. Learning what we need, and still not paying attention, is just plain stupid, if not spiteful behavior towards the only instrument we have through which to experience life on Earth.</p><p id="24b9">Retraining my sweet tooth this year wasn’t strictly about getting my pre-breakup, pre-Covid body back. It wasn’t just about stating my gustatory freedom from the bad juju the breakup left behind. It was as much a statement of a genuine commitment to vibrant health as anything. While yes, you’re damned right I miss my chocolate almonds (which at one point my <i>Illumination </i>buddy <a href="undefined">Charles Roast</a> offered to send me express mail, bless his six-pack-protected good heart), I am done with them.</p><p id="873d"><b>That’s a statement of freedom.</b> From bad food, bad diseases, bad side effects. And the freedom to eat what Nature intended as our sweets, some of which (citrus, pineapple) I’ve also had to give up. But what’s left is plenty.</p><figure id="3621"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/0*b94AMNsik10wYjYD"><figcaption>Photo by <a href="https://unsplash.com/@clemono?utm_source=medium&amp;utm_medium=referral">Clem Onojeghuo</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure></article></body>

Understanding Polynomial Regression

Capturing non-linear relationships | Data Series | Episode 4.6

This Article expands on Simple Linear Regression and Multiple Linear Regression, ensure you have a good understanding of these two topic areas before continuing.

What is Polynomial Regression?

Polynomial Regression is used to capture non-linear relationships between variables.

For example:

For linear relationships we use Linear Regression.

Overview

Take a look at the following graph looking at the Humidity and Pressure values in Svged, Hungary.

  • We can see there is a trend in the data, which is non-linear so we use Polynomial Regression
  • The job of Polynomial regression is to find a suitable relationship between Humidity and Pressure, such as the following:
  • We can then use the model produced by polynomial regression to make suitable predictions for Humidity given any Pressure value.

Calculating the Polynomial Regression Model

Preprocessing The Data

The first step in calculating our Polynomial Regression Model is to Preprocess our data.

Take a look at the following data used to plot our Humidity vs Pressure Graph:

Our Regression Model is given by:

Which is linear as the highest power of 𝑥 is 1.

Let’s now square the pressure data and a new column:

Our Regression Model is now given by:

Which is non-linear as the highest power of 𝑥, which is 2, is greater than 1.

— — — — — — — — — — — — — — — — —

Adding 𝑥² to our regression model enables the model to check: Is there a second degree (bowl shape):

relationship between Pressure and Humidity?

— — — — — — — — — — — — — — — — —

Applying Gradient Descent

In order to calculate the values for θ₀, θ₁ and θ₂ we need apply an algorithm called gradient descent.

After applying this algorithm we find:

θ₀ = 29167.74604378328 θ₁ = -57.722545421135 θ₂ =0.02855835729673671

Giving our final polynomial regression model of:

(rounded to 3dp )

When plotted gives:

Which seems to fit our data quite nicely.

Using our model to make predictions

Let’s say we were given a pressure reading of 1007 millibars and wish to find the kind of Humidity we can expect from this.

We simply input 1007 into our linear regression model:

Which gives a Humidity value of: 0.716

Looking at our graph, this humidity value looks reasonable:

Evaluating our Model

We can see that adding the extra feature 𝑥² to our model seems to capture our relationship between pressure and humidity better than simple linear regression.

We can show this mathematically by comparing each models mean squared error given (MSE) given by:

This formula shows the average distance our regression model predictions(ŷ) are away from all it’s points(y). We discuss this in episode 4.1, where we look at the cost function.

Simple Linear Regression Model MSE: 0.01686

Polynomial Regression Model MSE: 0.00336

We see here that our polynomial regression MSE is much lower and therefore closer to all our data points. When looking at our model visually we also see it captures the general curve in our data and is therefore the model we should go for.

When adding higher and higher degree features to our model:

Our MSE decreases.

We may think that we should go for the model with the lowest MSE, however take a look at the following model which has an extremely low MSE:

Does this capture the relationship we are looking for?

Here, we start to run into a problem called Overfitting, where we add so many features to our model — that it fits our data too well and fails to recognise the general trend.

Overfitting and Underfitting are common problems in Data science and is important to consider when evaluating our model.

This will be discussed after implementing our polynomial regression model in Python in the next episode.

Prev Episode | Next Episode

If you have any questions please leave them below!

Polynomial Regression
Data Science
Machine Learning
Statistics
Python
Recommended from ReadMedium