<jupyter_start><jupyter_text>Salary Prediction Using Linear Regression<jupyter_code>#importing libraries

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
#loading data

df = pd.read_csv('..\SimpleLinear\salary_data.csv')
df.head(10)
X=df.iloc[:, :-1].values
Y=df.iloc[:, 1].values
#Splitting Data into train 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.3, random_state=0)
print(X_test)
print(X_train)
print(Y_train)
print(Y_test)
#Fitting Linear Regression to training data

from sklearn.linear_model import LinearRegression

reg= LinearRegression()
reg.fit(X_train, Y_train)
#Making prediction with Test set

y_pred=reg.predict(X_test)
#Visualizing the training set

plt.scatter(X_train, Y_train, color='blue')  #plot actual training data
plt.plot(X_train, reg.predict(X_train), color='red') #plot regression line
plt.title("Salary vs Experience(Training Set)")
plt.xlabel('Years Of Experience')
plt.ylabel('Salary')
#Visualizing Test Set

plt.scatter(X_test, Y_test, color="red") #plot actual test data
plt.plot(X_train, reg.predict(X_train), color='blue')  #plot regression line
plt.title("Salary vs Experience(Test Set)")
plt.xlabel('Years Of Experience')
plt.ylabel('Salary')
#Making new Predictions

exp=float(input("enter the Years Of Experience"))
salary_pred= reg.predict([[exp]])
print('The predicted salary of a person with '+ str(exp) +' years experience is ',salary_pred)<jupyter_output>enter the Years Of Experience10
The predicted salary of a person with 10.0 years experience is  [120380.00420313]
{'fraction_non_alphanumeric': 0.1141804788213628, 'fraction_numerical': 0.01596071209330878, 'mean_word_length': 6.874396135265701, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '614820', 'license': 'MIT', 'n_tokens_mistral': 587, 'n_tokens_neox': 552, 'n_words': 157, 'path': 'SimpleLinear/Salary_Prediction.ipynb', 'repo_name': 'vijay0707/MachineLearning-Projects', 'size': '1629'}