<jupyter_start><jupyter_text><jupyter_code>import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt 
dataset=pd.read_csv('/content/Car.csv')
dataset.head(5)
dataset.isnull().sum()
dataset.info()
dataset['Make'].unique()
dataset['Make'].value_counts()
plt.figure(figsize=(10,6))
sns.countplot(dataset["Make"])
dataset['Model'].unique()
catog=['Make', 'Model', 'Trim', 'Type']
newdataset=pd.get_dummies(dataset[catog],drop_first=True)  
newdataset.head(5)
dataset.drop(catog,axis=1,inplace=True)
dataset=pd.concat([dataset,newdataset],axis=1)
dataset.head(5)
from sklearn.preprocessing import scale
dataset['Mileage']=scale(dataset['Mileage'])
dataset
dataset.info()
x = dataset.drop('Price',axis=1)
y = dataset['Price']<jupyter_output><empty_output><jupyter_text>**Splitting**<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.20,random_state=69)<jupyter_output><empty_output><jupyter_text>**Training** **Model**<jupyter_code>#from sklearn.tree import DecisionTreeClassifier
from sklearn.linear_model import LinearRegression
#d_tree = DecisionTreeClassifier()
linear=LinearRegression()
linear.fit(x_train,y_train)<jupyter_output><empty_output><jupyter_text>**Predicting**<jupyter_code>linear_y_train_pred=linear.predict(x_train)
linear_y_test_pred=linear.predict(x_test)<jupyter_output><empty_output><jupyter_text>**Accuracy**<jupyter_code>from sklearn.metrics import accuracy_score,r2_score
r2_score(y_true=y_train,y_pred=linear_y_train_pred)
r2_score(y_true=y_test,y_pred=linear_y_test_pred)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1452104942037828, 'fraction_numerical': 0.010372178157413058, 'mean_word_length': 14.619047619047619, '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': '349192', 'license': 'Apache-2.0', 'n_tokens_mistral': 631, 'n_tokens_neox': 615, 'n_words': 68, 'path': 'car.ipynb', 'repo_name': 'rohitkujur1997/Car-Price-MachineLearning', 'size': '1639'}