Data Preprocessing | Dagster Glossary

Back to Glossary Index

Data Preprocessing

Transform raw data before data analysis or machine learning modeling.

Data preprocessing definition:

Data Preprocessing is a fundamental step in any data science or data engineering project.

Data preprocessing is a data mining technique that transforms raw data into an understandable and efficient format. This step typically takes place before the data analysis or machine learning modeling stages. Data preprocessing may involve several processes like:

  • Data Cleaning: Removing noise and handling missing or inconsistent data. This step ensures that the quality of data is good enough for the subsequent stages.

  • Data Transformation: Normalization, aggregation, or general scaling of data to prepare it for the machine learning algorithms.

  • Data Reduction: Reducing the volume but producing the same or similar analytical results.

  • Data Discretization: The process of converting continuous data to categorical data.

  • Feature Extraction or Feature Selection: The process of creating new features or modifying existing features to improve the performance of machine learning models.

A simple example of data preprocessing using Python:

Please note that you need to have the necessary Python libraries installed in your Python environment to run this code.

Here is a simple example of text preprocessing. This script uses NLTK and re (regular expressions) to preprocess a simple text string. The preprocessing tasks include:

  1. Text lowercase
  2. Remove numbers
  3. Remove punctuation
  4. Remove whitespaces
  5. Remove stopwords
  6. Stem (reduce words to their root form.)
import re
import nltk
from nltk.corpus import stopwords
from nltk.stem.porter import PorterStemmer

nltk.download('punkt')
nltk.download('stopwords')

# Define the text string
text_string = "Rein in the chaos and maintain control over your data as the complexity scales. Centralize your metadata in one tool with built-in observability, diagnostics, cataloging, and lineage. Spot any of 100 issues and identify performance improvement opportunities."

# Step 1: Convert text to lowercase
text_string = text_string.lower()

# Step 2: Remove numbers
text_string = re.sub(r'\d+', '', text_string)

# Step 3: Remove punctuation
text_string = re.sub(r'[^\w\s]', '', text_string)

# Step 4: Remove whitespaces
text_string = text_string.strip()

# Step 5: Remove stopwords
stop_words = set(stopwords.words('english'))
tokens = nltk.word_tokenize(text_string)
tokens = [token for token in tokens if token not in stop_words]

# Step 6: Stemming
porter = PorterStemmer()
stemmed = [porter.stem(word) for word in tokens]

print(f"Original Text: {text_string}")
print("Preprocessed Text: ", ' '.join(stemmed))

If you execute this code you will see the following output:

Original Text: rein in the chaos and maintain control over your data as the complexity scales centralize your metadata in one tool with builtin observability diagnostics cataloging and lineage spot any of  issues and identify performance improvement opportunities
Preprocessed Text:  rein chao maintain control data complex scale central metadata one tool builtin observ diagnost catalog lineag spot issu identifi perform improv opportun

Data preprocessing vs. Data Preparation:

Data preparation is a broader term than data preprocessing that includes all activities to construct and consolidate a dataset for analysis or operational use. This can involve:

  • Data Acquisition: Collecting or integrating data from various sources.

  • Data Integration: Combining data from different sources and providing users with a unified view of the data.

  • Data Preprocessing: As described above, which includes cleaning, transformation, reduction, etc.

  • Data Partitioning: Splitting the data into training, validation, and test sets for machine learning models.

In essence, data preprocessing can be seen as a subset of data preparation. While data preparation encompasses the entire journey from raw data to the ready-for-analysis or operational-use data, data preprocessing is specifically concerned with refining and transforming the data after it's been acquired and integrated, and before it's analyzed or fed into a machine learning model. Both steps are critical to ensuring the accuracy, reliability, and efficiency of the downstream processes and outcomes.


Other data engineering terms related to
Data Management:
Dagster Glossary code icon

Append

Adding or attaching new records or data items to the end of an existing dataset, database table, file, or list.
An image representing the data engineering concept of 'Append'

Archive

Move rarely accessed data to a low-cost, long-term storage solution to reduce costs. Store data for long-term retention and compliance.
An image representing the data engineering concept of 'Archive'
Dagster Glossary code icon

Augment

Add new data or information to an existing dataset to enhance its value.
An image representing the data engineering concept of 'Augment'

Auto-materialize

The automatic execution of computations and the persistence of their results.
An image representing the data engineering concept of 'Auto-materialize'

Backup

Create a copy of data to protect against loss or corruption.
An image representing the data engineering concept of 'Backup'
Dagster Glossary code icon

Batch Processing

Process large volumes of data all at once in a single operation or batch.
An image representing the data engineering concept of 'Batch Processing'
Dagster Glossary code icon

Cache

Store expensive computation results so they can be reused, not recomputed.
An image representing the data engineering concept of 'Cache'
Dagster Glossary code icon

Categorize

Organizing and classifying data into different categories, groups, or segments.
An image representing the data engineering concept of 'Categorize'
Dagster Glossary code icon

Deduplicate

Identify and remove duplicate records or entries to improve data quality.
An image representing the data engineering concept of 'Deduplicate'

Deserialize

Deserialization is essentially the reverse process of serialization. See: 'Serialize'.
An image representing the data engineering concept of 'Deserialize'
Dagster Glossary code icon

Dimensionality

Analyzing the number of features or attributes in the data to improve performance.
An image representing the data engineering concept of 'Dimensionality'
Dagster Glossary code icon

Encapsulate

The bundling of data with the methods that operate on that data.
An image representing the data engineering concept of 'Encapsulate'
Dagster Glossary code icon

Enrich

Enhance data with additional information from external sources.
An image representing the data engineering concept of 'Enrich'

Export

Extract data from a system for use in another system or application.
An image representing the data engineering concept of 'Export'
Dagster Glossary code icon

Graph Theory

A powerful tool to model and understand intricate relationships within our data systems.
An image representing the data engineering concept of 'Graph Theory'
Dagster Glossary code icon

Idempotent

An operation that produces the same result each time it is performed.
An image representing the data engineering concept of 'Idempotent'
Dagster Glossary code icon

Index

Create an optimized data structure for fast search and retrieval.
An image representing the data engineering concept of 'Index'
Dagster Glossary code icon

Integrate

Combine data from different sources to create a unified view for analysis or reporting.
An image representing the data engineering concept of 'Integrate'
Dagster Glossary code icon

Lineage

Understand how data moves through a pipeline, including its origin, transformations, dependencies, and ultimate consumption.
An image representing the data engineering concept of 'Lineage'
Dagster Glossary code icon

Linearizability

Ensure that each individual operation on a distributed system appear to occur instantaneously.
An image representing the data engineering concept of 'Linearizability'
Dagster Glossary code icon

Materialize

Executing a computation and persisting the results into storage.
An image representing the data engineering concept of 'Materialize'
Dagster Glossary code icon

Memoize

Store the results of expensive function calls and reusing them when the same inputs occur again.
An image representing the data engineering concept of 'Memoize'
Dagster Glossary code icon

Merge

Combine data from multiple datasets into a single dataset.
An image representing the data engineering concept of 'Merge'
Dagster Glossary code icon

Model

Create a conceptual representation of data objects.
An image representing the data engineering concept of 'Model'

Monitor

Track data processing metrics and system health to ensure high availability and performance.
An image representing the data engineering concept of 'Monitor'
Dagster Glossary code icon

Named Entity Recognition

Locate and classify named entities in text into pre-defined categories.
An image representing the data engineering concept of 'Named Entity Recognition'
Dagster Glossary code icon

Parse

Interpret and convert data from one format to another.
Dagster Glossary code icon

Partition

Data partitioning is a technique that data engineers and ML engineers use to divide data into smaller subsets for improved performance.
An image representing the data engineering concept of 'Partition'
Dagster Glossary code icon

Prep

Transform your data so it is fit-for-purpose.
An image representing the data engineering concept of 'Prep'
Dagster Glossary code icon

Replicate

Create a copy of data for redundancy or distributed processing.

Scaling

Increasing the capacity or performance of a system to handle more data or traffic.
Dagster Glossary code icon

Schema Inference

Automatically identify the structure of a dataset.
An image representing the data engineering concept of 'Schema Inference'
Dagster Glossary code icon

Schema Mapping

Translate data from one schema or structure to another to facilitate data integration.
Dagster Glossary code icon

Secondary Index

Improve the efficiency of data retrieval in a database or storage system.
An image representing the data engineering concept of 'Secondary Index'
Dagster Glossary code icon

Software-defined Asset

A declarative design pattern that represents a data asset through code.
An image representing the data engineering concept of 'Software-defined Asset'

Synchronize

Ensure that data in different systems or databases are in sync and up-to-date.
Dagster Glossary code icon

Validate

Check data for completeness, accuracy, and consistency.
An image representing the data engineering concept of 'Validate'
Dagster Glossary code icon

Version

Maintain a history of changes to data for auditing and tracking purposes.
An image representing the data engineering concept of 'Version'