Module 1, Regression Model: Optional Lab: Model Representation
- Creating two variables:
- Input or feature = x_train drawn from a numpy array
- Output or target = y_train drawn from a numpy array

- Determining number of training examples
- x_train.shape gives us the "shape" (rows and columns) of the array we're dealing with
- The first element represents the number of rows (training examples) and the second element represents the number of columns (features or input dimensions)
- For example, if x_train.shape is (100, 20), it means there are 100 training examples and each example has 20 features or columns (e.g. sq footage, material type, bathrooms, etc).
- x_train.shape[0] accesses the rows total datapoint, so given that it's 2 rows, responds with 2.
- For example, if x_train.shape is (100, 20), x_train.shape[0] will be 100.
- Can also use len on the nparray

- Plot the two training nparrays (house size; house price) using the scatter() function in matplotlib:

- Creating a regression analysis output for given training inputs:
- m or number of training examples drawn from first element in an ndarray which lists number of rows
- then creates a new ndarray called f_wb which is initialized with zeroes (np.zeros(m)) for the number of training examples
- for loop which states for as many times as there are training examples:
- array place [i] (so 0, 1, 2 etc) = input nd training array x at first data point * given w + given b
- basically returns all the predicted y values or targets in the f_wb ndarray

- Example of someone using above formula, by referencing the aforementioned x_train ndarray, w and b parameters
- Most of code about designing the resulting plot (marker = marker type; c = color)
- "plt.plot(x_train, tmp_f_wb, c='b', label='Our Prediction')"
- creates a line plot of the predicted values (tmp_f_wb) against the input data (x_train).
- The c='b' argument sets the color of the line to blue, and label='Our Prediction' sets the label for this line in the legend.
- "x_train, tmp_f_wb" is the input of all the x values from the training set against the outputted y values of the regression function we built

- Trained the model ourselves manually, by messing with w and b parameters to get to a line that overlapped
- Once have the right weight and bias numbers, can build a prediction function:

Module 1, Regression Model: Optional Lab: Cost Function
- Function to calculate the total cost of given certain w and b parameters used (our guess at what will make the line fit)
- Uses a for loop to run thru all of the training data (x and y refer to ndarrays) and calculate the difference between what this regression function spits out (f_wb) and the actual training data target value y[i]
- Tallies this all in a total_cost variable, that it then returns

Module 1, Train the Model with Gradient Descent: Gradient Descent Lab