Concepts / Preparing Data for Machine Learning

Preparing Data for Machine Learning

Think of machine learning as a workflow of connected decisions, not only as model construction.

  • Programming

From Raw Task to Model

Machine learning is easier to reason about when you treat it as a workflow of connected decisions rather than as one act of building a model. The work begins by defining the real-world problem, its inputs, and its target output. It then continues through success measurement, data preparation, model development, and checks for overfitting. Each decision affects what happens next.

Problem definitioninputs and target outputSuccess measureevaluation planData preparationraw data to usable dataFeature engineeringprepared inputsModel trainingdevelop a modelOverfitting checktraining fit versusevaluationEvaluationjudge successdefines what matterssets preparation and evaluation needsprovides usable informationsupplies model inputsrequires a checkaffects how results are judged
How do problem definition, data preparation, feature engineering, evaluation, model training, and overfitting checks connect?

Tracing the Preparation Path

After the real-world problem has been defined, raw data must be made suitable for the machine learning task. Preparation is not one isolated action. It can involve cleaning the available data, transforming it, preparing features, and separating data into training and evaluation sets. Together, these stages create a usable path from raw information to a model.

Raw dataavailable informationCleaningprepared recordsTransformationchanged data formFeature preparationusable inputsTraining andevaluation setsseparated dataModelreceives prepared datacleantransformprepare inputsseparate for useprovide data
How does raw data move through cleaning, transformation, feature preparation, and separation before reaching a model?
Worked example

A Raw-Data Workflow

A team has collected raw data for a real-world machine learning task, but the data is not yet connected to a defined target output or an evaluation plan.

  1. 1
    Define the task

    State the real-world problem, identify the inputs, and specify the target output before judging possible models.

  2. 2
    Plan success

    Choose a measure of success before results are evaluated. This makes clear what the project will treat as a successful result.

  3. 3
    Prepare the data

    Move the raw information through cleaning, transformation, feature preparation, and separation into training and evaluation sets as needed for the task.

  4. 4
    Develop the model

    Use the prepared path from raw information to model inputs to develop a model.

  5. 5
    Check the fit

    Look for the danger that the model has become closely fitted to the training data without solving the broader machine learning problem.

Result

The project is treated as a connected sequence of decisions instead of as model construction alone.

Defining Success Before Training

A model cannot be judged without a measure of success. Choosing that measure belongs to the definition of the machine learning problem; it is not an afterthought added after the model exists. The selected measure determines what the project treats as a successful result during evaluation.

Machine learningproblemdefined target outputMeasure of successchosen before judgingEvaluation resultsuccessful or notSuccess criterionwhat counts as gooddefines context forsetsjudgesguides evaluation
How does the chosen evaluation measure determine what counts as a good prediction for a particular problem?

Recognizing Overfitting

Overfitting occurs when a model becomes closely fitted to the data used for training. A close fit to training data is not automatically the same as solving the broader machine learning problem. This is why the workflow includes model development that makes overfitting visible and evaluation that helps reveal whether the model works beyond the training data.

Trainingperformanceusable fitTraining performancevery close fitEvaluationperformancemeaningful checkEvaluationperformancebroader problem not solvedcomparecompare
What changes when a model learns the training data too closely, and how do its results differ between training data and evaluation data?
Best practice

Do not treat a close fit to training data as sufficient evidence that the machine learning problem has been solved. Keep evaluation in the workflow so that the model is judged against the chosen measure beyond the data used for training.

Applying the Workflow

Consider a team that wants to create a machine learning solution for a real-world task. The team has collected raw data, but it has not stated the target output, selected a measure of success, prepared the data, or considered how overfitting could affect the model. The correct response is not to begin with model construction. Apply the workflow in sequence: define the task, choose how success will be judged, prepare the data, develop the model, and examine the risk of overfitting.

Project teamreal-world taskProblem definitioninputs and targetEvaluation planmeasure of successData preparationclean and transformModel developmenttraining dataOverfitting checktraining fit and evaluationstarts withclarifiesguidessupplies usable datarequires
What decisions and preparation steps should happen first, next, and last when applying the workflow to a new scenario?
MEDIUM

A team has raw data for a new machine learning task. Write the ordered decisions the team should make before judging a model. Include the target output, the measure of success, the main preparation stages, and the overfitting question.

Hints
  • Begin with the real-world problem, its inputs, and its target output.
  • Choose the measure of success before evaluating model results.
  • Include cleaning, transformation, feature preparation, and separation into training and evaluation sets.
  • Ask whether the model is merely closely fitted to the training data.
  • Common mistake

    Starting with model construction before defining the real-world task.

    What it looks like

    A team has raw data and immediately tries to build a model without stating the inputs or target output.

    Why it fails

    The workflow requires the problem, inputs, and target output to be defined before models can be evaluated meaningfully.

    Do this instead

    Define the real-world problem, its inputs, and its target output first.

  • Common mistake

    Choosing a measure of success only after a model has been built.

    What it looks like

    The team compares results first and decides later what counts as success.

    Why it fails

    The measure of success determines what the project treats as a successful result during evaluation.

    Do this instead

    Choose the measure as part of defining the machine learning problem.

  • Common mistake

    Treating data preparation as one action.

    What it looks like

    The team says the data is prepared after only one change to the raw information.

    Why it fails

    Preparation can involve cleaning, transformation, feature preparation, and separation into training and evaluation sets.

    Do this instead

    Trace the complete path from raw information to usable model inputs.

  • Common mistake

    Assuming a close training-data fit proves that the broader problem has been solved.

    What it looks like

    The model fits the training data closely, so the team stops checking its behavior through evaluation.

    Why it fails

    A model can fit training data closely without that being the same as solving the broader machine learning problem.

    Do this instead

    Keep evaluation in the workflow and examine the risk of overfitting.

Workflow Summary

  1. 1
    Define the real-world problem, its inputs, and its target output before evaluating models.
  2. 2
    Prepare raw data through cleaning, transformation, feature preparation, and separation into training and evaluation sets.
  3. 3
    Choose a measure of success before judging results because it defines what counts as successful during evaluation.
  4. 4
    Treat overfitting as the danger of fitting training data too closely without solving the broader machine learning problem.
  5. 5
    Think of machine learning as a connected sequence of decisions rather than as model construction alone.

At a glance

  • Machine learning preparation is a connected workflow of decisions.
  • The path from raw data to a model can include cleaning, transformation, feature preparation, and separation into training and evaluation sets.
  • A measure of success must be chosen before results are judged.
  • Overfitting means fitting the training data too closely, which may not solve the broader machine learning problem.
  • A new scenario should be approached by defining the task, planning evaluation, preparing data, developing the model, and checking for overfitting.

Related concepts

More concepts starting with P