<jupyter_start><jupyter_text><jupyter_code>import pandas as pd
import numpy as np
import seaborn as sns
import statsmodels.api as sm
import math
import matplotlib.pyplot as plt
import pandas as pd
from google.colab import files
uploaded = files.upload()
for fn in uploaded.keys():
  print("User uploaded file'{name}' with length {length} bytes".format(name = fn, length=len(uploaded[fn])))
uploaded
import io
df = pd.read_csv(io.StringIO(uploaded["Car Prices.csv"].decode("utf-8")))
df.head()
df.columns
df.drop(['car_ID', 'symboling','aspiration', 'carbody', 'drivewheel', 'enginelocation', 'wheelbase',
       'carlength', 'carwidth', 'carheight', 'curbweight',
       'cylindernumber', 'fuelsystem', 'boreratio', 'stroke',
       'compressionratio','citympg', 'highwaympg'], axis = 1, inplace = True)
df.drop(["fueltype", "doornumber", "enginetype"], axis = 1, inplace = True)
df
df.info()
df.describe()
corr = df.corr()
sns.heatmap(corr, xticklabels=corr.columns, yticklabels=corr.columns, annot=True)
endog = df["price"]
exog = sm.add_constant(df[["enginesize", "horsepower", "peakrpm"]])
print(exog)
X = exog.to_numpy()
Y = endog.to_numpy()
m1_tp = np.transpose(X)
print(tp)
m2_mul1 = np.matmul(m1_tp, X)
print(m2_mul1)
m3_inv = np.linalg.inv(m2_mul1)
print(m3_inv)
m4_mul = np.matmul(m3_inv, m1_tp)
print(m4_mul)
m5_result = np.matmul(m4_mul, Y)
print(m5_result)
mod = sm.OLS(endog, exog)
results = mod.fit()
print(results.summary())
from sklearn import linear_model
x = df[["enginesize", "horsepower", "peakrpm"]]
y = df["price"]
lm = linear_model.LinearRegression()
linreg = lm.fit(x, y)
lm.coef_
lm.intercept_<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1643420254699818, 'fraction_numerical': 0.01212856276531231, 'mean_word_length': 6.366071428571429, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '446141', 'license': 'Apache-2.0', 'n_tokens_mistral': 670, 'n_tokens_neox': 646, 'n_words': 141, 'path': 'MultipleLinearRegression.ipynb', 'repo_name': 'Gauravds435/colabtools', 'size': '1649'}