<gh_stars>0
import numpy as np
import matplotlib.pyplot as plt 
import pandas as pd 
from sklearn.model_selection import train_test_split
from sklearn.compose import ColumnTransformer
from sklearn.preprocessing import OneHotEncoder
from sklearn.linear_model import LinearRegression

# Import Dataset:
dataset = pd.read_csv('/home/pranav/Documents/py_DEV/ML_A-Z/Machine Learning A-Z (Codes and Datasets)/Part 2 - Regression/Section 5 - Multiple Linear Regression/Python/50_Startups.csv')
x = dataset.iloc[:, :-1].values
y = dataset.iloc[:, -1].values

# Encode string values using One Hot Encoding:
ct = ColumnTransformer(transformers=[('encoder', OneHotEncoder(), [3])], remainder='passthrough')
x = np.array(ct.fit_transform(x))

#  Split dataset to train and test:
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.2, random_state=0)

# Building training model on the training set:
regressor = LinearRegression()
regressor.fit(x_train, y_train)

# Predict test set results:
y_pred = regressor.predict(x_test)
np.set_printoptions(precision=2)
print(np.concatenate((y_pred.reshape(len(y_pred), 1), y_test.reshape(len(y_test), 1)), 1))

# Find predicted dependent value for specific independent values:
print(regressor.predict([[1, 0, 0, 160000, 130000, 300000]]))

print(regressor.coef_)
print(regressor.intercept_)





import numpy as np
import matplotlib.pyplot as plt 
import pandas as pd 
from sklearn.model_selection import train_test_split
from sklearn.compose import ColumnTransformer
from sklearn.preprocessing import OneHotEncoder
from sklearn.linear_model import LinearRegression

# Import Dataset:
dataset = pd.read_csv('/home/pranav/Documents/py_DEV/ML_A-Z/Machine Learning A-Z (Codes and Datasets)/Part 2 - Regression/Section 5 - Multiple Linear Regression/Python/50_Startups.csv')
x = dataset.iloc[:, :-1].values
y = dataset.iloc[:, -1].values

# Encode string values using One Hot Encoding:
ct = ColumnTransformer(transformers=[('encoder', OneHotEncoder(), [3])], remainder='passthrough')
x = np.array(ct.fit_transform(x))

#  Split dataset to train and test:
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.2, random_state=0)

# Building training model on the training set:
regressor = LinearRegression()
regressor.fit(x_train, y_train)

# Predict test set results:
y_pred = regressor.predict(x_test)
np.set_printoptions(precision=2)
print(np.concatenate((y_pred.reshape(len(y_pred), 1), y_test.reshape(len(y_test), 1)), 1))

# Find predicted dependent value for specific independent values:
print(regressor.predict([[1, 0, 0, 160000, 130000, 300000]]))

print(regressor.coef_)
print(regressor.intercept_)
# Import Dataset: # Encode string values using One Hot Encoding: #  Split dataset to train and test: # Building training model on the training set: # Predict test set results: # Find predicted dependent value for specific independent values: