<jupyter_start><jupyter_text>Simple Linear Regression using ML<jupyter_code>#Importing packages
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sb
#Importing the dataset
dataset=pd.read_csv("C:/Users/Bharathi/Downloads/salary_data.csv")
dataset.shape
dataset.head()
dataset.info()
X=dataset.iloc[:,:-1].values
Y=dataset.iloc[:,1].values
sb.distplot(dataset['YearsExperience'])
sb.scatterplot(dataset['YearsExperience'],dataset['Salary'])
# Splitting the dataset into the Training set and Test set
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test=train_test_split(X,Y,test_size=0.2, random_state=0)
#fitting simple linear regression to the training set
from sklearn.linear_model import LinearRegression
regressor=LinearRegression()
regressor.fit(X_train, y_train)
regressor.score(X_test,y_test)
# predicting the test set results
y_pred=regressor.predict(X_test)
y_pred
regressor.predict([[1.5]])
#Visualising the Training Set Results
plt.scatter(X_train, y_train, color='red')
plt.plot(X_train,regressor.predict(X_train),color='blue')
plt.title('Salary vs Experience(training set)')
plt.xlabel('Years of Experience')
plt.ylabel('Salary')
plt.show()
#visualising the Test set results
plt.scatter(X_test, y_test, color='red')
plt.plot(X_train,regressor.predict(X_train),color='blue')
plt.title('Salary vs Experience(training set)')
plt.xlabel('Years of Experience')
plt.ylabel('Salary')
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12450066577896138, 'fraction_numerical': 0.004660452729693742, 'mean_word_length': 8.823529411764707, '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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '492421', 'license': 'MIT', 'n_tokens_mistral': 540, 'n_tokens_neox': 514, 'n_words': 112, 'path': 'Simple linear regression using ML.ipynb', 'repo_name': 'bharathiyakshi1985/Titanic_study', 'size': '1502'}