14 KiB
Probleemoplossingsgids
Deze gids helpt je bij het oplossen van veelvoorkomende problemen bij het werken met het curriculum Machine Learning voor Beginners. Als je hier geen oplossing vindt, kijk dan op onze Discord Discussies of open een issue.
Inhoudsopgave
- Installatieproblemen
- Jupyter Notebook Problemen
- Python Pakket Problemen
- R Omgevingsproblemen
- Quiz Applicatie Problemen
- Data- en Bestandspadproblemen
- Veelvoorkomende Foutmeldingen
- Prestatieproblemen
- Omgeving en Configuratie
Installatieproblemen
Python Installatie
Probleem: python: command not found
Oplossing:
- Installeer Python 3.8 of hoger via python.org
- Controleer de installatie:
python --versionofpython3 --version - Op macOS/Linux moet je mogelijk
python3gebruiken in plaats vanpython
Probleem: Meerdere Python-versies veroorzaken conflicten
Oplossing:
# Use virtual environments to isolate projects
python -m venv ml-env
# Activate virtual environment
# On Windows:
ml-env\Scripts\activate
# On macOS/Linux:
source ml-env/bin/activate
Jupyter Installatie
Probleem: jupyter: command not found
Oplossing:
# Install Jupyter
pip install jupyter
# Or with pip3
pip3 install jupyter
# Verify installation
jupyter --version
Probleem: Jupyter opent niet in de browser
Oplossing:
# Try specifying the browser
jupyter notebook --browser=chrome
# Or copy the URL with token from terminal and paste in browser manually
# Look for: http://localhost:8888/?token=...
R Installatie
Probleem: R-pakketten worden niet geïnstalleerd
Oplossing:
# Ensure you have the latest R version
# Install packages with dependencies
install.packages(c("tidyverse", "tidymodels", "caret"), dependencies = TRUE)
# If compilation fails, try installing binary versions
install.packages("package-name", type = "binary")
Probleem: IRkernel niet beschikbaar in Jupyter
Oplossing:
# In R console
install.packages('IRkernel')
IRkernel::installspec(user = TRUE)
Jupyter Notebook Problemen
Kernel Problemen
Probleem: Kernel blijft crashen of opnieuw starten
Oplossing:
- Herstart de kernel:
Kernel → Restart - Wis output en herstart:
Kernel → Restart & Clear Output - Controleer op geheugenproblemen (zie Prestatieproblemen)
- Voer cellen afzonderlijk uit om problematische code te identificeren
Probleem: Verkeerde Python-kernel geselecteerd
Oplossing:
- Controleer de huidige kernel:
Kernel → Change Kernel - Selecteer de juiste Python-versie
- Als de kernel ontbreekt, maak deze aan:
python -m ipykernel install --user --name=ml-env
Probleem: Kernel start niet
Oplossing:
# Reinstall ipykernel
pip uninstall ipykernel
pip install ipykernel
# Register the kernel again
python -m ipykernel install --user
Notebook Celproblemen
Probleem: Cellen worden uitgevoerd maar tonen geen output
Oplossing:
- Controleer of de cel nog wordt uitgevoerd (zoek naar de
[*]indicator) - Herstart de kernel en voer alle cellen uit:
Kernel → Restart & Run All - Controleer de browserconsole op JavaScript-fouten (F12)
Probleem: Kan cellen niet uitvoeren - geen reactie bij klikken op "Run"
Oplossing:
- Controleer of de Jupyter-server nog actief is in de terminal
- Vernieuw de browserpagina
- Sluit en heropen het notebook
- Herstart de Jupyter-server
Python Pakket Problemen
Importfouten
Probleem: ModuleNotFoundError: No module named 'sklearn'
Oplossing:
pip install scikit-learn
# Common ML packages for this course
pip install scikit-learn pandas numpy matplotlib seaborn
Probleem: ImportError: cannot import name 'X' from 'sklearn'
Oplossing:
# Update scikit-learn to latest version
pip install --upgrade scikit-learn
# Check version
python -c "import sklearn; print(sklearn.__version__)"
Versieconflicten
Probleem: Pakketversie incompatibiliteitsfouten
Oplossing:
# Create a new virtual environment
python -m venv fresh-env
source fresh-env/bin/activate # or fresh-env\Scripts\activate on Windows
# Install packages fresh
pip install jupyter scikit-learn pandas numpy matplotlib seaborn
# If specific version needed
pip install scikit-learn==1.3.0
Probleem: pip install mislukt met permissiefouten
Oplossing:
# Install for current user only
pip install --user package-name
# Or use virtual environment (recommended)
python -m venv venv
source venv/bin/activate
pip install package-name
Data Laadproblemen
Probleem: FileNotFoundError bij het laden van CSV-bestanden
Oplossing:
import os
# Check current working directory
print(os.getcwd())
# Use relative paths from notebook location
df = pd.read_csv('../../data/filename.csv')
# Or use absolute paths
df = pd.read_csv('/full/path/to/data/filename.csv')
R Omgevingsproblemen
Pakketinstallatie
Probleem: Pakketinstallatie mislukt met compilatiefouten
Oplossing:
# Install binary version (Windows/macOS)
install.packages("package-name", type = "binary")
# Update R to latest version if packages require it
# Check R version
R.version.string
# Install system dependencies (Linux)
# For Ubuntu/Debian, in terminal:
# sudo apt-get install r-base-dev
Probleem: tidyverse wordt niet geïnstalleerd
Oplossing:
# Install dependencies first
install.packages(c("rlang", "vctrs", "pillar"))
# Then install tidyverse
install.packages("tidyverse")
# Or install components individually
install.packages(c("dplyr", "ggplot2", "tidyr", "readr"))
RMarkdown Problemen
Probleem: RMarkdown wordt niet gerenderd
Oplossing:
# Install/update rmarkdown
install.packages("rmarkdown")
# Install pandoc if needed
install.packages("pandoc")
# For PDF output, install tinytex
install.packages("tinytex")
tinytex::install_tinytex()
Quiz Applicatie Problemen
Build en Installatie
Probleem: npm install mislukt
Oplossing:
# Clear npm cache
npm cache clean --force
# Remove node_modules and package-lock.json
rm -rf node_modules package-lock.json
# Reinstall
npm install
# If still fails, try with legacy peer deps
npm install --legacy-peer-deps
Probleem: Poort 8080 is al in gebruik
Oplossing:
# Use different port
npm run serve -- --port 8081
# Or find and kill process using port 8080
# On Linux/macOS:
lsof -ti:8080 | xargs kill -9
# On Windows:
netstat -ano | findstr :8080
taskkill /PID <PID> /F
Build Fouten
Probleem: npm run build mislukt
Oplossing:
# Check Node.js version (should be 14+)
node --version
# Update Node.js if needed
# Then clean install
rm -rf node_modules package-lock.json
npm install
npm run build
Probleem: Linting fouten verhinderen build
Oplossing:
# Fix auto-fixable issues
npm run lint -- --fix
# Or temporarily disable linting in build
# (not recommended for production)
Data- en Bestandspadproblemen
Padproblemen
Probleem: Data-bestanden niet gevonden bij het uitvoeren van notebooks
Oplossing:
-
Voer notebooks altijd uit vanuit hun eigen map
cd /path/to/lesson/folder jupyter notebook -
Controleer relatieve paden in de code
# Correct path from notebook location df = pd.read_csv('../data/filename.csv') # Not from your terminal location -
Gebruik absolute paden indien nodig
import os base_path = os.path.dirname(os.path.abspath(__file__)) data_path = os.path.join(base_path, 'data', 'filename.csv')
Ontbrekende Data-bestanden
Probleem: Dataset-bestanden ontbreken
Oplossing:
- Controleer of de data in de repository moet staan - de meeste datasets zijn inbegrepen
- Sommige lessen vereisen het downloaden van data - controleer de README van de les
- Zorg ervoor dat je de laatste wijzigingen hebt opgehaald:
git pull origin main
Veelvoorkomende Foutmeldingen
Geheugenfouten
Fout: MemoryError of kernel crasht bij het verwerken van data
Oplossing:
# Load data in chunks
for chunk in pd.read_csv('large_file.csv', chunksize=10000):
process(chunk)
# Or read only needed columns
df = pd.read_csv('file.csv', usecols=['col1', 'col2'])
# Free memory when done
del large_dataframe
import gc
gc.collect()
Convergentie Waarschuwingen
Waarschuwing: ConvergenceWarning: Maximum number of iterations reached
Oplossing:
from sklearn.linear_model import LogisticRegression
# Increase max iterations
model = LogisticRegression(max_iter=1000)
# Or scale your features first
from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
X_scaled = scaler.fit_transform(X)
Plotproblemen
Probleem: Plots worden niet weergegeven in Jupyter
Oplossing:
# Enable inline plotting
%matplotlib inline
# Import pyplot
import matplotlib.pyplot as plt
# Show plot explicitly
plt.plot(data)
plt.show()
Probleem: Seaborn-plots zien er anders uit of geven fouten
Oplossing:
import warnings
warnings.filterwarnings('ignore', category=UserWarning)
# Update to compatible version
# pip install --upgrade seaborn matplotlib
Unicode/Encoding Fouten
Probleem: UnicodeDecodeError bij het lezen van bestanden
Oplossing:
# Specify encoding explicitly
df = pd.read_csv('file.csv', encoding='utf-8')
# Or try different encoding
df = pd.read_csv('file.csv', encoding='latin-1')
# For errors='ignore' to skip problematic characters
df = pd.read_csv('file.csv', encoding='utf-8', errors='ignore')
Prestatieproblemen
Langzame Notebook Uitvoering
Probleem: Notebooks zijn erg traag om uit te voeren
Oplossing:
- Herstart kernel om geheugen vrij te maken:
Kernel → Restart - Sluit ongebruikte notebooks om bronnen vrij te maken
- Gebruik kleinere datasamples voor testen:
# Work with subset during development df_sample = df.sample(n=1000) - Profiel je code om knelpunten te vinden:
%time operation() # Time single operation %timeit operation() # Time with multiple runs
Hoog Geheugenverbruik
Probleem: Systeem raakt geheugen kwijt
Oplossing:
# Check memory usage
df.info(memory_usage='deep')
# Optimize data types
df['column'] = df['column'].astype('int32') # Instead of int64
# Drop unnecessary columns
df = df[['col1', 'col2']] # Keep only needed columns
# Process in batches
for batch in np.array_split(df, 10):
process(batch)
Omgeving en Configuratie
Virtuele Omgevingsproblemen
Probleem: Virtuele omgeving wordt niet geactiveerd
Oplossing:
# Windows
python -m venv venv
venv\Scripts\activate.bat
# macOS/Linux
python3 -m venv venv
source venv/bin/activate
# Check if activated (should show venv name in prompt)
which python # Should point to venv python
Probleem: Pakketten geïnstalleerd maar niet gevonden in notebook
Oplossing:
# Ensure notebook uses the correct kernel
# Install ipykernel in your venv
pip install ipykernel
python -m ipykernel install --user --name=ml-env --display-name="Python (ml-env)"
# In Jupyter: Kernel → Change Kernel → Python (ml-env)
Git Problemen
Probleem: Kan laatste wijzigingen niet ophalen - merge conflicten
Oplossing:
# Stash your changes
git stash
# Pull latest
git pull origin main
# Reapply your changes
git stash pop
# If conflicts, resolve manually or:
git checkout --theirs path/to/file # Take remote version
git checkout --ours path/to/file # Keep your version
VS Code Integratie
Probleem: Jupyter notebooks openen niet in VS Code
Oplossing:
- Installeer de Python-extensie in VS Code
- Installeer de Jupyter-extensie in VS Code
- Selecteer de juiste Python-interpreter:
Ctrl+Shift+P→ "Python: Select Interpreter" - Herstart VS Code
Aanvullende Bronnen
- Discord Discussies: Stel vragen en deel oplossingen in het #ml-for-beginners kanaal
- Microsoft Learn: ML voor Beginners modules
- Videotutorials: YouTube Playlist
- Issue Tracker: Meld bugs
Nog steeds problemen?
Als je de bovenstaande oplossingen hebt geprobeerd en nog steeds problemen ondervindt:
- Zoek bestaande issues: GitHub Issues
- Controleer discussies op Discord: Discord Discussies
- Open een nieuw issue: Voeg het volgende toe:
- Je besturingssysteem en versie
- Python/R versie
- Foutmelding (volledige traceback)
- Stappen om het probleem te reproduceren
- Wat je al hebt geprobeerd
We staan klaar om te helpen! 🚀
Disclaimer:
Dit document is vertaald met behulp van de AI-vertalingsservice Co-op Translator. Hoewel we streven naar nauwkeurigheid, dient u zich ervan bewust te zijn dat geautomatiseerde vertalingen fouten of onnauwkeurigheden kunnen bevatten. Het originele document in de oorspronkelijke taal moet worden beschouwd als de gezaghebbende bron. Voor kritieke informatie wordt professionele menselijke vertaling aanbevolen. Wij zijn niet aansprakelijk voor misverstanden of verkeerde interpretaties die voortvloeien uit het gebruik van deze vertaling.