Module 04 · Final Project and Assessment
Peer-graded Assignment: Final Assignment同行评审作业:最终作业
In this Assignment, you will demonstrate your understanding of the data science methodology by applying it to a given problem. Pick one of the following topics to apply the data science methodology to:
在本作业中,您将通过将数据科学方法论应用于给定问题来展示您对数据科学方法论的理解。从以下主题中选择一个,将数据科学方法论应用于该主题:
- Emails 电子邮件
- Hospitals 医院
- Credit Cards 信用卡
You will have to play the role of the client as well as the data scientist to come up with a problem that is more specific but related to these topics.
你将需要扮演客户和数据科学家的角色,以提出一个更具体但与这些主题相关的问题。
Please note that this assignment is worth 10% of your final grade.
请注意,这项作业占你最终成绩的 10%。
请根据以上课程内容,帮我完成下面的作业,我选择主题:信用卡
Which topic did you choose to apply the data science methodology to? (2 points)
你选择了哪个主题来应用数据科学方法论?(2 分)
Your answer needs to be a little bit longer. Write a few sentences to complete your assignment.
你的答案需要稍微长一些。写几句话来完成你的作业。
Next, you will play the role of the client and the data scientist.
接下来,你将扮演客户和数据科学家的角色。
Using the topic that you selected, complete the Business Understanding stage by coming up with a problem that you would like to solve and phrasing it in the form of a question that you will use data to answer. (3 points)
使用你选择的主题,通过提出一个你想解决的问题,并以数据可以回答的形式将其表述为问题,来完成业务理解阶段。(3 分)
You are required to: 你需要:
- Describe the problem, related to the topic you selected.
描述你选择的主题相关的问题。 - Phrase the problem as a question to be answered using data.
将问题表述为一个需要使用数据来回答的问题。
For example, using the food recipes use case discussed in the labs, the question that we defined was, "Can we automatically determine the cuisine of a given dish based on its ingredients?".
例如,在实验室讨论的食品食谱用例中,我们定义的问题是:“我们能根据其成分自动确定给定菜肴的菜系吗?”
Your answer needs to be a little bit longer. Write a few sentences to complete your assignment.
你的答案需要稍微长一些。写几句话来完成你的作业。
Briefly explain how you would complete each of the following stages for the problem that you described in the Business Understanding stage, so that you are ultimately able to answer the question that you came up with. (5 points):
简要解释一下,对于你在业务理解阶段描述的问题,你将如何完成以下每个阶段,以便最终能够回答你提出的问题。(5 分)
- Analytic Approach 分析方法
- Data Requirements 数据需求
- Data Collection 数据收集
- Data Understanding and Preparation
数据理解与准备 - Modeling and Evaluation 建模与评估
Below is how I would complete the subsequent stages of the data science methodology for the "Credit Card Fraud Detection" problem:
Analytic Approach Since our problem is to determine whether a transaction is "fraudulent" or "legitimate," this is essentially a binary choice problem. Therefore, I would choose a Classification approach.
- Specifics: We will build a classification model (such as a Decision Tree, Random Forest, or Logistic Regression) to predict the probability of a new transaction's category by learning from the characteristics of known fraudulent and legitimate transactions.
Data Requirements To train the classification model, we need data "ingredients" that describe the transaction context and customer habits.
- Specifics: We require detailed information for every transaction (e.g., transaction amount, timestamp, location, Merchant Category Code/MCC), as well as customer profile data (e.g., age, historical average spending, frequently visited locations). Most importantly, we need labeled data—historical records indicating which transactions have been confirmed as fraudulent and which are normal.
Data Collection In this stage, as a data scientist, I need to identify where the data sources are.
- Specifics: I would collaborate with the bank's Database Administrators (DBAs) to extract structured data from the past 12 to 24 months from the bank's Core Banking System and Customer Relationship Management (CRM) system. Additionally, we might need to collect external data, such as lists of known blacklisted merchants or high-risk IP addresses.
Data Understanding and Preparation This is the most time-consuming stage, similar to "washing vegetables" before cooking.
- Data Understanding: I would use descriptive statistics and visualization techniques to examine the data. For example, I would check the distribution of "transaction amounts" and verify the proportion of fraudulent transactions in the total dataset (usually very low, indicating a data imbalance issue).
- Data Preparation:
- Cleaning: Handle missing values (e.g., missing merchant information).
- Feature Engineering: Create new variables, such as "time elapsed since the last transaction" or "is the transaction amount significantly higher than the user's 30-day average."
- Handling Imbalance: Since fraudulent transactions are rare, I might need to use techniques like Oversampling to increase the weight of fraud samples so the model can learn better.
- Splitting: Divide the data into a Training set and a Testing set.
Modeling and Evaluation
- Modeling: Use the training set to train algorithms (e.g., Decision Trees or XGBoost). The model will learn which feature combinations (e.g., "3 AM" + "large transaction in a foreign location") point most strongly to fraud.
- Evaluation: Validate the model using the testing set.
- Key Metrics: For fraud detection, simple "Accuracy" is not enough. I will focus on Precision and Recall, as well as the ROC curve.
- Diagnostics: If the model misses too many fraud cases (False Negatives), we need to adjust the threshold or increase the penalty weight for misclassification (Cost-sensitive learning) to ensure the model captures risk keenly while minimizing disturbance to legitimate customers.
You can always refer to the labs as a reference with describing how you would complete each stage for your problem.
你可以随时参考实验,了解如何完成每个阶段以解决你的问题。
这是一份为您准备的作业参考答案。根据您选择的主题,我将扮演客户(银行管理层)和数据科学家的角色,严格按照课程讲授的 Data Science Methodology (数据科学方法论) 来构建答案。
1. Which topic did you choose to apply the data science methodology to? (2 points)
你选择了哪个主题来应用数据科学方法论?(2 分)
我选择的主题是 Credit Cards(信用卡)。在当今的金融生态系统中,信用卡欺诈检测是一个极具挑战性且影响深远的商业问题,它非常适合用来展示数据科学方法论如何从发现问题演变为实际的解决方案,以保护银行资产和客户信任。
2. Business Understanding (3 points)
业务理解(3 分)
Role Play / 角色扮演:
- 客户(银行风控VP):“我们面临着严重的信用卡欺诈问题。虽然大多数交易是合法的,但那一小部分欺诈交易给银行带来了巨大的赔偿损失,也让客户对我们失去了信心。我们需要一种方法来在交易发生时就识别出是否是欺诈。”
- 数据科学家:“明白了,我们的目标是利用历史数据模式来识别异常行为。”
- Describe the problem / 描述问题:
信用卡发卡行目前面临着日益复杂的欺诈交易威胁。现有的基于简单规则的系统(例如“金额超过 1 万元即拦截”)要么漏掉了复杂的欺诈行为,要么错误地拦截了客户的正常消费(假阳性),导致客户满意度下降和处理成本增加。问题的核心是如何在海量的高速交易中,精准地识别出极少数的非法交易,从而在减少经济损失的同时,不影响正常用户的体验。 - Phrase the problem as a question / 将问题表述为一个问题:
“我们能否基于历史交易模式、客户行为特征及上下文数据,利用机器学习模型自动预测每一笔新的信用卡交易是‘欺诈(Fraudulent)’还是‘合法(Legitimate)’?”
3. Explain subsequent stages (5 points)
简要解释后续阶段(5 分)
以下我将针对上述“信用卡欺诈检测”问题,应用数据科学方法论的后续阶段:
Analytic Approach (分析方法)
由于我们的问题是确定一笔交易属于“欺诈”还是“合法”,这本质上是一个二元选择问题。因此,我会选择 Classification (分类) 方法。
- 具体做法:我们将构建一个分类模型(如逻辑回归、决策树或随机森林),通过学习已知的欺诈和合法交易的特征,来预测新交易类别的概率。
Data Requirements (数据需求)
为了训练分类模型,我们需要能够描述交易背景和客户习惯的数据“食材”。
- 具体需求:我们需要每笔交易的详细信息(如交易金额、时间、地点、商户类别代码 MCC),以及客户的画像数据(如年龄、历史平均消费金额、常用消费地)。最重要的是,我们需要标签数据,即历史数据中哪些交易已经被确认为欺诈,哪些是正常的。
Data Collection (数据收集)
在这个阶段,作为数据科学家,我需要知道数据源在哪里。
- 具体做法:我将与银行的数据库管理员 (DBA) 合作,从银行的核心交易系统 (Core Banking System) 和客户关系管理系统 (CRM) 中提取过去 12 到 24 个月的结构化数据。同时,可能需要收集外部数据,如已知的黑名单商户或高风险IP地址列表。
Data Understanding and Preparation (数据理解与准备)
这是最耗时的阶段,类似“清洗蔬菜”。
- Data Understanding (理解):我会使用描述性统计和可视化技术来检查数据。例如,检查“交易金额”的分布,确认欺诈交易在总数据中的占比(通常极低,存在数据不平衡问题)。
- Data Preparation (准备):
- 清洗:处理缺失值(如缺失的商户信息)。
- 特征工程:创建新变量,例如“当前交易距离上一次交易的时间间隔”或“交易金额是否远高于该用户过去30天的平均值”。
- 处理不平衡:由于欺诈交易很少,我可能需要使用过采样 (Oversampling) 技术来增加欺诈样本的权重,以便模型能更好地学习。
- 划分数据集:将数据划分为训练集(Training set)和测试集(Testing set)。
Modeling and Evaluation (建模与评估)
- Modeling (建模):使用训练集数据训练算法(例如决策树或 XGBoost)。模型将学习什么样的特征组合(例如:凌晨 3 点 + 异地大额刷卡)最可能指向欺诈。
- Evaluation (评估):使用测试集验证模型。
- 关键指标:对于欺诈检测,单纯的“准确率 (Accuracy)”是不够的(因为全部预测为正常也能得到高准确率)。我将重点关注 Precision (精确率) 和 Recall (召回率),以及 ROC 曲线。
- 诊断:如果模型漏掉了太多欺诈(假阴性),我们需要调整阈值或增加对误判的惩罚权重(Cost-sensitive learning),确保模型能敏锐地捕捉到风险,同时尽量减少对正常客户的打扰。