<jupyter_start><jupyter_text>Convert the column to  Categorical column<jupyter_code>states=pd.get_dummies(X["State"],drop_first=True)
states.head()
X = X.drop('State',axis = 1)
X.head()
X = pd.concat([X,states],axis=1)
X.head()<jupyter_output><empty_output><jupyter_text>Splitting the data into Train and Test Data<jupyter_code>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)
from sklearn.linear_model import LinearRegression
Regressor = LinearRegression()
Regressor.fit(X_train,y_train)<jupyter_output><empty_output><jupyter_text>Predict Y according to X<jupyter_code>y_predict = Regressor.predict(X_test)<jupyter_output><empty_output><jupyter_text>Implementing R^2 for finding Accuracy<jupyter_code>from sklearn.metrics import r2_score
score = r2_score(y_test,y_predict)
score<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11234705228031146, 'fraction_numerical': 0.008898776418242492, 'mean_word_length': 11.67605633802817, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '214233', 'license': 'Unlicense', 'n_tokens_mistral': 350, 'n_tokens_neox': 340, 'n_words': 51, 'path': 'Startup Profit Prediction (Multiple Linear Regresion)/MultipleLinearRegression.ipynb', 'repo_name': 'yashrajjain726/Machine-Learning-Hands-On-Practice', 'size': '899'}