# Microsoft Stock Price Prediction with Machine Learning

In this project, I have used a machine-learning algorithm to predict the stock price of one of the largest tech companies named Microsoft using Python.

Step-1: Import necessary libraries and data exploration on given data.

```import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
plt.style.use('fivethirtyeight') Step-2: Data Visualization

```plt.figure(figsize=(10, 4))
plt.title("Microsoft Stock Prices")
plt.xlabel("Date")
plt.ylabel("Close")
plt.plot(data["Close"])
plt.show()``` Step-3: Finding Co-relation between data

```print(data.corr())
sns.heatmap(data.corr())
plt.show()```  Step-4: Splitting Data into train and test data

```x = data[["Open", "High", "Low"]]
y = data["Close"]
x = x.to_numpy()
y = y.to_numpy()
y = y.reshape(-1, 1)

from sklearn.model_selection import train_test_split
xtrain, xtest, ytrain, ytest = train_test_split(x, y, test_size=0.2, random_state=42)```

Step-5: Applying machine learning model

```from sklearn.tree import DecisionTreeRegressor
model = DecisionTreeRegressor()
model.fit(xtrain, ytrain)
ypred = model.predict(xtest)
data = pd.DataFrame(data={"Predicted Rate": ypred}) 