Levi Profile picture
Nov 27 ā€¢ 10 tweets ā€¢ 3 min read Twitter logo Read on Twitter
Linear Regression is a powerful tool in machine learning.

Read this šŸ§µ for the simplest explanation of Linear Regression.

šŸ”½ Image
Linear regression is an ML method, mainly used to estimate values.

For example, we can estimate:

- Price of a house
- Value of stock
- Life expectancy

1/8
Some definitions before moving on with the example:

Attributes - Data values that we use to make our predictions

Target - Value that we want to predict

2/8
We want to predict the prices of houses based on the number of rooms they have.

In this example,

Attributes - Number of rooms

Target - Price of houses

3/8
In a small dataset we have these values ā¬‡ļø

We want to predict what is the price of a house with 4 rooms

4/8 Image
As our first step let's plot these values

There is a clear connection (correlation) between the number of rooms and prices.

5/8 Image
The goal of linear regression is to draw a line that passes as close to data points as possible.

1. Start with a random line
2. Pick a random value - Are we close enough?
3. If no, move the line closer
4. Repeat these steps.

6/8 Image
In the end, you will get a line that is as close to all the values as possible.

According to the model, the price of a house with 4 rooms will be around 300.

Just like that, we created a predictive ML model.

7/8 Image
That's it for today.

I hope you've found this thread helpful.

Like/Retweet the first tweet below for support and follow @levikul09 for more Data Science threads.

Thanks šŸ˜‰

8/8
If you haven't already, join our newsletter DSBoost.

We share:

ā€¢ Interviews
ā€¢ Podcast notes
ā€¢ Learning resources
ā€¢ Interesting collections of content

dsboost.dev

ā€¢ ā€¢ ā€¢

Missing some Tweet in this thread? You can try to force a refresh
怀

Keep Current with Levi

Levi Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @levikul09

Nov 28
The math behind Linear Regression.

Let's see the actual math behind the predictive model.

šŸ§µ Image
Linear Regression tries to predict the Y variable from X using a linear relationship.

The linear relationship can be visualized as a line.

Mathematically we can write down lines like this šŸ”½

1/6 Image
In the formula:

- b0 is the point where the line intercepts the y-axis.

- b1 is the slope of the line.

When the slope is 0.5, it means that when we walk along this line, for every unit that we move to the right, we are moving 0.5 units up.

2/6 Image
Read 8 tweets
Nov 26
You can use the standard normal distribution to calculate probability.

How?

Let me explain.

šŸ§µ Image
Yesterday we looked at the standardization process and how to calculate the z-value.

Here is the thread:
The standard normal distribution is a probability distribution.

What is that?

In this distribution, the number of times a value occurs in a sample is determined by its probability of occurrence.

The higher the probability, the higher the frequency.
Read 10 tweets
Nov 25
The standard normal distribution is more than just a curve.

It's a fundamental tool in statistics.

I will explain the math behind it with examples.

šŸ§µ Image
The standard normal distribution is a special normal distribution where the mean is 0 and the standard deviation is 1.

It is also called z-distribution.

More on z-score below šŸ‘‡ Image
Z-score tell you how far the value is from the mean.

The measurement of this distance is the standard deviation.

Positive z-score means that the given value is greater than the mean.

Negative z-score means that the given value is less than the mean. Image
Read 8 tweets
Nov 21
Finding the balance in ML is hard.

Underfitting and overfitting can restrict your model.

I will explain what they mean šŸ§µ Image
1. You need to study for a test.

But you watch Netflix all day and don't study at all.

What will happen?

You will fail miserably.

Not studying enough for the exam is underfitting.

The model is unable to learn the data. Image
2. You have access to previous exams

What do you do?

Study all the answers from previous tests.

What will happen?

You will fail again.

You perfectly memorized previous answers, but cannot answer a new question.

This is overfitting. Image
Read 6 tweets
Nov 19
Weights and Biases are the engines in Neural Networks.

I will explain how they work.

šŸ§µ Image
When data is flowing between different neurons or layers, it is not just going from A to B.

Different transformations happen to them.

These transformations are described with Weights and Biases.

Let's discuss each šŸ”½
1ļøāƒ£ Weight

Weights determine how important each factor is in the overall prediction.

This value will determine the influence input data has on the output product.

They work similarly as in weighted means: The input is multiplied by the weights. Image
Read 8 tweets
Nov 12
6 Statistical and Machine Learning pitfalls.

Avoid these traps to be a better data person.

šŸ§µ Gutman, Alex J., and Jordan Goldmeier. Becoming a Data Head : How to Think, Speak, and Understand Data Science, Statistics, and Machine Learning. Indianapolis, Indiana, John Wiley & Sons Inc., 2021.
1ļøāƒ£ Correlation = Causation

They are related, it is crucial to understand that correlation does not imply causation!

We cannot measure causation statistically!

Resist the temptation to build a causal narrative around correlated variables.
2ļøāƒ£ P-hacking

Statistically significant results do not always imply real-life significance.

Studies can manipulate or selectively analyze data in order to obtain statistically significant results.

It is important to follow transparent and rigorous research practices.
Read 9 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(