Update 8_2_Bias_Variance_Trade_Off.ipynb
This commit is contained in:
@@ -77,7 +77,7 @@
|
|||||||
" for i in range(n_data):\n",
|
" for i in range(n_data):\n",
|
||||||
" x[i] = np.random.uniform(i/n_data, (i+1)/n_data, 1)\n",
|
" x[i] = np.random.uniform(i/n_data, (i+1)/n_data, 1)\n",
|
||||||
"\n",
|
"\n",
|
||||||
" # y value from running through functoin and adding noise\n",
|
" # y value from running through function and adding noise\n",
|
||||||
" y = np.ones(n_data)\n",
|
" y = np.ones(n_data)\n",
|
||||||
" for i in range(n_data):\n",
|
" for i in range(n_data):\n",
|
||||||
" y[i] = true_function(x[i])\n",
|
" y[i] = true_function(x[i])\n",
|
||||||
@@ -229,7 +229,7 @@
|
|||||||
" y_model_all = np.zeros((n_datasets, x_model.shape[0]))\n",
|
" y_model_all = np.zeros((n_datasets, x_model.shape[0]))\n",
|
||||||
"\n",
|
"\n",
|
||||||
" for c_dataset in range(n_datasets):\n",
|
" for c_dataset in range(n_datasets):\n",
|
||||||
" # TODO -- Generate n_data x,y, pairs with standard divation sigma_func\n",
|
" # TODO -- Generate n_data x,y, pairs with standard deviation sigma_func\n",
|
||||||
" # Replace this line\n",
|
" # Replace this line\n",
|
||||||
" x_data,y_data = np.zeros([1,n_data]),np.zeros([1,n_data])\n",
|
" x_data,y_data = np.zeros([1,n_data]),np.zeros([1,n_data])\n",
|
||||||
"\n",
|
"\n",
|
||||||
@@ -316,7 +316,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
" # Compute variance -- average of the model variance (average squared deviation of fitted models around mean fitted model)\n",
|
" # Compute variance -- average of the model variance (average squared deviation of fitted models around mean fitted model)\n",
|
||||||
" variance[c_hidden] = 0\n",
|
" variance[c_hidden] = 0\n",
|
||||||
" # Compute bias (average squared deviaton of mean fitted model around true function)\n",
|
" # Compute bias (average squared deviation of mean fitted model around true function)\n",
|
||||||
" bias[c_hidden] = 0\n",
|
" bias[c_hidden] = 0\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# Plot the results\n",
|
"# Plot the results\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user