# AI, ML & learning paradigms

Code With Purpose · Hinglish · Free starter lesson

## Concept

Artificial intelligence ek broad field hai jahan systems intelligence se jude tasks karte hain. Machine learning data se patterns seekhta hai. Deep learning ML ka ek family hai jisme multilayer neural networks use hote hain. Rule-based program bhi AI ka part ho sakta hai bina data se learn kiye.

Supervised learning labeled examples use karta hai: known spam labels ya house features ke saath prices. Unsupervised learning target labels ke bina structure explore karta hai, jaise similar observations ke clusters. Reinforcement learning environment se interact karke aur time ke saath rewards se policy seekhta hai.

Generative models text ya images jaise content banate hain. Categories overlap karti hain: generative model deep learning aur multiple training stages use kar sakta hai. Neeche ka code rule-based router ka illustration hai, trained classifier nahi. Jo cases rules cover nahi karte, woh miss ho sakte hain.

## Example

```python
def route_message(text):
    text = text.lower()
    if "invoice" in text:
        return "billing"
    if "password" in text:
        return "account support"
    return "manual review"

print(route_message("Where is my invoice?"))
print(route_message("Hello there"))
```

## Expected output

```text
billing
manual review
```

## Exercise

Categorize karo: labeled churn predict karna, bina labels articles group karna, aur rewards se game policy seekhna. Router ki ek limitation bhi batao.

## Suggested solution

```
# Labeled churn: supervised learning.
# Grouping unlabeled articles: unsupervised learning.
# Game policy learned from rewards: reinforcement learning.
# Limitation: "I cannot log in" has no password keyword and goes to manual review.
# A message containing both keywords takes the first matching branch.
```

## Takeaway

Method task aur available feedback ke hisaab se choose karo.

Reference: https://developers.google.com/machine-learning/intro-to-ml

https://codewithpurposeai.in/lesson-ai-foundations.html?lang=hinglish
