Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import pandas as pd
- import sklearn
- import matplotlib.pyplot as plt
- from matplotlib import style
- from mpl_toolkits.mplot3d import Axes3D
- from sklearn import linear_model, preprocessing
- style.use('dark_background')
- DATA = pd.read_csv('CarPrice.csv', sep=',')
- X = np.array(DATA[['wheelbase', 'horsepower', 'curbweight', 'enginesize']])
- Y = np.array(DATA['price'])
- X_Train, X_Test, Y_Train, Y_Test = sklearn.model_selection.train_test_split(X, Y, test_size=0.1)
- LinearModel = linear_model.LinearRegression()
- LinearModel.fit(X_Train, Y_Train)
- Accuracity = LinearModel.score(X_Test, Y_Test)
- print(Accuracity)
- R = LinearModel.predict([[88.6, 111, 2548, 130]])
- print(R)
Add Comment
Please, Sign In to add comment