<jupyter_start><jupyter_text>**Simple Linear Regression**

 *Find price of home whose area is 3300 sq ft & 500 sq ft *<jupyter_code>import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn import linear_model

data = {'Area':  [2600,3000, 3200, 3600, 4000],
        'Price': [550000, 565000,610000,680000, 725000 ]
        }

df = pd.DataFrame (data, columns = ['Area','Price'])
df
%matplotlib inline
plt.xlabel('Area')
plt.ylabel('Price')
plt.scatter(df.Area, df.Price, color='red', marker = '+')
#create object for linear regression
reg= linear_model.LinearRegression()
X= df['Area'].values.reshape(-1,1)
Y= df['Price'].values.reshape(-1,1)
#fitting the data means training model using training dataset
reg.fit(X, Y)
reg.predict([[3300]])

print("The linear model is: Y = {:.5} + {:.5}X".format(reg.intercept_[0], reg.coef_[0][0]))
#Y= mx + c
135.79 * 3300 + 180616
data_new = {'Area':  [2600,3000, 3200, 3600, 4000,5500,6600,7300,8700,9000,9200,10200,11000]
                }

df1 = pd.DataFrame (data_new, columns = ['Area'])

df1['Price'] = reg.predict(df1[['Area']])
df1.head()
plt.xlabel('Area')
plt.ylabel('Price')
plt.scatter(df.Area, df.Price, color='red', marker = '+')
plt.plot(df1.Area, reg.predict(df1[['Area']]) ,color='blue', marker = '+')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18358208955223881, 'fraction_numerical': 0.10820895522388059, 'mean_word_length': 4.564315352697095, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '369170', 'license': 'MIT', 'n_tokens_mistral': 618, 'n_tokens_neox': 516, 'n_words': 118, 'path': 'DPhi - Simple Linear Regression.ipynb', 'repo_name': 'chetnashahi/100daysofML', 'size': '1340'}