</>
Skip to content
AI lessons (9/37)

AI — Machine Learning

What is ML?

Machine Learning is the ability to learn from data without being explicitly programmed.

ML Types

TypeDescriptionExample
SupervisedLabeled dataClassification
UnsupervisedNo labelsClustering
ReinforcementRewardsGame 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

AlgorithmUse Case
Linear RegressionRegression
Logistic RegressionClassification
Decision TreesBoth
Random ForestBoth
SVMClassification
K-MeansClustering

Mini Practice

  1. Understand ML concepts
  2. Train supervised model
  3. Evaluate model performance
  4. 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.