Linear Regression is a machine learning algorithm based on supervised learning. Linear Regression is a predictive model that is used for finding the linear relationship between a dependent variable and one or more independent variables. Here,dependent variable/target variable(Y) should be continuous variable.

Let’s learn the math behind simple linear regression and the Python way of implementation using ski-kit learn

Let’s looks at our dataset first. I have taken a simple dataset for an easy explanation.` Years of Experience vs Salary`

.

We want to predict the salary of the person based on their years of experience?

**Dataset**

In the given dataset, we have Exp vs Salary. Now, we want to predict the salary for 3.5 years of experience? Let’s see how to predict that? …

Packages are a way of structuring Python’s module namespace by using “dotted module names”.

Refer to my story for importing modules in python.

For example, the module name `A.B`

designates a submodule named `B`

in a package named `A`

I have created the following packages and sub-packages. Let’s see how to import these packages.

I have created a package` calc`

I have created a sub-package` mathcalc`

I have created files addition.py,subtract.py under `mathcalc`

subpackage.

All packages and subpackages have` init.py`

.It …

In Python 3.9, merge `|`

and update `|=`

operators have been added to the built-in `dict`

class.

Let’s explore different ways to merge dictionaries before and after Python 3.9.

`d1.update(d2)`

Update the dictionary `d1`

with the key/value pairs from `d2`

, overwriting existing keys. Return `None`

.

`d1={`**'a'**:1,**'b'**:2}

d2={**'c'**:3,**'b'**:9999}

d1.update(d2)

print (d1)

*#Output:{'a': 1, 'b': 9999, 'c': 3}*

**Limitations**

`d1.update(d2)`

will modify the original dictionary `d1`

. If the original dictionary need not be modified, create a copy of dictionary `d1`

and then update it.

`d1={`**'a'**:1,**'b'**:2}

d2={**'c'**:3,**'b'**:9999}

**from **copy **import **copy

d3=copy(d1)

d3.update(d2)

print (d3)

*#Output:{'a': 1, 'b': 9999, 'c': 3}*

`d3={**d1,**d2}`

A double asterisk `**`

denotes dictionary unpacking. …

About