AI — Machine Learning
What is ML?
Machine Learning is the ability to learn from data without being explicitly programmed.
ML Types
| Type | Description | Example |
|---|---|---|
| Supervised | Labeled data | Classification |
| Unsupervised | No labels | Clustering |
| Reinforcement | Rewards | Game AI |
Supervised Learning
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score
# Split data
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
# Train
model = RandomForestClassifier()
model.fit(X_train, y_train)
# Predict
predictions = model.predict(X_test)
# Evaluate
accuracy = accuracy_score(y_test, predictions)
print(f"Accuracy: {accuracy}")
Common Algorithms
| Algorithm | Use Case |
|---|---|
| Linear Regression | Regression |
| Logistic Regression | Classification |
| Decision Trees | Both |
| Random Forest | Both |
| SVM | Classification |
| K-Means | Clustering |
Mini Practice
- Understand ML concepts
- Train supervised model
- Evaluate model performance
- Try different algorithms
Up Next
Continue with Deep Learning — deep learning.
Related Topics
Frequently Asked Questions about Machine Learning
What is Machine Learning in AI?
Machine Learning is a fundamental concept in AI. This lesson explains it step by step with clear examples, making it easy for beginners to understand.
How do I learn Machine Learning?
Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Machine Learning.
Why is Machine Learning important in AI?
Machine Learning is essential for AI development. Understanding this concept will help you write better code and solve real-world problems more effectively.