Study guide

3.6 Big Data Projects: Wrangling, Exploration, Feature Engineering & Model Training

CFA Level 2 Chartered Financial Analyst

Track your progress as you read

Finished sections get a check mark.

1 Introduction & CFA Level II Exam Strategy

1.1 CFA Level II Exam Overview & Item-Set Vignette Strategy 1.2 2026 Curriculum Structure & 10 Topic Weight Bands 1.3 300-Hour Study Plan, Calculator Mastery & Practical Skills Modules (PSM)

2 Ethical and Professional Standards

2.1 Code of Ethics & The Seven Standards of Professional Conduct 2.2 Vignette Analysis: Conflicts of Interest & Disclosure (Standard VI) 2.3 Duties to Clients (Standard III) & Duties to Employers (Standard IV) 2.4 Standard V: Investment Analysis, Recommendations & Actions and Standard VII: Responsibilities as a CFA Member or Candidate 2.5 Application of the Code and Standards: Level II Case Method 2.6 Recommended Procedures: Compliance Programs, Supervisory Systems & Firm Policies

3 Quantitative Methods

3.1 Multiple Linear Regression, ANOVA & Hypothesis Testing 3.2 Regression Diagnostics: Multicollinearity, Heteroskedasticity & Serial Correlation 3.3 Time-Series Analysis: AR Models, Nonstationarity & Cointegration 3.4 Machine Learning, Deep Learning & Big Data Projects 3.5 Extensions of Multiple Regression: Influence Analysis, Qualitative Variables & Logistic Regression 3.6 Big Data Projects: Wrangling, Exploration, Feature Engineering & Model Training

4 Economics for Valuation

4.1 Foreign Exchange Parity Relations & Equilibrium Exchange Rates 4.2 Economic Growth Theories & Production Function Analysis 4.3 Forward Points, the Carry Trade & Policy Effects on Exchange Rates 4.4 Growth Determinants: Natural Resources, Demographics, Convergence & Trade Openness

5 Financial Statement Analysis

5.1 Intercorporate Investments: Equity Method & Business Combinations 5.2 Employee Compensation: Defined Benefit Pension Plans & Share-Based Payments 5.3 Multinational Operations: Current Rate vs Temporal Translation 5.4 Analysis of Financial Institutions & The CAMELS Framework 5.5 Evaluating the Quality of Financial Reports & Accounting Adjustments 5.6 Integration of Financial Statement Analysis Techniques

6 Corporate Issuers

6.1 Analysis of Dividends: Policy Theories, Signaling & Taxation Systems 6.2 Share Repurchases: Methods, EPS and Book Value Effects & Payout Sustainability 6.3 Cost of Capital: Advanced Topics 6.4 Corporate Governance, Board Oversight & ESG Integration 6.5 Corporate Restructuring: Types, Motivations, Evaluation & Valuation 6.6 Restructuring Financial Effects: EPS, Net Debt to EBITDA, WACC & Divestitures

7 Equity Valuation

7.1 Equity Valuation Framework & Required Rate of Return Estimation 7.2 Discounted Dividend Valuation: Gordon Growth, Multistage & The H-Model 7.3 Free Cash Flow Valuation: FCFF and FCFE Modeling 7.4 Market-Based Valuation: Price and Enterprise Value Multiples 7.5 Residual Income Valuation 7.6 Private Company Valuation: Income, Market & Asset-Based Approaches 7.7 Choosing and Combining Models: Definitions of Value, Sum-of-the-Parts & Cross-Border Comparability

8 Fixed Income Analysis

8.1 The Term Structure and Interest Rate Dynamics: Spot, Forward & Swap Curves 8.2 The Arbitrage-Free Valuation Framework & Binomial Interest Rate Trees 8.3 Valuation and Analysis of Bonds with Embedded Options: OAS & Duration 8.4 Credit Analysis Models: Structural vs Reduced-Form Approaches 8.5 Credit Default Swaps (CDS): Mechanics, Pricing & Trading Strategies 8.6 Managing Yield-Curve Risk: Key Rate Durations, One-Sided Durations & Yield Volatility Structure

9 Derivatives & Risk Management

9.1 Pricing and Valuation of Forward Commitments: Equity, Fixed Income & FX 9.2 Swap Pricing and Valuation: Interest Rate, Currency & Equity Swaps 9.3 Contingent Claims: Binomial Option Pricing Model & Arbitrage Replication 9.4 The Black-Scholes-Merton (BSM) Model, Option Greeks & Dynamic Hedging 9.5 Interest Rate Options, Swaptions & the Black Model

10 Alternative Investments

10.1 Commodities and Commodity Derivatives: Sectors, Participants, Futures Returns & Indexes 10.2 Private Real Estate Investments: Direct Capitalization, DCF & Cost Approach 10.3 Public Real Estate Investments: REIT Structures, NAV, FFO & AFFO 10.4 Hedge Fund Strategies: Classification, Implementation & Portfolio Role 10.5 Real Estate Investment Features, Due Diligence & Index Construction Biases

11 Portfolio Management

11.1 Using Multifactor Models: Macroeconomic, Fundamental & Statistical Risk 11.2 Measuring and Managing Market Risk: VaR, CVaR & Stress Testing 11.3 Economics & Investment Markets: Business Cycles, Term Structure & Asset Allocation 11.4 Analysis of Active Portfolio Management & The Fundamental Law 11.5 Exchange-Traded Funds (ETFs): Creation, Arbitrage, Tracking & Applications 11.6 Backtesting and Simulation: Procedures, Metrics, Biases & Scenario Analysis

3.6 Big Data Projects: Wrangling, Exploration, Feature Engineering & Model Training

Key Takeaways Explain This Topic AI

A financial data analysis project runs conceptualization, data collection, data preparation and wrangling, data exploration, and model training, with the structured and unstructured branches differing mainly in the preparation stage.

Text preparation removes html tags, punctuation, numbers, and white space, then normalization lowercases, removes stop words, and applies stemming or lemmatization before a document term matrix is built.

Feature selection reduces the number of tokens to control overfitting, using chi-square statistics, mutual information, and term frequency filters that discard both very rare and very common terms.

Model training balances method selection, performance evaluation, and tuning, using a confusion matrix to derive precision, recall, F1 score, and accuracy on validation data.

F1 score is the harmonic mean of precision and recall and is the preferred metric when classes are imbalanced, because accuracy can be high while the minority class is never detected.

Last updated: August 2026

3.6 Big Data Projects: Wrangling, Exploration, Feature Engineering & Model Training

Blueprint note: Big Data Projects is a separate Level II learning module from Machine Learning. Its learning outcomes are the steps of a data analysis project, data preparation and wrangling, data exploration, feature extraction and selection from text, model training, and evaluating the fit of a machine learning algorithm. Vignettes describe a project and ask which step is being described, what went wrong, or how a printed confusion matrix should be read.

1. The Five Steps of a Financial Data Analysis Project

  • Step Structured data Unstructured (text) data
  • 1. Conceptualization Define the output, the decision it supports, and how it will be used Identical

2. Data collection Extract from internal databases and vendors; identify variables Curate a text corpus from filings, transcripts, news, social media

3. Data preparation and wrangling Cleanse errors; transform through extraction, aggregation, filtration, selection, conversion Cleanse markup and punctuation; normalize; tokenize

4. Data exploration Exploratory data analysis, feature selection, feature engineering Same three activities applied to tokens

5. Model training Select method, evaluate performance, tune Identical

The two branches differ mainly at step 3. Everything after tokenization is common.

2. Data Preparation and Wrangling: Structured Data

Cleansing addresses five defect types:

Incompleteness — missing values; the remedy is omission, or imputation with the mean, median, mode, or a model-based estimate.

Invalidity — values outside a permissible range, such as a negative price.

Inaccuracy — values that are valid in form but wrong in fact.

Inconsistency — values that conflict with other fields, such as a country field that contradicts a currency field.

Non-uniformity — the same quantity expressed in different formats, such as mixed date conventions or mixed currency units.

Duplication — repeated records that overweight an observation.

Preprocessing then transforms clean data:

Extraction — deriving a new variable from existing ones, such as age from date of birth.

Aggregation — combining related variables into one.

Filtration — deleting rows not needed for the project.

Selection — deleting columns not needed.

Conversion — putting variables into consistent types: nominal, ordinal, integer, ratio.

Outlier handling uses two named techniques. Trimming (truncation) removes the extreme observations entirely — a 2% trim removes the highest and lowest 1%. Winsorization replaces extreme values with the value at a stated percentile, keeping the observation count intact. Winsorization is usually preferred when the sample is small, because trimming discards information.

Scaling puts variables on comparable ranges, which matters for penalized regression, support vector machines, and k-nearest neighbour:

Normalization rescales to [ 0 , 1 ] [0,1] [ 0 , 1 ] : X n o r m = ( X − X m i n ) / ( X m a x − X m i n ) X_{norm} = (X - X_{min}) / (X_{max} - X_{min}) X n or m ​ = ( X − X min ​ ) / ( X ma x ​ − X min ​ ) . It is sensitive to outliers and does not assume normality.

Standardization centres and scales to a mean of 0 and standard deviation of 1: Z = ( X − μ ) / σ Z = (X - \mu) / \sigma Z = ( X − μ ) / σ . It assumes an approximately normal distribution and is less sensitive to outliers.

3. Text Preparation and Wrangling

Cleansing the raw text removes:

html tags and other markup;

punctuation , though some marks are replaced with annotations because they carry meaning — a percentage sign becomes a token such as percentSign , and currency symbols and question marks are similarly annotated rather than simply deleted;

numbers , replaced with an annotation such as number when the magnitude is irrelevant to the task;

extra white space , tabs, and line breaks.

Normalization then applies four operations:

Lowercasing , so that "Growth" and "growth" are one token.

Removing stop words — high-frequency, low-information words such as the , is , a . Financial applications sometimes retain negations, because "not profitable" and "profitable" must remain distinct.

Stemming — chopping to a root form by rule: analysing , analysed , and analyses all become analys . It is fast and crude.

Lemmatization — mapping to a dictionary base form using context: better becomes good . It is more accurate and computationally more expensive.

Tokenization splits the normalized text into tokens, and bag-of-words (BOW) represents a document as its unordered collection of tokens. N-grams preserve limited word order: a bigram treats "interest rate" as a single token, which matters because the unigrams "interest" and "rate" separately lose the concept.

The output is a document term matrix (DTM) : rows are documents, columns are tokens, and each cell holds the frequency of that token in that document. A DTM built from a large corpus is extremely sparse — most cells are zero — which is exactly why feature selection is necessary.

4. Data Exploration: Feature Selection and Feature Engineering

Exploratory data analysis (EDA) comes first: histograms, box plots, scatter plots, and word clouds for text. Its purposes are to understand distributions, to spot relationships worth modelling, and to reveal data problems that cleansing missed.

Feature selection reduces the number of features, cutting noise and the risk of overfitting. For text, the standard tools are:

Term frequency (TF) filters. Tokens with very high TF across the whole corpus carry little discriminating power and are dropped along with stop words; tokens with very low TF appear too rarely to generalise and are also dropped. The useful vocabulary sits in the middle.

Document frequency (DF) — the proportion of documents containing the token.

Chi-square statistic — ranks tokens by their association with the target class; the highest-ranked tokens are retained.

Mutual information (MI) — measures how much information a token contributes about the class. MI is 0 when a token is equally distributed across classes and approaches 1 when it appears in only one class.

Feature engineering creates new, more informative features:

  • converting numbers to categories such as decile buckets;
  • n-grams as described above;
  • name entity recognition (NER) , tagging tokens as organisation, person, location, money, or date;

parts of speech (POS) tagging, which distinguishes the noun "lead" from the verb "lead".

The two activities pull in opposite directions and must be balanced: too few features underfit, too many overfit and slow training.

5. Model Training and Evaluating the Fit

Model training has three components that are iterated, not performed once:

Method selection — supervised or unsupervised, linear or non-linear, driven by the data type, the size of the dataset, and whether interpretability is required.

Performance evaluation — measuring fit on data the model has not seen.

Tuning — adjusting hyperparameters to move along the bias-variance trade-off.

The confusion matrix and its four metrics

For a binary classifier, compare predictions against actual classes:

  • Actual: positive Actual: negative
  • Predicted positive True positive (TP) False positive (FP), type I error
  • Predicted negative False negative (FN), type II error True negative (TN)

Precision = T P / ( T P + F P ) = TP / (TP + FP) = TP / ( TP + FP ) — of everything flagged, how much was real. High precision matters when a false alarm is costly.

Recall (sensitivity) = T P / ( T P + F N ) = TP / (TP + FN) = TP / ( TP + FN ) — of everything real, how much was caught. High recall matters when a miss is costly, as in fraud or default screening.

Accuracy = ( T P + T N ) / ( T P + F P + T N + F N ) = (TP + TN) / (TP + FP + TN + FN) = ( TP + TN ) / ( TP + FP + TN + FN ) .

F1 score = ( 2 × precision × recall ) / ( precision + recall ) = (2 \times \text{precision} \times \text{recall}) / (\text{precision} + \text{recall}) = ( 2 × precision × recall ) / ( precision + recall ) — the harmonic mean.

F1 is the preferred metric under class imbalance. If 2% of loans default, a model that predicts "no default" for everything achieves 98% accuracy, zero recall, and an F1 of 0. Accuracy alone would call that model excellent.

Worked evaluation

A model screening 1,000 loans for default produces TP = 60, FP = 40, FN = 30, TN = 870.

  • Precision = 60 / ( 60 + 40 ) = 0.600 = 60/(60+40) = 0.600 = 60/ ( 60 + 40 ) = 0.600
  • Recall = 60 / ( 60 + 30 ) = 0.667 = 60/(60+30) = 0.667 = 60/ ( 60 + 30 ) = 0.667
  • Accuracy = ( 60 + 870 ) / 1,000 = 0.930 = (60+870)/1{,}000 = 0.930 = ( 60 + 870 ) /1 , 000 = 0.930

F1 = 2 ( 0.600 ) ( 0.667 ) / ( 0.600 + 0.667 ) = 0.8004 / 1.267 = 0.632 = 2(0.600)(0.667)/(0.600+0.667) = 0.8004/1.267 = 0.632 = 2 ( 0.600 ) ( 0.667 ) / ( 0.600 + 0.667 ) = 0.8004/1.267 = 0.632

Accuracy of 93.0% looks strong, but F1 of 0.632 shows the model misses a third of actual defaults. Lowering the classification threshold would raise recall and lower precision; where to set it depends on the relative cost of a missed default versus an unnecessary review.

Tuning and the fitting curve

Bias error is the in-sample error of an underfitted model; variance error is the out-of-sample error of an overfitted model. Total error is minimised at an intermediate model complexity.

A fitting curve plots error against a complexity or regularization parameter, and the optimum sits where the validation error stops falling and begins to rise.

Regularization (the penalty term λ \lambda λ in LASSO or ridge) reduces variance at the cost of some bias. Raising λ \lambda λ shrinks coefficients and, in LASSO, sets some to exactly zero, performing feature selection automatically.

K-fold cross-validation splits the data into k subsets, trains on k − 1 k-1 k − 1 and validates on the remaining one, rotating through all k . It uses the sample efficiently and mitigates the risk that a single arbitrary validation split flatters the model.

Ceiling analysis

Once a pipeline is running, ceiling analysis evaluates each component in turn to find where improvement pays best. If perfecting the tokenizer would raise overall accuracy by 1 percentage point but perfecting the feature-selection stage would raise it by 8, engineering effort belongs in feature selection.