Machine Learning Portfolio Insights

Machine Learning Portfolio Insights

Analyze and showcase your machine learning projects.

Portfolio Dashboard

Model Performance by Project

Algorithm Usage Frequency

Your ML Projects

${value}

`; function renderCharts(chartData) { if (performanceChart) performanceChart.destroy(); performanceChart = new Chart(document.getElementById('performance-chart'), { type: 'bar', data: { labels: chartData.performance.map(p => p.name), datasets: [{ label: 'Performance Metric', data: chartData.performance.map(p => p.value), backgroundColor: 'rgba(59, 130, 246, 0.7)' }] }, options: { indexAxis: 'y' } }); if (algorithmChart) algorithmChart.destroy(); algorithmChart = new Chart(document.getElementById('algorithm-chart'), { type: 'doughnut', data: { labels: Object.keys(chartData.algorithms), datasets: [{ label: 'Usage', data: Object.values(chartData.algorithms), backgroundColor: ['#3b82f6', '#10b981', '#f97316', '#8b5cf6', '#ec4899'] }] } }); } // --- PDF GENERATION --- async function generatePdfReport() { const result = state.analysisResult; if (!result) return alert("Please run an analysis first."); downloadPdfBtn.disabled = true; downloadPdfBtn.textContent = 'Generating...'; const performanceChartImg = performanceChart.toBase64Image(); const algorithmChartImg = algorithmChart.toBase64Image(); const { kpis } = result; const projectsHtml = state.projects.map(p => `

${p.name}

Model Type: ${p.modelType}
Algorithm: ${p.algorithm}
${p.metricName}: ${p.metricValue}
Business Impact: $${p.impact.toLocaleString()}
`).join(''); const reportHtml = `

Machine Learning Portfolio

${state.ownerName}

Executive Summary

Total Projects
${kpis.totalProjects}
Total Impact
$${(kpis.totalImpact/1000).toFixed(0)}k
Most Used Type
${kpis.mostUsedType}
Avg. Impact
$${(kpis.totalImpact / kpis.totalProjects / 1000).toFixed(0)}k

Project Details

${projectsHtml}

Performance Visualizations

`; const pdfTemplate = document.getElementById('pdf-template'); pdfTemplate.innerHTML = reportHtml; pdfTemplate.classList.remove('invisible'); try { const { jsPDF } = window.jspdf; const canvas = await html2canvas(pdfTemplate.querySelector('.pdf-report-container'), { scale: 2 }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); pdf.addImage(imgData, 'PNG', 0, 0, pdf.internal.pageSize.getWidth(), (canvas.height * pdf.internal.pageSize.getWidth()) / canvas.width); pdf.save(`${state.ownerName.replace(/\s+/g, '_')}_ML_Portfolio.pdf`); } catch(e) { console.error('PDF Generation Error:', e); } finally { downloadPdfBtn.disabled = false; downloadPdfBtn.textContent = 'Download Portfolio PDF'; pdfTemplate.classList.add('invisible'); } } downloadPdfBtn.addEventListener('click', generatePdfReport); // --- INITIALIZATION --- renderProjectInputs(); attachDataListeners(); runAnalysis(); switchTab(0); });
Scroll to Top