Assignment AI week 4_Komalasari_2681483783

Question :

  1. Explain the goal of linear regression using the equation $y = mx + b$. What do $m$ and $b$ represent?

  2. What is the primary difference in the output of a regression model versus a classification model?

  3. How does a decision tree make a prediction?

  4. Give an example of a business problem that could be solved with classification (e.g., spam detection)

Answer :

1.The goal of linear regression is to find a straight line of best fit that models the relationship between an independent input variable (

  1. x) and a dependent output variable (y) so you can understand trends and make predictions. 

What m and b Represent

  • m (Slope): The slope or regression coefficient shows the rate of change. It tells you how much the predicted output (y) changes on average for every single-unit increase in the input (x).
  • b (Intercept): The y-intercept is the baseline value. It represents the predicted value of y when the input x is equal to zero. 

2.

The primary difference is that a regression model outputs a continuous numerical value, whereas a classification model outputs a discrete class label or category. 

Key Differences

  • Regression Output: Produces a real-valued number on a continuous scale (e.g., a specific price, temperature, or weight).
  • Classification Output: Assigns data to predefined, separate categories or classes (e.g., “spam” or “not spam”, or “cat”, “dog”, or “bird”).
  • Evaluation Metrics: Regression uses error measurements like Mean Squared Error (MSE), while classification uses metrics like accuracy, precision, and recall. 

3.

A decision tree is a flowchart-like model used in machine learning and decision-making to map out choices, data splits, and their potential outcomes. 

Structure of a Decision Tree

Every decision tree is built from a few core parts: 

  • Root Node: The starting point at the very top representing the entire dataset or initial question.
  • Internal Nodes: Split points that evaluate specific feature conditions or attributes.
  • Branches: The lines connecting nodes that represent the choices or outcome of an evaluation.
  • Leaf (Terminal) Nodes: The final endpoints of the tree that give the ultimate prediction or decision. 

How It Works

The decision tree algorithm works by breaking data down into smaller and cleaner groups through recursive splitting: 

Choosing the Best Split: The algorithm scans all available features to find the one that sorts the data most effectively. It measures this using metrics like Information Gain and Entropy (for classification) or Sum of Squared Errors (for regression) to find the split with the least disorder. 

  1. Branching Out: It divides the data into sub-nodes based on the threshold or category of that feature. 
  2. Repeating the Process: It treats each new sub-node as a new mini-root, repeating the split process layer by layer. 
  3. Reaching a Prediction: The process stops when the data groups are as pure as possible or reach a preset depth limit. New data points flow down the path of answered questions until they land on a leaf node prediction. 

4.

Customer churn prediction is a common business problem solved with classification, where a model determines whether a customer will leave or stay (yes/no or churn/retain) based on their usage data and activity.

How the Solution Works

  • Input Data: Customer details like contract type, support tickets, usage frequency, and payment history.
  • Categories: The model sorts each customer into one of two discrete classes: Likely to Churn or Likely to Stay.
  • Action: When the model flags a customer as likely to churn, the business can automatically send a targeted discount or offer proactive support to retain them.

Status: Terselesaikan 100%

Previous Post Previous Post

Leave a comment