Learning Objectives
By the end of this chapter, you will be able to:
- Relate AI, data science, machine learning, and deep learning in one map.
- Describe the seven stages of a data science project in order.
- Distinguish supervised, unsupervised, and reinforcement learning by data and goal.
- Explain training, test split, accuracy, and overfitting at manager level.
- Sketch a neural network and name input, hidden, and output layers.
- Evaluate business uses and risks before proposing a model.
Detail: AI and impact, cloud and virtual, big data and blockchain.
A map before the details
Students mix these terms. Hold one picture.
flowchart TB
AI[AI: goal, machines doing intelligent tasks]
AI --> ML[Machine Learning: learn patterns from data]
ML --> DL[Deep Learning: many layered neural networks]
DS[Data Science: process that uses ML] -. uses .-> ML
- AI is the aim.
- Machine learning is a method to reach that aim. The machine learns rules from examples.
- Deep learning is a family of machine learning using neural networks with many layers.
- Data science is the end to end process that frames a business question, prepares data, builds models including ML, and delivers decisions.
A manager does not need to code a network. A manager needs to know which method fits which question and what it costs when data is poor.
Grouped framework: three kinds of learning
Do not recite definitions. Ask: what does the teacher give the machine.
| Group | What the data contains | Goal | Business question it answers | Example |
|---|---|---|---|---|
| A. Supervised: learn from labeled pairs | Inputs plus correct answers | Predict label or number for new cases | Will this borrower default | Credit scoring on 10,000 labeled loans |
| B. Unsupervised: find structure without labels | Inputs only, no right answer | Discover natural groups or patterns | Which customers behave alike | Segmentation of shoppers by basket similarity |
| C. Reinforcement: learn by reward | State, action, reward signal | Choose actions that maximize reward | What price earns most rides without losing drivers | Dynamic pricing that tests small changes and learns |
Within supervised, two tasks matter for exams:
- Classification predicts a category: fraud or not, churn or stay.
- Regression predicts a number: sales next month, rent per square foot in Patan.
Traditional code: people write rules, machine applies them.
Machine learning: people provide examples, machine writes rules as weights.
This reversal explains benefits and risks. Benefits grow with good examples. Risks grow when examples carry bias or gaps.
Data science as a process: seven stages
Data science succeeds as a sequence, not a single model.
- Define the question. Which customers will leave next month. What is a churn.
- Collect data. CRM, POS, app logs, surveys, external records. Check permission and Electronic Transactions Act.
- Clean and prepare. Fix errors, duplicates, missing values. Often more than half the effort. A ledger typed with Devanagari numerals in two formats must be standardized before any model helps.
- Explore. Charts and statistics. Look at distribution, trends, and outliers.
- Build a model. Often a machine learning model from Group A, B, or C.
- Evaluate. Test on data the model has not seen. Check accuracy and error types.
- Communicate and deploy. Dashboard, report, or embedded score that a manager can act on.
Tools: SQL and Excel for tables, Python and R for modeling, Power BI and Tableau for visual story. The tool matters less than stage discipline.
Training, testing, and accuracy
Split historical data into training set to learn and test set to verify. Never report accuracy on training data. It flatters.
Worked definition: a bank uses 8,000 loans to train and 2,000 different loans to test. On the test set it predicts correctly for 1,800. Accuracy = 1,800 divided by 2,000 = 90 percent. A better manager asks: which 200 were wrong. Approving a defaulter costs more than rejecting a good applicant. Accuracy alone hides that price.
Overfitting is memorization without understanding. The student who memorizes last year paper fails this year. A regularized or simpler model, or more varied data, often generalizes better.
Neural networks and deep learning: layered learning
An artificial neural network copies a loose idea from biology. Many small units called neurons perform simple math and pass results forward.
- Input layer receives features. Pixel values. Income, debt, tenure.
- Hidden layers combine inputs with weights, apply a non linear function, and extract patterns. One layer finds edges. Next finds shapes. Next finds a face.
- Output layer emits the answer. A label, a probability, a number.
Deep learning means many hidden layers. Depth lets the model learn complex perceptual patterns that a single rule cannot capture.
flowchart LR
I1[Income] --> H1((Hidden unit))
I2[Credit history] --> H1
I3[Tenure months] --> H2((Hidden unit))
I1 --> H2
I2 --> H2
I3 --> H1
H1 --> O[Default probability]
H2 --> O
Each connection carries a weight. Training adjusts weights to shrink error on the training set. Testing checks whether that learning helps on new data. Depth improves vision, speech, and language tasks because these tasks need hierarchical features.
| Application | Why deep learning fits |
|---|---|
| Face login, defect inspection, number plate | Images have layered structure |
| Voice search, call transcription, translation | Speech and text have sequential context |
| Chatbot and generative writing | Language needs long range patterns |
Self-check
Business uses grouped by outcome
| Outcome | Use case | What changes |
|---|---|---|
| Keep revenue | Churn prediction, fraud flagging | Intervention before loss, faster hold on a card |
| Sell smarter | Recommendation, dynamic pricing, demand forecast | Higher basket, less stock out |
| Run lean | Predictive maintenance, resume matching | Fewer breakdowns, faster shortlisting |
| Serve faster | Chatbot, document classification | Answers at midnight without adding a shift |
In Nepal, banks and wallets score and flag in near real time, telecoms segment packs by usage, retailers recommend from browsing, and clinics triage messages. Common ground: enough labeled transactions plus a daily workflow that can act on the score.
Limits and risks: six checks before you trust a model
- Data quality. Poor data yields convincing nonsense. Garbage in, polished garbage out.
- Bias and fairness. Past decisions become future rules unless audited by gender, caste, province, and income source.
- Explainability. Deep models are often black boxes. A customer denied credit needs a reason a human can state.
- Privacy. Large data sets contain personal data. Minimization and retention limits are not optional.
- Drift. A model trained in 2019 behaves differently after a pandemic. Monitor and retrain.
- Cost and skill. Data engineering, labeling, and compute cost real money before any saving appears.
Nepal worked example: churn model for a telecom in Bagmati (NPR, BS 2081)
A regional telecom in Hetauda serves 80,000 prepaid users. On 2081-08-10 monthly churn is 3.1 percent, about 2,480 users. Acquisition cost is NPR 900 per user to replace churned ones. Monthly loss from churn alone is 2,480 x 900 = NPR 2,232,000 in replacement effort, plus lost top up.
The data team defines churn as no recharge for 35 days. It cleans CDR, recharge, and complaint logs. Out of 80,000, it trains on 60,000 records and tests on 20,000 unseen records. The model flags high risk users with 82 percent accuracy on the test set and precision of 74 percent on the predicted churn group.
Costs for a pilot:
- Data cleaning and labeling: NPR 180,000 one time
- Model build and dashboard: NPR 220,000 one time
- Retention offer to flagged users: NPR 150 per kept user
In test month, the model flags 4,200 users. With a targeted NPR 150 top up bonus and a check call, 31 percent of flagged users stay who would have left. Retained users = 4,200 x 0.31 = 1,302. Cost of offers = 4,200 x 150 = NPR 630,000. Value of retained users at replacement cost = 1,302 x 900 = NPR 1,171,800. Net monthly gain = 1,171,800 - 630,000 = NPR 541,800, before allocating one time build cost.
The lesson is process, not magic. Definitions decide what churn means. Cleaning decides accuracy. The offer and follow up decide whether the prediction becomes value. Without stages 1 to 4, stage 5 is noise.
Example 1: In a cooperative or bank branch, Group A supervised classification decides. Ask: on 2081-08-12 can a model trained on 8,000 labeled loans score new applications in under one minute, and can the branch manager explain a rejection in plain Nepali with two reasons plus an appeal path. Score without explanation fails member trust.
Example 2: In a operations or retail team, Group B unsupervised and Group C reinforcement decide. Ask: can segmentation of 40,000 transactions find a high basket segment that responds to a Dashain bundle, and can a small price test with reward feedback lift margin without killing volume. Discover, then test by reward.
Summary
Data science turns a business question into cleaned data, exploration, a suitable learning model, and a deployed decision. Supervised methods predict with labels, unsupervised discover groups without labels, reinforcement learns by reward. Accuracy is measured on unseen data. Neural networks stack layers to learn hierarchical patterns and enable vision, speech, and language. Economics, fairness, and drift decide whether a model earns its keep.
Key Takeaways
- Data science equals question plus cleaning plus exploration plus modeling plus evaluation plus use.
- Supervised uses labels for classification and regression, unsupervised finds groups, reinforcement learns by trial and reward.
- Test accuracy matters. Error type and precision determine profit.
- Overfitting memorizes the past and fails the future.
- Deep learning adds value where patterns are layered and data is abundant.
Discussion Questions
- Why does stage 3 cleaning often decide success before a model runs.
- When is unsupervised segmentation more useful than supervised prediction for a marketer.
- Why would a bank prefer precision on flagged defaulters over raw accuracy.
Exercises
Short answer
- Distinguish AI, machine learning, data science, and deep learning with one line each.
- List the seven stages and the goal of each.
- Define training set, test set, accuracy, and overfitting.
Long answer
- Explain supervised, unsupervised, and reinforcement learning with a Nepal business example for each and a table comparing data, goal, and example.
- Sketch a neural network with input, hidden, and output layers and explain how weight adjustment during training improves predictions for vision or speech, with two business uses.


