<jupyter_start><jupyter_text>EDA and Data Visualization<jupyter_code>df.info()
#no null values 
df.boxplot()
# There is no outliers in our dataset
df.describe()
import seaborn as sns
sns.pairplot(data=df)
#there is positive assosiation between yearsExpe and Salary
df.corr()
import numpy as np
import statsmodels.formula.api as smf<jupyter_output><empty_output><jupyter_text>Model 1 simple linear regression<jupyter_code># Bulding model by ols method for prediction of salary by years of experience.
model=smf.ols('Salary~YearsExperience',data=df).fit()
model.params
model.summary()
pred=model.predict(df.iloc[:,0]) #model.predict(df['YearsExperience'])
pred
model.resid
model.resid_pearson
rmse_lin=np.sqrt(np.mean((np.array(df['Salary'])-np.array(pred))**2))
rmse_lin
 sns.regplot(x='YearsExperience',y='Salary',data=df)<jupyter_output><empty_output><jupyter_text>Prediction for 10.5 YearsExperience<jupyter_code>newdata=pd.Series([10.5])
data_pred=pd.DataFrame(newdata,columns=['YearsExperience'])
model.predict(data_pred)<jupyter_output><empty_output><jupyter_text>LOG TRASFORMATION MODEL 2<jupyter_code>model2=smf.ols('Salary~np.log(YearsExperience)',data=df).fit()
model2.params
model2.resid
model2.resid_pearson
model2.summary()
pred1=model2.predict(df.iloc[:,0])
rmse_log=np.sqrt(np.mean((np.array(df['Salary'])-np.array(pred1))**2))
rmse_log
# prediction of salary using yearsexperience
newdata=pd.Series([10.5,11,12])
data_pred=pd.DataFrame(newdata,columns=['YearsExperience'])
model2.predict(data_pred)<jupyter_output><empty_output><jupyter_text>EXPONENTIAL TRASFORMATION MODEL 3<jupyter_code>#second exponential TRASFORMATION
model3=smf.ols('np.log(Salary)~YearsExperience',data=df).fit()
model3.params
model3.summary()
pred2=model3.predict(df.iloc[:,0])
rmse_exp=np.sqrt(np.mean((np.array(df['Salary'])-np.array(pred2))**2))
rmse_exp<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1497867803837953, 'fraction_numerical': 0.019722814498933903, 'mean_word_length': 10.58641975308642, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '336108', 'license': 'Apache-2.0', 'n_tokens_mistral': 743, 'n_tokens_neox': 711, 'n_words': 100, 'path': 'salary lin reg (1).ipynb', 'repo_name': 'Nikhilrajurkar/Simple-Linear-Regression_', 'size': '1876'}