Created using Colab

This commit is contained in:
udlbook
2025-11-05 14:25:21 -05:00
parent 1c2e19aa3b
commit 6a8273459f

View File

@@ -4,7 +4,6 @@
"metadata": {
"colab": {
"provenance": [],
"authorship_tag": "ABX9TyPJzymRTuvoWggIskM2Kamc",
"include_colab_link": true
},
"kernelspec": {
@@ -458,14 +457,14 @@
{
"cell_type": "code",
"source": [
"def dldphi0(phi, lambda_):\n",
"def dregdphi0(phi, lambda_):\n",
" # TODO compute the derivative with respect to phi0\n",
" # Replace this line:]\n",
" deriv = 0\n",
"\n",
" return deriv\n",
"\n",
"def dldphi1(phi, lambda_):\n",
"def dregdphi1(phi, lambda_):\n",
" # TODO compute the derivative with respect to phi1\n",
" # Replace this line:]\n",
" deriv = 0\n",
@@ -475,8 +474,8 @@
"\n",
"\n",
"def compute_gradient2(data_x, data_y, phi, lambda_):\n",
" dl_dphi0 = gabor_deriv_phi0(data_x, data_y, phi[0],phi[1])+dldphi0(np.squeeze(phi), lambda_)\n",
" dl_dphi1 = gabor_deriv_phi1(data_x, data_y, phi[0],phi[1])+dldphi1(np.squeeze(phi), lambda_)\n",
" dl_dphi0 = gabor_deriv_phi0(data_x, data_y, phi[0],phi[1])+dregdphi0(np.squeeze(phi), lambda_)\n",
" dl_dphi1 = gabor_deriv_phi1(data_x, data_y, phi[0],phi[1])+dregdphi1(np.squeeze(phi), lambda_)\n",
" # Return the gradient\n",
" return np.array([[dl_dphi0],[dl_dphi1]])\n",
"\n",
@@ -535,4 +534,4 @@
}
}
]
}
}