Machine Learning (Part 4)
Neil Haddley • June 8, 2022
Colab
Colab is Google's implementation of Jupyter Notebooks.
A Colab consists of text comments and code
NumPy
NumPy is a Python library for creating and manipulating vectors and matrices.

import numpy as np
![np.array([...])](/assets/images/machinelearning4/screen-shot-2022-06-08-at-6.24.04-pm-745x209.png)
np.array([...])
![np.array([[...],[...],...,[...]]](/assets/images/machinelearning4/screen-shot-2022-06-08-at-6.25.18-pm-764x221.png)
np.array([[...],[...],...,[...]]

a sequence from 5 to 11

6 random values between 50 and 100

5 random floating point values between 0 and 1

feature and label

adding noise
Pandas
Pandas DataFrames are similar to spreadsheets. DataFrames have columns and rows.

import numpy and pandas

pd.DataFrame(data=<data cell values>, columns=<column names>)
![<dataframe>["<new column name>"] = <dataframe>["<existing column name>"] + <constant>](/assets/images/machinelearning4/screen-shot-2022-06-08-at-6.54.36-pm-779x348.png)
<dataframe>["<new column name>"] = <dataframe>["<existing column name>"] + <constant>
![<dataframe>[<start index>,<end index + 1>]](/assets/images/machinelearning4/screen-shot-2022-06-08-at-6.58.28-pm-787x739.png)
<dataframe>[<start index>,<end index + 1>]

<dataframe>.copy()