<jupyter_start><jupyter_text>Salary Prediction Model  Import Libraries<jupyter_code>import pandas as pd
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split<jupyter_output><empty_output><jupyter_text>Read Data<jupyter_code>dataset = pd.read_csv("Salary_Data.csv")<jupyter_output><empty_output><jupyter_text>See Data<jupyter_code>dataset.head()<jupyter_output><empty_output><jupyter_text>Check Information about dataset<jupyter_code>dataset.info()<jupyter_output><class 'pandas.core.frame.DataFrame'>
RangeIndex: 30 entries, 0 to 29
Data columns (total 2 columns):
 #   Column           Non-Null Count  Dtype  
---  ------           --------------  -----  
 0   YearsExperience  30 non-null     float64
 1   Salary           30 non-null     float64
dtypes: float64(2)
memory usage: 608.0 bytes<jupyter_text>Creating Training variables<jupyter_code>x = dataset["YearsExperience"]
x = x.values.reshape(30,1)
y = dataset["Salary"]<jupyter_output><empty_output><jupyter_text>Create Model<jupyter_code>model = LinearRegression()<jupyter_output><empty_output><jupyter_text>Split Dataset<jupyter_code>X_train, X_test, y_train, y_test = train_test_split(x, y, test_size=0.20, random_state=42)<jupyter_output><empty_output><jupyter_text>Train Dataset<jupyter_code>model.fit(X_train,y_train)
model.coef_<jupyter_output><empty_output><jupyter_text>Let's Predict<jupyter_code>model.predict(X_test)
y_test
model.intercept_<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11895161290322581, 'fraction_numerical': 0.020833333333333332, 'mean_word_length': 6.795811518324608, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, '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': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '136435', 'license': 'MIT', 'n_tokens_mistral': 569, 'n_tokens_neox': 542, 'n_words': 76, 'path': '1. Simple Linear Regression/Salary Prediction/Salary Prediction Model.ipynb', 'repo_name': 'Shresth92/Data-Science', 'size': '1488'}