While we can individually predict the gender based on an individual with a certain height and weight, the entire dataset can be graphed and scored using every data point to determine whether the output is going to score a female or a male.
This section walks through the steps to visualize all of the predicted points in a graph.
- Compute the minimum and maximum points of the graph using the following script:
x_min = min(data_array[:,0])-0.1 x_max = max(data_array[:,0])+0.1 y_min = min(data_array[:,1])-0.1 y_max = max(data_array[:,1])+0.1 increment= 0.05 print(x_min, x_max, y_min, y_max)
- Generate x and y values in increments of 0.05 units and then create an array called
xy_data
, as seen in the following script:
x_data= np.arange(x_min, x_max, increment) y_data= np.arange(y_min, y_max, increment) xy_data = [[x_all, y_all] for x_all in x_data for y_all in y_data]
- Finally, a similar script...