# 1.Monday, 15-07-2019 - What is Machine Leaning?
### Machine Learning
* #### What is Machine Learning
>Machine Learning (ML) is the scientific study of algorithms and statistical models that computer systems use in order to make predictions or decisions based on sample data instead of explicitly programming.
* #### Simple functions in Python for Machine Learning
* Function **random.seed()**
```
import numpy as np --library numpy
np.random.seed(1) --way 1
np.random.seed(2) --way 2
np.random.seed() --random
***This function generates random number.***
```
* * Function **random.randint()**
```
np.random.seed() --initialize
n_sample = 50
exam1_scores = np.random.randint(low = 10, high = 40, size = n_sample) / 4.0
if n_sample < 1000:
print(exam1_scores)
***Return random integer from low to high.***
```
* * Function **DataFrame(data={"Column name 1":column_1, "Column name 2":column_2})**
```
import pandas as pd
df1 = pd.DataFrame(data={"Learning hours":learning_hours, "Exam 1": exam1_scores})
df1.sample(50)
***This function shows data in gridview.***
```
* * Function **Scatter(x, y)**
```
import matplotlib.pyplot as plt
plt.scatter(learning_hours, exam1_scores)
***This function draw Scatter diagram.***
```
* * Function **Predict and Plot(x, y)**
```
from sklearn.linear_model import LinearRegression
model = LinearRegression() --initialize
model.fit(df1[['Learning hours']], df1['Exam 1']) --input the sample data
x_model = np.linspace(0, 100, 1000) --list of 1000 X points from 0 - 100
y_model = model.predict(x_model.reshape(-1,1))
plt.scatter(learning_hours, exam1_scores) --draw Scatter
plt.plot(x_model, y_model) --draw the line (linear)
***Apply LinearRegression based on ...........
```
* * Function **intercept_ and coef_[0]**
```
print("Intercept: ", model.intercept_)
print("Coefficient: ", model.coef_[0])
```