Download cours.html from MAALOUFimad02/Machine_Learning_Training: direct link, hf CLI and curl.
- Browser
- Download file 47.1 kB
-
https://huggingface.co/spaces/MAALOUFimad02/Machine_Learning_Training/resolve/main/cours.html
- Command line
-
hf download hf://spaces/MAALOUFimad02/Machine_Learning_Training/cours.html
-
curl -L -o cours.html https://huggingface.co/spaces/MAALOUFimad02/Machine_Learning_Training/resolve/main/cours.html
47.1 kB
| <html lang="fr"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Cours — ML Academy</title> | |
| <link rel="stylesheet" href="css/shared.css"> | |
| <script> | |
| window.MathJax = { | |
| tex: { | |
| inlineMath: [['$', '$'], ['\\(', '\\)']], | |
| displayMath: [['$$', '$$'], ['\\[', '\\]']] | |
| }, | |
| options: { skipHtmlTags: ['script','noscript','style','textarea','pre'] } | |
| }; | |
| </script> | |
| <script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script> | |
| <style> | |
| /* LAYOUT WITH SIDEBAR */ | |
| .course-layout { | |
| display: flex; | |
| min-height: calc(100vh - var(--navbar-height)); | |
| } | |
| /* SIDEBAR */ | |
| .sidebar { | |
| width: var(--sidebar-width); | |
| background: var(--bg-secondary); | |
| border-right: 1px solid var(--border-color); | |
| position: fixed; | |
| top: var(--navbar-height); | |
| left: 0; | |
| bottom: 0; | |
| overflow-y: auto; | |
| z-index: 100; | |
| animation: fadeInLeft 0.5s ease; | |
| } | |
| .sidebar-header { | |
| padding: var(--space-xl); | |
| border-bottom: 1px solid var(--border-color); | |
| } | |
| .sidebar-badge { | |
| display: inline-block; | |
| padding: var(--space-xs) var(--space-sm); | |
| background: rgba(99, 102, 241, 0.1); | |
| border: 1px solid rgba(99, 102, 241, 0.3); | |
| border-radius: var(--radius-sm); | |
| font-family: 'JetBrains Mono', monospace; | |
| font-size: 0.65rem; | |
| color: var(--primary-light); | |
| text-transform: uppercase; | |
| letter-spacing: 1px; | |
| margin-bottom: var(--space-sm); | |
| } | |
| .sidebar-title { | |
| font-size: 1.1rem; | |
| font-weight: 700; | |
| color: var(--text-primary); | |
| margin-bottom: var(--space-xs); | |
| } | |
| .sidebar-subtitle { | |
| font-size: 0.8rem; | |
| color: var(--text-muted); | |
| } | |
| .sidebar-nav { | |
| padding: var(--space-md) 0; | |
| } | |
| .nav-section { | |
| margin-bottom: var(--space-md); | |
| } | |
| .nav-section-title { | |
| padding: var(--space-sm) var(--space-xl); | |
| font-family: 'JetBrains Mono', monospace; | |
| font-size: 0.65rem; | |
| color: var(--text-muted); | |
| text-transform: uppercase; | |
| letter-spacing: 1px; | |
| } | |
| .nav-item { | |
| display: flex; | |
| align-items: center; | |
| gap: var(--space-sm); | |
| padding: var(--space-sm) var(--space-xl); | |
| color: var(--text-secondary); | |
| text-decoration: none; | |
| font-size: 0.9rem; | |
| transition: all var(--transition-base); | |
| border-left: 3px solid transparent; | |
| } | |
| .nav-item:hover { | |
| background: var(--bg-hover); | |
| color: var(--text-primary); | |
| border-left-color: var(--primary); | |
| } | |
| .nav-item.active { | |
| background: rgba(99, 102, 241, 0.1); | |
| color: var(--primary-light); | |
| border-left-color: var(--primary); | |
| } | |
| .nav-icon { | |
| font-size: 1rem; | |
| font-family: 'JetBrains Mono', monospace; | |
| color: var(--text-muted); | |
| } | |
| .sidebar-footer { | |
| padding: var(--space-lg) var(--space-xl); | |
| border-top: 1px solid var(--border-color); | |
| margin-top: auto; | |
| } | |
| .progress-label { | |
| font-size: 0.75rem; | |
| color: var(--text-muted); | |
| margin-bottom: var(--space-sm); | |
| display: flex; | |
| justify-content: space-between; | |
| } | |
| .progress-bar { | |
| height: 6px; | |
| background: var(--bg-tertiary); | |
| border-radius: 3px; | |
| overflow: hidden; | |
| } | |
| .progress-fill { | |
| height: 100%; | |
| background: linear-gradient(90deg, var(--primary), var(--secondary)); | |
| border-radius: 3px; | |
| transition: width 0.5s ease; | |
| animation: progress 1s ease; | |
| } | |
| /* PDF DOWNLOAD BUTTON */ | |
| .pdf-download { | |
| display: flex; | |
| align-items: center; | |
| gap: var(--space-sm); | |
| padding: var(--space-sm) var(--space-md); | |
| background: rgba(239, 68, 68, 0.1); | |
| border: 1px solid rgba(239, 68, 68, 0.3); | |
| border-radius: var(--radius-md); | |
| color: #ef4444; | |
| font-size: 0.8rem; | |
| font-weight: 600; | |
| text-decoration: none; | |
| margin-top: var(--space-md); | |
| transition: all var(--transition-base); | |
| } | |
| .pdf-download:hover { | |
| background: rgba(239, 68, 68, 0.2); | |
| transform: translateY(-2px); | |
| } | |
| /* MAIN CONTENT */ | |
| .main-content { | |
| flex: 1; | |
| margin-left: var(--sidebar-width); | |
| padding: var(--space-2xl); | |
| max-width: 900px; | |
| } | |
| /* COURSE HERO */ | |
| .course-hero { | |
| text-align: center; | |
| padding: var(--space-2xl) 0; | |
| margin-bottom: var(--space-2xl); | |
| border-bottom: 1px solid var(--border-color); | |
| } | |
| .course-hero-badge { | |
| display: inline-flex; | |
| align-items: center; | |
| gap: var(--space-sm); | |
| padding: var(--space-xs) var(--space-md); | |
| background: rgba(16, 185, 129, 0.1); | |
| border: 1px solid rgba(16, 185, 129, 0.3); | |
| border-radius: 20px; | |
| font-size: 0.75rem; | |
| color: var(--success); | |
| margin-bottom: var(--space-lg); | |
| } | |
| .course-hero-badge .dot { | |
| width: 6px; | |
| height: 6px; | |
| background: var(--success); | |
| border-radius: 50%; | |
| animation: pulse 2s ease-in-out infinite; | |
| } | |
| .course-hero-title { | |
| font-size: clamp(1.75rem, 4vw, 2.5rem); | |
| font-weight: 700; | |
| color: var(--text-primary); | |
| margin-bottom: var(--space-md); | |
| } | |
| .course-hero-subtitle { | |
| font-size: 1rem; | |
| color: var(--text-secondary); | |
| margin-bottom: var(--space-xl); | |
| } | |
| .course-hero-stats { | |
| display: flex; | |
| justify-content: center; | |
| gap: var(--space-2xl); | |
| flex-wrap: wrap; | |
| } | |
| .course-hero-stat { | |
| text-align: center; | |
| } | |
| .course-hero-stat-value { | |
| font-family: 'JetBrains Mono', monospace; | |
| font-size: 2rem; | |
| font-weight: 700; | |
| color: var(--text-primary); | |
| } | |
| .course-hero-stat-label { | |
| font-size: 0.7rem; | |
| color: var(--text-muted); | |
| text-transform: uppercase; | |
| letter-spacing: 1px; | |
| margin-top: var(--space-xs); | |
| } | |
| /* SECTIONS */ | |
| .section { | |
| margin-bottom: var(--space-3xl); | |
| scroll-margin-top: calc(var(--navbar-height) + var(--space-lg)); | |
| } | |
| .section-header { | |
| margin-bottom: var(--space-xl); | |
| padding-bottom: var(--space-md); | |
| border-bottom: 1px solid var(--border-color); | |
| } | |
| .section-badge { | |
| display: inline-block; | |
| padding: var(--space-xs) var(--space-sm); | |
| background: rgba(99, 102, 241, 0.1); | |
| border-radius: var(--radius-sm); | |
| font-family: 'JetBrains Mono', monospace; | |
| font-size: 0.65rem; | |
| color: var(--primary-light); | |
| text-transform: uppercase; | |
| letter-spacing: 1px; | |
| margin-bottom: var(--space-sm); | |
| } | |
| .section-title { | |
| font-size: clamp(1.5rem, 3vw, 2rem); | |
| font-weight: 700; | |
| color: var(--text-primary); | |
| margin-bottom: var(--space-sm); | |
| } | |
| .section-title small { | |
| display: block; | |
| font-size: 0.9rem; | |
| color: var(--text-muted); | |
| font-weight: 500; | |
| margin-bottom: var(--space-xs); | |
| } | |
| .section-content p { | |
| font-size: 1rem; | |
| color: var(--text-secondary); | |
| line-height: 1.8; | |
| margin-bottom: var(--space-md); | |
| } | |
| .section-content strong { | |
| color: var(--text-primary); | |
| font-weight: 600; | |
| } | |
| /* CARDS GRID */ | |
| .cards-grid { | |
| display: grid; | |
| grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); | |
| gap: var(--space-md); | |
| margin: var(--space-lg) 0; | |
| } | |
| .info-card { | |
| background: var(--bg-card); | |
| border: 1px solid var(--border-color); | |
| border-radius: var(--radius-md); | |
| padding: var(--space-lg); | |
| transition: all var(--transition-base); | |
| } | |
| .info-card:hover { | |
| border-color: var(--primary); | |
| transform: translateY(-3px); | |
| } | |
| .info-card-icon { | |
| width: 40px; | |
| height: 40px; | |
| background: linear-gradient(135deg, var(--primary), var(--secondary)); | |
| border-radius: var(--radius-md); | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| font-size: 1rem; | |
| font-weight: 700; | |
| color: white; | |
| margin-bottom: var(--space-sm); | |
| } | |
| .info-card-title { | |
| font-size: 1rem; | |
| font-weight: 600; | |
| color: var(--text-primary); | |
| margin-bottom: var(--space-xs); | |
| } | |
| .info-card-text { | |
| font-size: 0.85rem; | |
| color: var(--text-secondary); | |
| } | |
| .info-card-tag { | |
| display: inline-block; | |
| margin-top: var(--space-sm); | |
| padding: var(--space-xs) var(--space-sm); | |
| background: var(--bg-tertiary); | |
| border-radius: var(--radius-sm); | |
| font-family: 'JetBrains Mono', monospace; | |
| font-size: 0.65rem; | |
| color: var(--text-muted); | |
| } | |
| /* PIPELINE */ | |
| .pipeline { | |
| display: flex; | |
| flex-wrap: wrap; | |
| gap: var(--space-md); | |
| margin: var(--space-xl) 0; | |
| padding: var(--space-lg); | |
| background: var(--bg-card); | |
| border: 1px solid var(--border-color); | |
| border-radius: var(--radius-lg); | |
| } | |
| .pipeline-step { | |
| flex: 1; | |
| min-width: 120px; | |
| text-align: center; | |
| padding: var(--space-md); | |
| position: relative; | |
| } | |
| .pipeline-step:not(:last-child)::after { | |
| content: '->'; | |
| position: absolute; | |
| right: -15px; | |
| top: 50%; | |
| transform: translateY(-50%); | |
| color: var(--primary); | |
| font-family: 'JetBrains Mono', monospace; | |
| font-size: 1rem; | |
| } | |
| .pipeline-num { | |
| width: 36px; | |
| height: 36px; | |
| background: linear-gradient(135deg, var(--primary), var(--secondary)); | |
| border-radius: 50%; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| font-family: 'JetBrains Mono', monospace; | |
| font-size: 0.9rem; | |
| font-weight: 700; | |
| color: white; | |
| margin: 0 auto var(--space-sm); | |
| } | |
| .pipeline-label { | |
| font-size: 0.85rem; | |
| font-weight: 600; | |
| color: var(--text-primary); | |
| margin-bottom: var(--space-xs); | |
| } | |
| .pipeline-desc { | |
| font-size: 0.75rem; | |
| color: var(--text-muted); | |
| } | |
| /* CHECKLIST */ | |
| .checklist { | |
| list-style: none; | |
| padding: 0; | |
| margin: var(--space-lg) 0; | |
| } | |
| .checklist li { | |
| display: flex; | |
| align-items: flex-start; | |
| gap: var(--space-sm); | |
| padding: var(--space-sm) 0; | |
| font-size: 0.95rem; | |
| color: var(--text-secondary); | |
| } | |
| .checklist li::before { | |
| content: '[v]'; | |
| color: var(--success); | |
| font-family: 'JetBrains Mono', monospace; | |
| font-weight: 700; | |
| flex-shrink: 0; | |
| } | |
| /* EQUATIONS */ | |
| .equation-block { | |
| background: var(--bg-card); | |
| border: 1px solid var(--border-color); | |
| border-left: 3px solid var(--primary); | |
| border-radius: var(--radius-md); | |
| padding: var(--space-lg); | |
| margin: var(--space-lg) 0; | |
| text-align: center; | |
| overflow-x: auto; | |
| } | |
| .equation-label { | |
| display: block; | |
| font-family: 'JetBrains Mono', monospace; | |
| font-size: 0.7rem; | |
| color: var(--text-muted); | |
| text-align: right; | |
| margin-top: var(--space-sm); | |
| } | |
| /* COMPARISON GRID */ | |
| .comparison-grid { | |
| display: grid; | |
| grid-template-columns: repeat(2, 1fr); | |
| gap: var(--space-md); | |
| margin: var(--space-lg) 0; | |
| } | |
| .comparison-box { | |
| background: var(--bg-card); | |
| border: 1px solid var(--border-color); | |
| border-radius: var(--radius-md); | |
| padding: var(--space-lg); | |
| } | |
| .comparison-box h4 { | |
| font-size: 0.9rem; | |
| font-weight: 600; | |
| color: var(--text-primary); | |
| margin-bottom: var(--space-md); | |
| padding-bottom: var(--space-sm); | |
| border-bottom: 1px solid var(--border-color); | |
| } | |
| .comparison-box ul { | |
| list-style: none; | |
| padding: 0; | |
| margin: 0; | |
| } | |
| .comparison-box li { | |
| padding: var(--space-xs) 0; | |
| font-size: 0.85rem; | |
| color: var(--text-secondary); | |
| } | |
| .comparison-box li::before { | |
| content: '>'; | |
| color: var(--primary); | |
| margin-right: var(--space-sm); | |
| font-family: 'JetBrains Mono', monospace; | |
| } | |
| /* METRIC CARDS */ | |
| .metric-row { | |
| display: grid; | |
| grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); | |
| gap: var(--space-md); | |
| margin: var(--space-lg) 0; | |
| } | |
| .metric-card { | |
| background: var(--bg-card); | |
| border: 1px solid var(--border-color); | |
| border-radius: var(--radius-md); | |
| padding: var(--space-lg); | |
| text-align: center; | |
| transition: all var(--transition-base); | |
| } | |
| .metric-card:hover { | |
| border-color: var(--primary); | |
| transform: translateY(-3px); | |
| } | |
| .metric-name { | |
| font-family: 'JetBrains Mono', monospace; | |
| font-size: 0.75rem; | |
| color: var(--text-muted); | |
| text-transform: uppercase; | |
| letter-spacing: 1px; | |
| margin-bottom: var(--space-sm); | |
| } | |
| .metric-formula { | |
| font-family: 'JetBrains Mono', monospace; | |
| font-size: 1rem; | |
| color: var(--primary-light); | |
| font-weight: 600; | |
| margin-bottom: var(--space-xs); | |
| } | |
| .metric-desc { | |
| font-size: 0.75rem; | |
| color: var(--text-muted); | |
| } | |
| /* RESPONSIVE */ | |
| @media (max-width: 768px) { | |
| .sidebar { | |
| transform: translateX(-100%); | |
| transition: transform var(--transition-base); | |
| } | |
| .sidebar.open { | |
| transform: translateX(0); | |
| } | |
| .main-content { | |
| margin-left: 0; | |
| padding: var(--space-lg); | |
| } | |
| .comparison-grid { | |
| grid-template-columns: 1fr; | |
| } | |
| .pipeline-step:not(:last-child)::after { | |
| display: none; | |
| } | |
| } | |
| /* BACK TO TOP */ | |
| .back-to-top { | |
| position: fixed; | |
| bottom: var(--space-xl); | |
| right: var(--space-xl); | |
| width: 44px; | |
| height: 44px; | |
| background: var(--primary); | |
| border: none; | |
| border-radius: 50%; | |
| color: white; | |
| font-size: 1.2rem; | |
| cursor: pointer; | |
| opacity: 0; | |
| visibility: hidden; | |
| transition: all var(--transition-base); | |
| z-index: 1000; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| } | |
| .back-to-top.visible { | |
| opacity: 1; | |
| visibility: visible; | |
| } | |
| .back-to-top:hover { | |
| background: var(--primary-light); | |
| transform: translateY(-3px); | |
| } | |
| /* AUTHOR FOOTER */ | |
| .author-footer { | |
| background: var(--bg-secondary); | |
| border-top: 1px solid var(--border-color); | |
| padding: var(--space-xl); | |
| text-align: center; | |
| } | |
| .author-info { | |
| display: flex; | |
| justify-content: center; | |
| gap: var(--space-xl); | |
| flex-wrap: wrap; | |
| margin-bottom: var(--space-md); | |
| } | |
| .author-link { | |
| display: flex; | |
| align-items: center; | |
| gap: var(--space-sm); | |
| color: var(--text-secondary); | |
| text-decoration: none; | |
| font-size: 0.9rem; | |
| transition: color var(--transition-base); | |
| } | |
| .author-link:hover { | |
| color: var(--primary-light); | |
| } | |
| .author-link svg { | |
| width: 18px; | |
| height: 18px; | |
| fill: currentColor; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <!-- Particles Background --> | |
| <div class="particles-container"> | |
| <div class="particle"></div> | |
| <div class="particle"></div> | |
| <div class="particle"></div> | |
| <div class="particle"></div> | |
| <div class="particle"></div> | |
| </div> | |
| <!-- Navigation --> | |
| <nav class="navbar"> | |
| <a href="index.html" class="navbar-brand"> | |
| <div class="brand-logo">ML</div> | |
| <span>ML Academy</span> | |
| </a> | |
| <div class="navbar-nav"> | |
| <a href="index.html" class="nav-link"> | |
| <span class="nav-icon">[H]</span> | |
| <span>Accueil</span> | |
| </a> | |
| <a href="cours.html" class="nav-link active"> | |
| <span class="nav-icon">[C]</span> | |
| <span>Cours</span> | |
| </a> | |
| <a href="tp.html" class="nav-link"> | |
| <span class="nav-icon">[T]</span> | |
| <span>TPs</span> | |
| </a> | |
| <a href="feedback.html" class="nav-link"> | |
| <span class="nav-icon">[F]</span> | |
| <span>Contact</span> | |
| </a> | |
| </div> | |
| <div class="nav-badge"> | |
| <div class="dot"></div> | |
| <span>Google Colab Ready</span> | |
| </div> | |
| </nav> | |
| <!-- Course Layout --> | |
| <div class="course-layout"> | |
| <!-- Sidebar --> | |
| <aside class="sidebar"> | |
| <div class="sidebar-header"> | |
| <div class="sidebar-badge">Formation 2025/2026</div> | |
| <h1 class="sidebar-title">Machine Learning</h1> | |
| <p class="sidebar-subtitle">Cours theoriques complets</p> | |
| <a href="cours.pdf" class="pdf-download" download> | |
| <svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"> | |
| <path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/> | |
| </svg> | |
| Telecharger le PDF | |
| </a> | |
| </div> | |
| <nav class="sidebar-nav"> | |
| <div class="nav-section"> | |
| <div class="nav-section-title">Introduction</div> | |
| <a href="#intro" class="nav-item active"> | |
| <span class="nav-icon">[1]</span> | |
| <span>Qu'est-ce que le ML ?</span> | |
| </a> | |
| </div> | |
| <div class="nav-section"> | |
| <div class="nav-section-title">Algorithmes Supervises</div> | |
| <a href="#regression" class="nav-item"> | |
| <span class="nav-icon">[2]</span> | |
| <span>Regression Lineaire</span> | |
| </a> | |
| <a href="#logistic" class="nav-item"> | |
| <span class="nav-icon">[3]</span> | |
| <span>Regression Logistique</span> | |
| </a> | |
| <a href="#randomforest" class="nav-item"> | |
| <span class="nav-icon">[4]</span> | |
| <span>Random Forest</span> | |
| </a> | |
| </div> | |
| <div class="nav-section"> | |
| <div class="nav-section-title">Deep Learning</div> | |
| <a href="#neuralnets" class="nav-item"> | |
| <span class="nav-icon">[5]</span> | |
| <span>Reseaux de Neurones</span> | |
| </a> | |
| <a href="#lstm" class="nav-item"> | |
| <span class="nav-icon">[6]</span> | |
| <span>LSTM & Series Temp.</span> | |
| </a> | |
| </div> | |
| <div class="nav-section"> | |
| <div class="nav-section-title">Evaluation</div> | |
| <a href="#metrics" class="nav-item"> | |
| <span class="nav-icon">[7]</span> | |
| <span>Metriques</span> | |
| </a> | |
| <a href="#optimization" class="nav-item"> | |
| <span class="nav-icon">[8]</span> | |
| <span>Optimisation</span> | |
| </a> | |
| </div> | |
| <div class="nav-section"> | |
| <div class="nav-section-title">Navigation</div> | |
| <a href="index.html" class="nav-item"> | |
| <span class="nav-icon">[H]</span> | |
| <span>Accueil</span> | |
| </a> | |
| <a href="tp.html" class="nav-item"> | |
| <span class="nav-icon">[T]</span> | |
| <span>Travaux Pratiques</span> | |
| </a> | |
| <a href="feedback.html" class="nav-item"> | |
| <span class="nav-icon">[F]</span> | |
| <span>Questions</span> | |
| </a> | |
| </div> | |
| </nav> | |
| <div class="sidebar-footer"> | |
| <div class="progress-label"> | |
| <span>Progression</span> | |
| <span id="progress-text">0%</span> | |
| </div> | |
| <div class="progress-bar"> | |
| <div class="progress-fill" id="progress-fill" style="width: 0%"></div> | |
| </div> | |
| </div> | |
| </aside> | |
| <!-- Main Content --> | |
| <main class="main-content"> | |
| <!-- Course Hero --> | |
| <div class="course-hero scroll-animate"> | |
| <div class="course-hero-badge"> | |
| <div class="dot"></div> | |
| <span>Pret a executer sur Google Colab</span> | |
| </div> | |
| <h1 class="course-hero-title"> | |
| Cours de <span class="gradient-text">Machine Learning</span> | |
| </h1> | |
| <p class="course-hero-subtitle"> | |
| Formation complete couvrant les algorithmes fondamentaux jusqu'aux techniques avancees. | |
| </p> | |
| <div class="course-hero-stats"> | |
| <div class="course-hero-stat"> | |
| <div class="course-hero-stat-value">8</div> | |
| <div class="course-hero-stat-label">Chapitres</div> | |
| </div> | |
| <div class="course-hero-stat"> | |
| <div class="course-hero-stat-value">25+</div> | |
| <div class="course-hero-stat-label">Equations</div> | |
| </div> | |
| <div class="course-hero-stat"> | |
| <div class="course-hero-stat-value">50+</div> | |
| <div class="course-hero-stat-label">Exemples de code</div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Section 1: Introduction --> | |
| <section class="section" id="intro"> | |
| <div class="section-header scroll-animate"> | |
| <div class="section-badge">Partie 1 · 20 min</div> | |
| <h2 class="section-title"> | |
| <small>Fondamentaux</small> | |
| Qu'est-ce que le Machine Learning ? | |
| </h2> | |
| </div> | |
| <div class="section-content scroll-animate"> | |
| <p> | |
| Le <strong>Machine Learning (ML)</strong> est une branche de l'intelligence artificielle | |
| qui permet aux machines d'apprendre a partir de donnees <em>sans etre explicitement programmees</em> | |
| pour chaque tache. Au lieu de coder des regles a la main, on montre des exemples au modele | |
| et il decouvre lui-meme les patterns. | |
| </p> | |
| <div class="callout callout-info scroll-animate"> | |
| <div class="callout-icon">[i]</div> | |
| <div class="callout-content"> | |
| <div class="callout-title">Idee fondamentale</div> | |
| <div class="callout-text"> | |
| On cherche a approximer une fonction inconnue $f$ telle que $\hat{y} = f(x_1, x_2, \ldots, x_n)$. | |
| Le modele ML apprend cette fonction a partir d'exemples $(x, y)$ connus. | |
| </div> | |
| </div> | |
| </div> | |
| <h3 style="font-size: 1.2rem; font-weight: 600; color: var(--text-primary); margin: var(--space-xl) 0 var(--space-md);"> | |
| Types d'apprentissage | |
| </h3> | |
| <div class="cards-grid scroll-animate"> | |
| <div class="info-card"> | |
| <div class="info-card-icon">S</div> | |
| <h4 class="info-card-title">Supervise</h4> | |
| <p class="info-card-text">Donnees labellisees $(x, y)$ : regression et classification.</p> | |
| <span class="info-card-tag">Predictions</span> | |
| </div> | |
| <div class="info-card"> | |
| <div class="info-card-icon">N</div> | |
| <h4 class="info-card-title">Non supervise</h4> | |
| <p class="info-card-text">Pas de labels : clustering, reduction de dimension.</p> | |
| <span class="info-card-tag">Patterns</span> | |
| </div> | |
| <div class="info-card"> | |
| <div class="info-card-icon">R</div> | |
| <h4 class="info-card-title">Par renforcement</h4> | |
| <p class="info-card-text">Agent apprend via actions-recompenses.</p> | |
| <span class="info-card-tag">Strategies</span> | |
| </div> | |
| </div> | |
| <h3 style="font-size: 1.2rem; font-weight: 600; color: var(--text-primary); margin: var(--space-xl) 0 var(--space-md);"> | |
| Pipeline ML typique | |
| </h3> | |
| <div class="pipeline scroll-animate"> | |
| <div class="pipeline-step"> | |
| <div class="pipeline-num">1</div> | |
| <div class="pipeline-label">Donnees</div> | |
| <div class="pipeline-desc">Collecte & nettoyage</div> | |
| </div> | |
| <div class="pipeline-step"> | |
| <div class="pipeline-num">2</div> | |
| <div class="pipeline-label">Features</div> | |
| <div class="pipeline-desc">Engineering</div> | |
| </div> | |
| <div class="pipeline-step"> | |
| <div class="pipeline-num">3</div> | |
| <div class="pipeline-label">Split</div> | |
| <div class="pipeline-desc">Train / Test</div> | |
| </div> | |
| <div class="pipeline-step"> | |
| <div class="pipeline-num">4</div> | |
| <div class="pipeline-label">Modele</div> | |
| <div class="pipeline-desc">Entrainement</div> | |
| </div> | |
| <div class="pipeline-step"> | |
| <div class="pipeline-num">5</div> | |
| <div class="pipeline-label">Evaluation</div> | |
| <div class="pipeline-desc">Metriques</div> | |
| </div> | |
| <div class="pipeline-step"> | |
| <div class="pipeline-num">6</div> | |
| <div class="pipeline-label">Production</div> | |
| <div class="pipeline-desc">Deploiement</div> | |
| </div> | |
| </div> | |
| </div> | |
| </section> | |
| <!-- Section 2: Regression Lineaire --> | |
| <section class="section" id="regression"> | |
| <div class="section-header scroll-animate"> | |
| <div class="section-badge">Partie 2 · 25 min</div> | |
| <h2 class="section-title"> | |
| <small>Algorithmes de base</small> | |
| Regression Lineaire | |
| </h2> | |
| </div> | |
| <div class="section-content scroll-animate"> | |
| <p> | |
| La <strong>regression lineaire</strong> modelise la relation entre les features et la cible | |
| par une fonction affine. C'est l'algorithme le plus simple mais souvent tres efficace | |
| comme baseline. | |
| </p> | |
| <div class="equation-block"> | |
| $$\hat{y} = w_0 + w_1 x_1 + w_2 x_2 + \cdots + w_n x_n = \mathbf{w}^T \mathbf{x}$$ | |
| <span class="equation-label">Modele lineaire avec coefficients $\mathbf{w}$</span> | |
| </div> | |
| <p> | |
| L'objectif est de minimiser l'erreur quadratique moyenne (MSE) : | |
| </p> | |
| <div class="equation-block"> | |
| $$\text{MSE} = \frac{1}{m} \sum_{i=1}^{m} (y_i - \hat{y}_i)^2$$ | |
| <span class="equation-label">Fonction de cout : moyenne des erreurs quadratiques</span> | |
| </div> | |
| <div class="callout callout-info scroll-animate"> | |
| <div class="callout-icon">[i]</div> | |
| <div class="callout-content"> | |
| <div class="callout-title">Solution analytique</div> | |
| <div class="callout-text"> | |
| La regression lineaire admet une solution fermee : | |
| $\mathbf{w}^* = (X^T X)^{-1} X^T Y$. Pas besoin d'iterations ! | |
| </div> | |
| </div> | |
| </div> | |
| <div class="comparison-grid scroll-animate"> | |
| <div class="comparison-box"> | |
| <h4>[+] Avantages</h4> | |
| <ul> | |
| <li>Tres rapide a entrainer</li> | |
| <li>Interpretable (coefficients)</li> | |
| <li>Pas d'hyperparametres</li> | |
| <li>Excellent baseline</li> | |
| </ul> | |
| </div> | |
| <div class="comparison-box"> | |
| <h4>[-] Limitations</h4> | |
| <ul> | |
| <li>Relation lineaire uniquement</li> | |
| <li>Sensible aux outliers</li> | |
| <li>Performance decroit en haute dimension</li> | |
| </ul> | |
| </div> | |
| </div> | |
| </div> | |
| </section> | |
| <!-- Section 3: Regression Logistique --> | |
| <section class="section" id="logistic"> | |
| <div class="section-header scroll-animate"> | |
| <div class="section-badge">Partie 3 · 20 min</div> | |
| <h2 class="section-title"> | |
| <small>Classification</small> | |
| Regression Logistique | |
| </h2> | |
| </div> | |
| <div class="section-content scroll-animate"> | |
| <p> | |
| Malgre son nom, la <strong>regression logistique</strong> est un algorithme de <em>classification</em>. | |
| Elle predit la probabilite d'appartenance a une classe en utilisant la fonction sigmoide. | |
| </p> | |
| <div class="equation-block"> | |
| $$P(y=1|\mathbf{x}) = \sigma(\mathbf{w}^T \mathbf{x}) = \frac{1}{1 + e^{-\mathbf{w}^T \mathbf{x}}}$$ | |
| <span class="equation-label">Fonction sigmoide pour la classification binaire</span> | |
| </div> | |
| <div class="callout callout-success scroll-animate"> | |
| <div class="callout-icon">[v]</div> | |
| <div class="callout-content"> | |
| <div class="callout-title">Cas d'usage : Dataset Titanic</div> | |
| <div class="callout-text"> | |
| Predire la survie des passagers du Titanic a partir de leur age, sexe, | |
| classe de billet, etc. Un classique du ML pour debuter ! | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </section> | |
| <!-- Section 4: Random Forest --> | |
| <section class="section" id="randomforest"> | |
| <div class="section-header scroll-animate"> | |
| <div class="section-badge">Partie 4 · 30 min</div> | |
| <h2 class="section-title"> | |
| <small>Ensemble Learning</small> | |
| Random Forest | |
| </h2> | |
| </div> | |
| <div class="section-content scroll-animate"> | |
| <p> | |
| <strong>Random Forest</strong> est un ensemble d'arbres de decision qui votent pour predire. | |
| C'est l'un des algorithmes les plus populaires en ML applique : performant, robuste, | |
| peu sensible au tuning. | |
| </p> | |
| <h3 style="font-size: 1.2rem; font-weight: 600; color: var(--text-primary); margin: var(--space-xl) 0 var(--space-md);"> | |
| Algorithm : Bagging + Random Splits | |
| </h3> | |
| <div class="pipeline scroll-animate"> | |
| <div class="pipeline-step"> | |
| <div class="pipeline-num">1</div> | |
| <div class="pipeline-label">Bootstrap</div> | |
| <div class="pipeline-desc">Echantillons aleatoires</div> | |
| </div> | |
| <div class="pipeline-step"> | |
| <div class="pipeline-num">2</div> | |
| <div class="pipeline-label">Splits</div> | |
| <div class="pipeline-desc">Features aleatoires</div> | |
| </div> | |
| <div class="pipeline-step"> | |
| <div class="pipeline-num">3</div> | |
| <div class="pipeline-label">Arbres</div> | |
| <div class="pipeline-desc">N arbres independants</div> | |
| </div> | |
| <div class="pipeline-step"> | |
| <div class="pipeline-num">4</div> | |
| <div class="pipeline-label">Vote</div> | |
| <div class="pipeline-desc">Moyenne ou mode</div> | |
| </div> | |
| </div> | |
| <div class="metric-row scroll-animate"> | |
| <div class="metric-card"> | |
| <div class="metric-name">n_estimators</div> | |
| <div class="metric-formula">100 - 500</div> | |
| <div class="metric-desc">Nombre d'arbres</div> | |
| </div> | |
| <div class="metric-card"> | |
| <div class="metric-name">max_depth</div> | |
| <div class="metric-formula">10 - 30</div> | |
| <div class="metric-desc">Profondeur max</div> | |
| </div> | |
| <div class="metric-card"> | |
| <div class="metric-name">min_samples_split</div> | |
| <div class="metric-formula">2 - 10</div> | |
| <div class="metric-desc">Min pour splitter</div> | |
| </div> | |
| </div> | |
| <div class="callout callout-success scroll-animate"> | |
| <div class="callout-icon">[*]</div> | |
| <div class="callout-content"> | |
| <div class="callout-title">Feature Importance</div> | |
| <div class="callout-text"> | |
| Random Forest fournit automatiquement l'importance de chaque feature, | |
| ce qui aide a comprendre quelles variables influencent le plus les predictions. | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </section> | |
| <!-- Section 5: Neural Networks --> | |
| <section class="section" id="neuralnets"> | |
| <div class="section-header scroll-animate"> | |
| <div class="section-badge">Partie 5 · 35 min</div> | |
| <h2 class="section-title"> | |
| <small>Deep Learning</small> | |
| Reseaux de Neurones | |
| </h2> | |
| </div> | |
| <div class="section-content scroll-animate"> | |
| <p> | |
| Les <strong>reseaux de neurones</strong> sont inspires du cerveau humain : des couches de neurones | |
| interconnectes executent des transformations non-lineaires. Ils excellent pour les patterns complexes. | |
| </p> | |
| <h3 style="font-size: 1.2rem; font-weight: 600; color: var(--text-primary); margin: var(--space-xl) 0 var(--space-md);"> | |
| Fonctionnement : Forward + Backprop | |
| </h3> | |
| <div class="cards-grid scroll-animate"> | |
| <div class="info-card"> | |
| <div class="info-card-icon">F</div> | |
| <h4 class="info-card-title">Forward Pass</h4> | |
| <p class="info-card-text">Donnees traversent les couches : $\mathbf{h}_1 = \sigma(W_1 \mathbf{x} + b_1)$</p> | |
| </div> | |
| <div class="info-card"> | |
| <div class="info-card-icon">L</div> | |
| <h4 class="info-card-title">Loss Computation</h4> | |
| <p class="info-card-text">Compare prediction vs realite : $L = \frac{1}{m} \sum (y - \hat{y})^2$</p> | |
| </div> | |
| <div class="info-card"> | |
| <div class="info-card-icon">B</div> | |
| <h4 class="info-card-title">Backpropagation</h4> | |
| <p class="info-card-text">Calcule les gradients via la chaine de derivation</p> | |
| </div> | |
| <div class="info-card"> | |
| <div class="info-card-icon">G</div> | |
| <h4 class="info-card-title">Gradient Descent</h4> | |
| <p class="info-card-text">Met a jour les poids : $W \leftarrow W - \alpha \nabla_W L$</p> | |
| </div> | |
| </div> | |
| <h3 style="font-size: 1.2rem; font-weight: 600; color: var(--text-primary); margin: var(--space-xl) 0 var(--space-md);"> | |
| Fonctions d'activation | |
| </h3> | |
| <div class="metric-row scroll-animate"> | |
| <div class="metric-card"> | |
| <div class="metric-name">ReLU</div> | |
| <div class="metric-formula">$f(x) = \max(0, x)$</div> | |
| <div class="metric-desc">Couches cachees</div> | |
| </div> | |
| <div class="metric-card"> | |
| <div class="metric-name">Sigmoid</div> | |
| <div class="metric-formula">$f(x) = \frac{1}{1 + e^{-x}}$</div> | |
| <div class="metric-desc">Classification binaire</div> | |
| </div> | |
| <div class="metric-card"> | |
| <div class="metric-name">Softmax</div> | |
| <div class="metric-formula">$f(x_i) = \frac{e^{x_i}}{\sum_j e^{x_j}}$</div> | |
| <div class="metric-desc">Classification multi-classe</div> | |
| </div> | |
| </div> | |
| </div> | |
| </section> | |
| <!-- Section 6: LSTM --> | |
| <section class="section" id="lstm"> | |
| <div class="section-header scroll-animate"> | |
| <div class="section-badge">Partie 6 · 30 min</div> | |
| <h2 class="section-title"> | |
| <small>Series Temporelles</small> | |
| LSTM & Reseaux Recurrents | |
| </h2> | |
| </div> | |
| <div class="section-content scroll-animate"> | |
| <p> | |
| <strong>LSTM (Long Short-Term Memory)</strong> est un type de reseau neuronal pour series temporelles. | |
| Il peut "retenir" l'information sur de longues periodes — crucial pour les predictions temporelles. | |
| </p> | |
| <div class="callout callout-warning scroll-animate"> | |
| <div class="callout-icon">[!]</div> | |
| <div class="callout-content"> | |
| <div class="callout-title">Probleme des RNN vanilla</div> | |
| <div class="callout-text"> | |
| Les gradients disparaissent (vanishing) ou explosent (exploding) sur de longues sequences. | |
| Le LSTM resout ce probleme avec son <strong>cell state</strong>. | |
| </div> | |
| </div> | |
| </div> | |
| <h3 style="font-size: 1.2rem; font-weight: 600; color: var(--text-primary); margin: var(--space-xl) 0 var(--space-md);"> | |
| Les trois portes du LSTM | |
| </h3> | |
| <div class="metric-row scroll-animate"> | |
| <div class="metric-card"> | |
| <div class="metric-name">Forget Gate</div> | |
| <div class="metric-formula">$f_t = \sigma(W_f [h_{t-1}, x_t] + b_f)$</div> | |
| <div class="metric-desc">Quoi oublier ?</div> | |
| </div> | |
| <div class="metric-card"> | |
| <div class="metric-name">Input Gate</div> | |
| <div class="metric-formula">$i_t = \sigma(W_i [h_{t-1}, x_t] + b_i)$</div> | |
| <div class="metric-desc">Quoi ajouter ?</div> | |
| </div> | |
| <div class="metric-card"> | |
| <div class="metric-name">Output Gate</div> | |
| <div class="metric-formula">$o_t = \sigma(W_o [h_{t-1}, x_t] + b_o)$</div> | |
| <div class="metric-desc">Quoi exposer ?</div> | |
| </div> | |
| </div> | |
| <div class="callout callout-info scroll-animate"> | |
| <div class="callout-icon">[i]</div> | |
| <div class="callout-content"> | |
| <div class="callout-title">Cas d'usage</div> | |
| <div class="callout-text"> | |
| Prediction de prix boursiers, meteo, consommation energetique, | |
| traitement du langage naturel (NLP)... | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </section> | |
| <!-- Section 7: Metriques --> | |
| <section class="section" id="metrics"> | |
| <div class="section-header scroll-animate"> | |
| <div class="section-badge">Partie 7 · 25 min</div> | |
| <h2 class="section-title"> | |
| <small>Evaluation</small> | |
| Metriques de Performance | |
| </h2> | |
| </div> | |
| <div class="section-content scroll-animate"> | |
| <p> | |
| Evaluer correctement un modele est crucial. Les bonnes metriques dependent du type de probleme | |
| (regression vs classification) et des objectifs metier. | |
| </p> | |
| <h3 style="font-size: 1.2rem; font-weight: 600; color: var(--text-primary); margin: var(--space-xl) 0 var(--space-md);"> | |
| Regression | |
| </h3> | |
| <div class="metric-row scroll-animate"> | |
| <div class="metric-card"> | |
| <div class="metric-name">MAE</div> | |
| <div class="metric-formula">$\frac{1}{n}\sum|y_i - \hat{y}_i|$</div> | |
| <div class="metric-desc">Robuste aux outliers</div> | |
| </div> | |
| <div class="metric-card"> | |
| <div class="metric-name">RMSE</div> | |
| <div class="metric-formula">$\sqrt{\frac{1}{n}\sum(y_i - \hat{y}_i)^2}$</div> | |
| <div class="metric-desc">Penalise les grandes erreurs</div> | |
| </div> | |
| <div class="metric-card"> | |
| <div class="metric-name">R2</div> | |
| <div class="metric-formula">$1 - \frac{SS_{res}}{SS_{tot}}$</div> | |
| <div class="metric-desc">% variance expliquee</div> | |
| </div> | |
| </div> | |
| <h3 style="font-size: 1.2rem; font-weight: 600; color: var(--text-primary); margin: var(--space-xl) 0 var(--space-md);"> | |
| Classification | |
| </h3> | |
| <div class="table-container scroll-animate"> | |
| <table> | |
| <thead> | |
| <tr> | |
| <th>Metrique</th> | |
| <th>Formule</th> | |
| <th>Usage</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <tr> | |
| <td><strong>Accuracy</strong></td> | |
| <td>$(TP + TN) / Total$</td> | |
| <td>Classes equilibrees</td> | |
| </tr> | |
| <tr> | |
| <td><strong>Precision</strong></td> | |
| <td>$TP / (TP + FP)$</td> | |
| <td>Minimiser faux positifs</td> | |
| </tr> | |
| <tr> | |
| <td><strong>Recall</strong></td> | |
| <td>$TP / (TP + FN)$</td> | |
| <td>Minimiser faux negatifs</td> | |
| </tr> | |
| <tr> | |
| <td><strong>F1-Score</strong></td> | |
| <td>$2 \cdot \frac{P \cdot R}{P + R}$</td> | |
| <td>Classes desequilibrees</td> | |
| </tr> | |
| </tbody> | |
| </table> | |
| </div> | |
| </div> | |
| </section> | |
| <!-- Section 8: Optimisation --> | |
| <section class="section" id="optimization"> | |
| <div class="section-header scroll-animate"> | |
| <div class="section-badge">Partie 8 · 20 min</div> | |
| <h2 class="section-title"> | |
| <small>Amelioration</small> | |
| Optimisation & Regularisation | |
| </h2> | |
| </div> | |
| <div class="section-content scroll-animate"> | |
| <p> | |
| Pour eviter le <strong>surapprentissage (overfitting)</strong> et ameliorer la generalisation, | |
| plusieurs techniques existent. | |
| </p> | |
| <div class="cards-grid scroll-animate"> | |
| <div class="info-card"> | |
| <div class="info-card-icon">D</div> | |
| <h4 class="info-card-title">Dropout</h4> | |
| <p class="info-card-text">Desactive aleatoirement des neurones pendant l'entrainement.</p> | |
| </div> | |
| <div class="info-card"> | |
| <div class="info-card-icon">E</div> | |
| <h4 class="info-card-title">Early Stopping</h4> | |
| <p class="info-card-text">Arrete l'entrainement quand la validation stagne.</p> | |
| </div> | |
| <div class="info-card"> | |
| <div class="info-card-icon">L</div> | |
| <h4 class="info-card-title">L2 Regularization</h4> | |
| <p class="info-card-text">Penalise les grands poids : $L_{total} = L_{data} + \lambda \sum w^2$</p> | |
| </div> | |
| <div class="info-card"> | |
| <div class="info-card-icon">C</div> | |
| <h4 class="info-card-title">Cross-Validation</h4> | |
| <p class="info-card-text">K-fold pour une evaluation plus robuste.</p> | |
| </div> | |
| </div> | |
| <div class="callout callout-tip scroll-animate"> | |
| <div class="callout-icon">[*]</div> | |
| <div class="callout-content"> | |
| <div class="callout-title">Regle d'or</div> | |
| <div class="callout-text"> | |
| Toujours comparer les metriques sur <strong>train</strong> ET <strong>test</strong>. | |
| Un grand ecart = overfitting. Objectif : R2 train ≈ R2 test. | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </section> | |
| <!-- Author Footer --> | |
| <footer class="author-footer" style="margin-top: var(--space-3xl);"> | |
| <div class="author-info"> | |
| <a href="mailto:imadmaalouf02@gmail.com" class="author-link"> | |
| <svg viewBox="0 0 24 24"><path d="M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"/></svg> | |
| imadmaalouf02@gmail.com | |
| </a> | |
| <a href="https://github.com/imadmaalouf02" target="_blank" class="author-link"> | |
| <svg viewBox="0 0 24 24"><path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/></svg> | |
| GitHub | |
| </a> | |
| <a href="https://huggingface.co/spaces/MAALOOUF/ML_Training" target="_blank" class="author-link"> | |
| <svg viewBox="0 0 24 24"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"/></svg> | |
| Hugging Face Space | |
| </a> | |
| </div> | |
| </footer> | |
| <!-- Footer --> | |
| <footer class="footer" style="margin-top: 0;"> | |
| <p class="footer-text"> | |
| ML Academy — Cours de Machine Learning — | |
| <span class="footer-brand">GE-MCI 4A</span> — 2025/2026 | |
| </p> | |
| <p class="footer-text" style="margin-top: var(--space-sm); font-size: 0.75rem; color: var(--text-muted);"> | |
| Formateur : Imad Maalouf | |
| </p> | |
| </footer> | |
| </main> | |
| </div> | |
| <!-- Back to Top --> | |
| <button class="back-to-top" id="backToTop" onclick="scrollToTop()">^</button> | |
| <!-- Scripts --> | |
| <script src="js/shared.js"></script> | |
| <script> | |
| // Scroll animations | |
| const observerOptions = { | |
| threshold: 0.1, | |
| rootMargin: '0px 0px -50px 0px' | |
| }; | |
| const observer = new IntersectionObserver((entries) => { | |
| entries.forEach(entry => { | |
| if (entry.isIntersecting) { | |
| entry.target.classList.add('visible'); | |
| } | |
| }); | |
| }, observerOptions); | |
| document.querySelectorAll('.scroll-animate').forEach(el => { | |
| observer.observe(el); | |
| }); | |
| // Active nav item on scroll | |
| const sections = document.querySelectorAll('.section'); | |
| const navItems = document.querySelectorAll('.nav-item'); | |
| window.addEventListener('scroll', () => { | |
| let current = ''; | |
| sections.forEach(section => { | |
| const sectionTop = section.offsetTop; | |
| const sectionHeight = section.clientHeight; | |
| if (scrollY >= sectionTop - 200) { | |
| current = section.getAttribute('id'); | |
| } | |
| }); | |
| navItems.forEach(item => { | |
| item.classList.remove('active'); | |
| if (item.getAttribute('href') === `#${current}`) { | |
| item.classList.add('active'); | |
| } | |
| }); | |
| // Update progress | |
| const progress = Math.min(100, Math.round((scrollY / (document.body.scrollHeight - window.innerHeight)) * 100)); | |
| document.getElementById('progress-fill').style.width = `${progress}%`; | |
| document.getElementById('progress-text').textContent = `${progress}%`; | |
| // Back to top button | |
| const backToTop = document.getElementById('backToTop'); | |
| if (scrollY > 500) { | |
| backToTop.classList.add('visible'); | |
| } else { | |
| backToTop.classList.remove('visible'); | |
| } | |
| }); | |
| function scrollToTop() { | |
| window.scrollTo({ top: 0, behavior: 'smooth' }); | |
| } | |
| </script> | |
| </body> | |
| </html> | |