Data Dimensionality | Dagster Glossary

Back to Glossary Index

Data Dimensionality

Analyzing the number of features or attributes in the data to improve performance.

Data dimensionality definition:

Dimensionality in data engineering pipelines refers to the number of features or attributes that are present in the data as it moves through the pipeline. In data engineering, it is important to consider dimensionality as a key factor in designing and building data pipelines because high-dimensional data can have significant impacts on pipeline performance, storage requirements, and processing times.

For example, if you are working with a large dataset that contains thousands or millions of rows and hundreds or thousands of columns, it can be challenging to move this data efficiently through a pipeline. Large datasets with high dimensionality can also require more storage space and processing power, which can increase the cost and time required to manage the data.

To address the challenge of high-dimensional data in data engineering pipelines, it is common to use techniques such as feature selection, feature extraction, and dimensionality reduction. These techniques can reduce the number of features in the data, making it more manageable and easier to process.

Data dimensionality in Python:

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

Here is a very basic example Python code for evaluating dimensionality (in this case just number of rows and columns) in a dataset using the pandas library, assuming an input file dataset.csv:

import pandas as pd

# Load dataset into a pandas DataFrame
df = pd.read_csv('dataset.csv')

# Get the number of rows and columns in the dataset
num_rows = df.shape[0]
num_cols = df.shape[1]

# Print the dimensionality of the dataset
print('Number of rows:', num_rows)
print('Number of columns:', num_cols)

Depending on your input file, this would output something like:

Number of rows: 16
Number of columns: 3

In this very basic example, we first load the dataset into a pandas DataFrame using the read_csv() function. Then, we use the shape attribute of the DataFrame to get the number of rows and columns in the dataset. Finally, we print the dimensionality of the dataset by outputting the number of rows and columns using the print() function.

This code can be used to quickly evaluate the dimensionality of a dataset and gain insight into its structure. If you need to perform further analysis on the data, you may want to use additional techniques such as visualization, statistical analysis, or machine learning algorithms to better understand the relationships between the features in the dataset.

A more advanced example of analyzing dimensionality of data using Python and sklearn:

Let’s look at a more advanced example using sklearn.

By exploring multiple dimensions of the data using techniques like PCA and data visualization, we can gain a more complete understanding of the data and make better decisions about how to preprocess and analyze it.

from sklearn.datasets import load_iris
from sklearn.decomposition import PCA

# Load the iris dataset
iris = load_iris()
X = iris.data

# Perform Principal Component Analysis (PCA) to reduce the dimensionality of the dataset
pca = PCA(n_components=4)
X_pca = pca.fit_transform(X)

# Print the variance explained by each principal component
print('Explained variance:', pca.explained_variance_ratio_)

# Print the reduced dimensionality of the dataset
print('Number of rows:', X_pca.shape[0])
print('Number of columns:', X_pca.shape[1])

# Plot the first two principal components against each other
import matplotlib.pyplot as plt
plt.scatter(X_pca[:, 0], X_pca[:, 1], c=iris.target)
plt.title("My Dimensionality Example")
plt.xlabel('Principal Component 1')
plt.ylabel('Principal Component 2')
plt.show()

In this example, we still use the samel “iris dataset” from scikit-learn (literally a dataset of the characteristics of Iris flowers) and perform PCA to reduce the dimensionality of the dataset. We set n_components to 4, which means we're keeping all four dimensions of the original data.

After computing the principal components, we print the explained variance ratio of each principal component to see how much of the variance in the original dataset is captured by each component. This gives us an idea of which dimensions are most important for describing the data.

Next, we plot the first two principal components against each other using matplotlib. This allows us to visualize the data in a two-dimensional space and see how well the different classes of flowers are separated from each other. This can help us gain a better understanding of the underlying structure of the data and identify any patterns or relationships that exist.

You will see the following output in the terminal:

Explained variance: [0.92461872 0.05306648 0.01710261 0.00521218]
Number of rows: 150
Number of columns: 4

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

Checkpointing

Saving the state of a process at certain points so that it can be restarted from that point in case of failure.
An image representing the data engineering concept of 'Checkpointing'
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

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

Preprocess

Transform raw data before data analysis or machine learning modeling.
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'