हिंदी में: आर्टिफ़िशियल इंटेलिजेंस और मशीन लर्निंग की आसान शुरुआत — कंप्यूटर डेटा से कैसे सीखता है।
AI, ML and deep learning
- Artificial Intelligence (AI) – the broad field of making machines perform tasks that normally need human intelligence: reasoning, understanding language, recognising images, planning.
- Machine Learning (ML) – a part of AI in which systems learn patterns from data instead of following only hand-written rules.
- Deep Learning (DL) – a part of ML that uses multi-layer neural networks; it powers modern speech recognition, image recognition and large language models.
Types of machine learning
| Type | Learns from | Example tasks |
|---|---|---|
| Supervised | Labelled data (input + correct answer) | Spam detection, house-price prediction |
| Unsupervised | Unlabelled data | Customer grouping, anomaly detection |
| Reinforcement | Rewards and penalties from an environment | Game playing, robot control |
Supervised problems are either classification (predict a category) or regression (predict a number).
Common algorithms
- Linear regression – fits a straight line to predict a numeric value.
- Logistic regression – predicts the probability of a class.
- k-Nearest Neighbours (k-NN) – classifies by the majority of the k closest examples.
- Decision trees and random forests – learn if–then rules; forests combine many trees.
- Support Vector Machines (SVM) – find the boundary with the widest margin between classes.
- Naive Bayes – applies Bayes’ theorem; fast for text classification.
- k-Means clustering – groups data into k clusters.
- PCA – reduces the number of features while keeping most of the variation.
The machine learning workflow
- Define the problem and collect data.
- Clean the data (missing values, duplicates, outliers).
- Engineer and scale features.
- Split into training, validation and test sets.
- Train a model, then tune its hyperparameters.
- Evaluate on the test set.
- Deploy and monitor; retrain when the data changes.
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier
X, y = load_iris(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
model = DecisionTreeClassifier().fit(X_train, y_train)
print("Accuracy:", model.score(X_test, y_test))
Overfitting and underfitting
- Overfitting – the model memorises the training data and performs poorly on new data. Fix with more data, simpler models, regularization, dropout or cross-validation.
- Underfitting – the model is too simple to capture the pattern. Fix with better features or a more powerful model. This trade-off is called the bias–variance trade-off.
Evaluation metrics
| Metric | Meaning |
|---|---|
| Accuracy | Correct predictions ÷ all predictions |
| Precision | Of the predicted positives, how many were truly positive |
| Recall | Of the actual positives, how many were found |
| F1-score | Harmonic mean of precision and recall |
| MAE / RMSE | Average error for regression |
Accuracy can mislead on imbalanced data (e.g. rare diseases), so precision, recall and F1 matter.
Neural networks in brief
A neural network has an input layer, one or more hidden layers and an output layer. Each neuron computes a weighted sum and applies an activation function (ReLU, sigmoid, softmax). Networks learn by backpropagation and gradient descent, adjusting weights to reduce a loss function.
- CNNs – images and video.
- RNNs / LSTMs – sequences (older approach for text and time series).
- Transformers – the architecture behind modern language models; they use attention to relate every word to every other word.
Tools to learn
Python, NumPy, pandas, Matplotlib, scikit-learn, and a deep learning framework such as PyTorch or TensorFlow. Jupyter notebooks or Google Colab are convenient for practice.
Responsible AI
Models can inherit bias from data, make confident mistakes and raise privacy concerns. Good practice includes representative data, testing for fairness, explaining decisions where possible, protecting personal data and keeping a human in the loop for important decisions.
Quick revision
- AI ⊃ ML ⊃ Deep learning.
- Supervised = labelled data; unsupervised = unlabelled; reinforcement = rewards.
- Overfitting = great on training data, poor on new data.
- F1 balances precision and recall.