Complete the following 9 lab experiments covering all 5 units of Big Data Analytics. Each experiment includes step-by-step procedures, tools, and technologies.
Load, explore, and analyze large datasets using Python libraries. Perform data cleaning, handle missing values, and generate summary statistics for big data analytics.
Python
Pandas
NumPy
CSV/JSON
- Setup: Install Python 3.x, Pandas, NumPy, and Matplotlib
- Load Data: Use
pd.read_csv() to load a large dataset (e.g., NYC Taxi Trips)
- Explore: Run
df.head(), df.info(), df.describe()
- Clean: Handle missing values with
dropna() or fillna()
- Transform: Convert data types, create new columns, filter rows
- Analyze: Group by columns, compute aggregates, find correlations
- Visualize: Plot histograms, box plots, and scatter plots
- Report: Summarize findings and export cleaned data to CSV
Perform Hadoop Distributed File System operations and write MapReduce programs to process large datasets across a cluster.
Hadoop
HDFS
MapReduce
Java
- Setup: Install Hadoop in pseudo-distributed mode and configure HDFS
- HDFS Commands: Run
hdfs dfs -mkdir /input and -put files to HDFS
- Verify: Use
hdfs dfs -ls /input to list uploaded files
- MapReduce (WordCount): Write Mapper class to tokenize input lines
- Reducer: Write Reducer class to aggregate word counts
- Driver: Configure Job with input/output paths and jar file
- Execute: Run
hadoop jar command to submit the job
- Output: Read results from HDFS using
hdfs dfs -cat /output/part-r-00000
Create and manipulate Resilient Distributed Datasets (RDDs) in Spark. Perform transformations and actions for distributed data processing.
Spark
RDD
PySpark
Scala
- Setup: Install Apache Spark and configure PySpark environment
- Create RDD: Use
sc.textFile() or sc.parallelize()
- Transformations: Apply
map(), filter(), flatMap()
- Actions: Use
collect(), count(), take(), reduce()
- Pair RDDs: Create key-value pairs and use
reduceByKey(), groupByKey()
- Persistence: Cache RDDs with
cache() or persist()
- WordCount: Implement word count using RDD transformations
- Compare: Measure execution time vs MapReduce for same dataset
Use Spark SQL and DataFrames for structured data processing. Write SQL queries on large datasets and perform complex analytics.
Spark SQL
DataFrames
PySpark
SQL
- Setup: Create SparkSession with
SparkSession.builder
- Load Data: Read JSON/CSV into DataFrame using
spark.read
- Schema: Define schema using StructType or infer from data
- Operations: Use
select(), filter(), groupBy(), agg()
- SQL: Create temp view with
createOrReplaceTempView() and run SQL
- Join: Join multiple DataFrames using
join()
- Window Functions: Use
row_number(), rank(), lag()
- Output: Write results to Parquet format using
write.parquet()
Perform Create, Read, Update, and Delete operations in MongoDB. Work with document-based storage for unstructured big data.
MongoDB
NoSQL
PyMongo
JSON
- Setup: Install MongoDB and start the mongod service
- Connect: Use
pymongo.MongoClient() to connect to server
- Create: Insert single/many documents with
insert_one() / insert_many()
- Read: Query with
find(), find_one(), and query operators ($gt, $in, $regex)
- Update: Use
update_one() and update_many() with $set, $push
- Delete: Remove documents with
delete_one() / delete_many()
- Indexing: Create indexes with
create_index() for faster queries
- Aggregation: Use aggregation pipeline with $match, $group, $sort
Design and implement data models in Apache Cassandra. Perform CRUD operations and understand partitioning strategies for distributed storage.
Cassandra
CQL
NoSQL
Partitioning
- Setup: Install Apache Cassandra and start the service
- Connect: Use cqlsh shell or Python cassandra-driver
- Keyspace: Create keyspace with
CREATE KEYSPACE (SimpleStrategy)
- Table: Design table with primary key (partition key + clustering columns)
- Insert: Add rows using
INSERT INTO with proper partitioning
- Query: Read data with
SELECT (must include partition key)
- Update/Delete: Use
UPDATE and DELETE with partition key
- Modeling: Create denormalized tables for different query patterns
Create interactive and static visualizations for big data analytics. Generate charts, graphs, and dashboards to communicate insights.
Matplotlib
Seaborn
Python
Plotly
- Setup: Install Matplotlib, Seaborn, and Plotly
- Basic Plots: Create line plots, bar charts, and pie charts with
plt.plot()
- Subplots: Use
plt.subplots() for multi-panel figures
- Styling: Apply themes with
seaborn.set_style() and custom colors
- Distributions: Plot histograms with
plt.hist() and KDE with seaborn
- Heatmaps: Create correlation heatmaps using
sns.heatmap()
- Interactive: Build interactive plots with Plotly (
plotly.express)
- Export: Save figures as PNG/SVG with
plt.savefig()
Implement K-Means clustering algorithm using Spark MLlib for large-scale unsupervised machine learning on distributed datasets.
MLlib
Spark ML
PySpark
K-Means
- Setup: Configure Spark with MLlib dependencies
- Load Data: Read dataset into DataFrame and assemble feature vector
- Preprocess: Use
VectorAssembler and StandardScaler
- Model: Create
KMeans estimator with k=3 and fit on data
- Evaluate: Compute Within Set Sum of Squared Errors (WSSSE)
- Optimize: Try different k values and plot elbow curve
- Visualize: Plot cluster assignments against original data
- Interpret: Analyze cluster centers and label assignments
Build a complete pipeline: data ingestion, processing, storage, and visualization. Integrate Hadoop, Spark, NoSQL, and analytics tools.
Hadoop
Spark
MongoDB
Visualization
- Ingest: Upload raw data to HDFS from multiple sources (CSV, JSON, logs)
- Process: Use Spark to clean, transform, and aggregate the data
- Store: Write processed results to MongoDB and/or Cassandra
- Index: Create appropriate indexes in NoSQL databases for fast queries
- Analyze: Run Spark SQL queries and MLlib models on processed data
- Visualize: Generate dashboards with Matplotlib/Plotly from stored data
- Monitor: Track pipeline execution with Spark UI and logs
- Document: Record metrics, performance benchmarks, and insights