Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

Commit

Permalink
pep8 variable naming convention
Browse files Browse the repository at this point in the history
  • Loading branch information
durandom committed May 28, 2019
1 parent b7f0127 commit db01c83
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions model.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,34 @@ def import_data_and_split():
# Split the dataset into the training set and test set
# We're splitting the data in 1/3, so out of 30 rows, 20 rows will go into the training set,
# and 10 rows will go into the testing set.
xTrain, xtest, y_Train, yTest = train_test_split(x, y, test_size =1 / 3, random_state = 0)
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size =1 / 3, random_state = 0)

return (xTrain, xtest, y_Train, yTest)
return (x_train, x_test, y_train, y_test)



if __name__ == '__main__':
xTrain, xtest, y_Train, yTest = import_data_and_split()
x_train, x_test, y_train, y_test = import_data_and_split()

# Creating a LinearRegression object and fitting it
# on our trainging set.
linearRegressor = LinearRegression()
linearRegressor.fit(xTrain, y_Train)
linear_regressor = LinearRegression()
linear_regressor.fit(x_train, y_train)

# Predicting the test set results
yPrediction = linearRegressor.predict(xtest)
y_prediction = linear_regressor.predict(x_test)

# Visualising the training set results
plot.scatter(xTrain, y_Train, color ='red')
plot.plot(xTrain, linearRegressor.predict(xTrain), color = 'blue')
plot.scatter(x_train, y_train, color ='red')
plot.plot(x_train, linear_regressor.predict(x_train), color ='blue')
plot.title('Salary vs Experience (Training set)')
plot.xlabel('Years of Experience')
plot.ylabel('Salary')
plot.show()

# Visualising the test set results
plot.scatter(xtest, yTest, color ='red')
plot.plot(xtest, linearRegressor.predict(xtest), color ='blue')
plot.scatter(x_test, y_test, color ='red')
plot.plot(x_test, linear_regressor.predict(x_test), color ='blue')
plot.title('Salary vs Experience (Test set)')
plot.xlabel('Years of Experience')
plot.ylabel('Salary')
Expand Down

0 comments on commit db01c83

Please sign in to comment.