abril4416 commited on
Commit ·
055a863
1
Parent(s): c04888d
Rename logistic cost labels to cost function wording
Browse filesFiles changed (2)
72 unmodified lines7374757677787980818247 unmodified lines13013113213313413572 unmodified lines<div id="modelDefinition" class="model-definition"></div><p class="hint">The height represents Binary Cross-Entropy (BCE) cost J(theta). Lower points correspond to parameter values that better fit class labels.</p><p class="hint">Each trajectory point is one gradient-descent update: horizontal movement = parameter changes, vertical movement = BCE change.</p><div id="landscapeSummary" class="landscape-summary"></div>47 unmodified lines</main><script src="https://cdn.plot.ly/plotly-2.35.2.min.js"></script><script src="cost.js?v=20260814c"></script></body></html>72 unmodified lines7374757677787980818247 unmodified lines13013113213313413572 unmodified lines<div id="modelDefinition" class="model-definition"></div><p class="hint">The height represents the cost function J(theta). Lower points correspond to parameter values that better fit class labels.</p><p class="hint">Each trajectory point is one gradient-descent update: horizontal movement = parameter changes, vertical movement = cost-function change.</p><div id="landscapeSummary" class="landscape-summary"></div>47 unmodified lines</main><script src="https://cdn.plot.ly/plotly-2.35.2.min.js"></script><script src="cost.js?v=20260816a"></script></body></html>
493 unmodified lines49449549649749849950096 unmodified lines5975985996006016026036046057 unmodified lines61361461561661761861962062143 unmodified lines66566666766866967067137 unmodified lines70971071171271371471571694 unmodified lines81181281381481581681781872 unmodified lines891892893894895896897493 unmodified lines`Iteration: ${point.step}`,`${meta.p1Name}: ${point.p1.toFixed(4)}`,`${meta.p2Name}: ${point.p2.toFixed(4)}`,`BCE cost: ${point.cost.toFixed(4)}`,].join("<br>");}96 unmodified linesif (state.trajectory.length === 0) {landscapeSummary.innerHTML = `<span class="landscape-pill">Start BCE: --</span><span class="landscape-pill">Current BCE: --</span><span class="landscape-pill">Final BCE: --</span><span class="landscape-pill">Reduction: --</span><span class="landscape-pill">Iterations: 0 / 0</span>`;7 unmodified linesconst reduction = ((start.cost - final.cost) / Math.max(1e-9, start.cost)) * 100;landscapeSummary.innerHTML = `<span class="landscape-pill">Start BCE: ${start.cost.toFixed(4)}</span><span class="landscape-pill">Current BCE: ${current.cost.toFixed(4)}</span><span class="landscape-pill">Final BCE: ${final.cost.toFixed(4)}</span><span class="landscape-pill">Reduction: ${reduction.toFixed(1)}%</span><span class="landscape-pill">Iterations: ${idx} / ${state.trajectory.length - 1}</span><span class="landscape-pill">${meta.p1Name}: ${current.p1.toFixed(3)}, ${meta.p2Name}: ${current.p2.toFixed(3)}</span>43 unmodified lines<span>Model case: ${meta.p1Name}, ${meta.p2Name}</span><span>Samples: ${m}</span><span>Current step: ${idx}</span><span>BCE: ${current.cost.toFixed(4)}</span><span>${meta.p1Label}: ${current.p1.toFixed(4)}</span><span>${meta.p2Label}: ${current.p2.toFixed(4)}</span>`;37 unmodified linescolorscale: "Viridis",showscale: showSurface,visible: showSurface || showContours,colorbar: { title: "BCE", thickness: 14 },hovertemplate: `${meta.p1Name}: %{x:.4f}<br>${meta.p2Name}: %{y:.4f}<br>BCE: %{z:.4f}<extra></extra>`,});if (showTrajectory && fullPath.length > 0) {94 unmodified linescolorscale: "Viridis",showscale: showSurface,visible: showSurface,colorbar: { title: "BCE", thickness: 14 },hovertemplate: `${meta.p1Name}: %{x:.4f}<br>${meta.p2Name}: %{y:.4f}<br>BCE: %{z:.4f}<extra></extra>`,});const contour3d = buildContourSegments3D(grid);72 unmodified linesscene: {xaxis: { title: meta.p1Label, range: [grid.p1Min, grid.p1Max], showspikes: false },yaxis: { title: meta.p2Label, range: [grid.p2Min, grid.p2Max], showspikes: false },zaxis: { title: "Binary Cross-Entropy J(theta)", range: [grid.min, grid.clipMax], showspikes: false },aspectmode: "manual",aspectratio: { x: 1.14, y: 1.12, z: 0.82 },camera: state.camera3d || cloneCamera(DEFAULT_CAMERA),493 unmodified lines49449549649749849950096 unmodified lines5975985996006016026036046057 unmodified lines61361461561661761861962062143 unmodified lines66566666766866967067137 unmodified lines70971071171271371471571694 unmodified lines81181281381481581681781872 unmodified lines891892893894895896897493 unmodified lines`Iteration: ${point.step}`,`${meta.p1Name}: ${point.p1.toFixed(4)}`,`${meta.p2Name}: ${point.p2.toFixed(4)}`,`Cost function: ${point.cost.toFixed(4)}`,].join("<br>");}96 unmodified linesif (state.trajectory.length === 0) {landscapeSummary.innerHTML = `<span class="landscape-pill">Start cost: --</span><span class="landscape-pill">Current cost: --</span><span class="landscape-pill">Final cost: --</span><span class="landscape-pill">Reduction: --</span><span class="landscape-pill">Iterations: 0 / 0</span>`;7 unmodified linesconst reduction = ((start.cost - final.cost) / Math.max(1e-9, start.cost)) * 100;landscapeSummary.innerHTML = `<span class="landscape-pill">Start cost: ${start.cost.toFixed(4)}</span><span class="landscape-pill">Current cost: ${current.cost.toFixed(4)}</span><span class="landscape-pill">Final cost: ${final.cost.toFixed(4)}</span><span class="landscape-pill">Reduction: ${reduction.toFixed(1)}%</span><span class="landscape-pill">Iterations: ${idx} / ${state.trajectory.length - 1}</span><span class="landscape-pill">${meta.p1Name}: ${current.p1.toFixed(3)}, ${meta.p2Name}: ${current.p2.toFixed(3)}</span>43 unmodified lines<span>Model case: ${meta.p1Name}, ${meta.p2Name}</span><span>Samples: ${m}</span><span>Current step: ${idx}</span><span>Cost function: ${current.cost.toFixed(4)}</span><span>${meta.p1Label}: ${current.p1.toFixed(4)}</span><span>${meta.p2Label}: ${current.p2.toFixed(4)}</span>`;37 unmodified linescolorscale: "Viridis",showscale: showSurface,visible: showSurface || showContours,colorbar: { title: "Cost function", thickness: 14 },hovertemplate: `${meta.p1Name}: %{x:.4f}<br>${meta.p2Name}: %{y:.4f}<br>Cost function: %{z:.4f}<extra></extra>`,});if (showTrajectory && fullPath.length > 0) {94 unmodified linescolorscale: "Viridis",showscale: showSurface,visible: showSurface,colorbar: { title: "Cost function", thickness: 14 },hovertemplate: `${meta.p1Name}: %{x:.4f}<br>${meta.p2Name}: %{y:.4f}<br>Cost function: %{z:.4f}<extra></extra>`,});const contour3d = buildContourSegments3D(grid);72 unmodified linesscene: {xaxis: { title: meta.p1Label, range: [grid.p1Min, grid.p1Max], showspikes: false },yaxis: { title: meta.p2Label, range: [grid.p2Min, grid.p2Max], showspikes: false },zaxis: { title: "Cost function J(theta)", range: [grid.min, grid.clipMax], showspikes: false },aspectmode: "manual",aspectratio: { x: 1.14, y: 1.12, z: 0.82 },camera: state.camera3d || cloneCamera(DEFAULT_CAMERA),
logistic-regression/cost-visualization.html+3-3
logistic-regression/cost.js+13-13