Machine Learning (Part 4)

Neil HaddleyJune 8, 2022

Colab

AIPythonmachine-learninggoogle-colabjupyter-notebookpython

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.

I imported numpy as np

I imported numpy as np

I created an array with np.array([...])

I created an array with np.array([...])

I created a matrix with np.array([[...],[...],...,[...]])

I created a matrix with np.array([[...],[...],...,[...]])

I created a sequence from 5 to 11

I created a sequence from 5 to 11

I generated 6 random values between 50 and 100

I generated 6 random values between 50 and 100

I generated 5 random floating point values between 0 and 1

I generated 5 random floating point values between 0 and 1

I created a feature and label

I created a feature and label

I added noise

I added noise

Pandas

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

I imported numpy and pandas

I imported numpy and pandas

pd.DataFrame(data=<data cell values>, columns=<column names>)

pd.DataFrame(data=<data cell values>, columns=<column names>)

<dataframe>["<new column name>"] = <dataframe>["<existing column name>"] + <constant>

<dataframe>["<new column name>"] = <dataframe>["<existing column name>"] + <constant>

<dataframe>[<start index>,<end index + 1>]

<dataframe>[<start index>,<end index + 1>]

<dataframe>.copy()

<dataframe>.copy()