Skip to content
Home Tutorials Roadmaps Courses
Log in Join free
Tutorials Computer Science Introduction to AI & ML
Computer Science Beginner FREE

Introduction to AI & ML

Lesson 1 of 17 Beginner Interactive

Artificial Intelligence and Machine Learning are transforming every industry.

Key Concepts

  • AI — machines mimicking intelligence
  • ML — learning from data
  • Deep Learning — neural networks
  • NLP — natural language processing

Syntax

COMPUTER-SCIENCE
# Machine Learning Pipeline
Data → Preprocessing → Model → Training → Evaluation → Deployment

# Types
Supervised: labeled data (classification, regression)
Unsupervised: no labels (clustering, dimensionality reduction)
Reinforcement: reward-based learning
K-Means Clustering Concept
PYTHON
import random

# Simple K-Means concept
def kmeans_step(points, centroids):
    clusters = [[] for _ in centroids]

    for point in points:
        distances = [abs(point - c) for c in centroids]
        closest = distances.index(min(distances))
        clusters[closest].append(point)

    new_centroids = [
        sum(c) / len(c) if c else 0
        for c in clusters
    ]
    return clusters, new_centroids

points = [1, 2, 3, 10, 11, 12, 20, 21]
centroids = [2, 11]

clusters, new_c = kmeans_step(points, centroids)
print(f"Clusters: {clusters}")
print(f"New centroids: {[f'{c:.1f}' for c in new_c]}")

Practice

1
Exercise

What is the difference between AI and ML?

Answer
AI is the broader concept of intelligent machines. ML is a subset where systems learn from data without explicit programming.

Quick Quiz

1

What is supervised learning?

Supervised learning uses labeled data to train models.

Interview Questions

When a model performs well on training data but poorly on new data. It memorizes noise instead of learning patterns.