0% found this document useful (0 votes)
14 views6 pages

Spark and Big Data Analytics Overview

The document provides an overview of Apache Spark, highlighting its features such as in-memory computing and support for various data types. It also explains the differences between Spark SQL and Pandas for data analysis, outlines the five-layer architecture of Spark Stack, and details the text mining process along with web mining types. Additionally, it covers the PageRank algorithm, its calculations, and the concept of rank source addition to prevent dead ends.

Uploaded by

bhavana632005
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views6 pages

Spark and Big Data Analytics Overview

The document provides an overview of Apache Spark, highlighting its features such as in-memory computing and support for various data types. It also explains the differences between Spark SQL and Pandas for data analysis, outlines the five-layer architecture of Spark Stack, and details the text mining process along with web mining types. Additionally, it covers the PageRank algorithm, its calculations, and the concept of rank source addition to prevent dead ends.

Uploaded by

bhavana632005
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

BDA MODULE – 5

Spark and Big Data Analytics: Spark, Introduction to Data Analysis with Spark.

Text, Web Content and Link Analytics: Introduction, Text Mining, Web Mining, Web Content and Web
Usage Analytics, Page Rank, Structure of Web and Analyzing a Web Graph.

TB2: Ch5: 5.2,5.3, Ch 9: 9.1-9.4

What is Apache Spark? Explain its features


Apache Spark is a fast data processing engine that works with big data and runs programs up to 100× faster.
It works with HDFS data, uses simple code, and is used for analytics, machine learning, etc.

Features of Apache Spark:

1. Spark can build complex applications and works up to 100× faster using in-memory
computing.
2. It uses memory first and stores data on disk only when needed.
3. It can load data directly from database for immediate use.
4. It reads data very fast from memory or disk cache.
5. Spark uses RDDs, which are safe distributed data collections.
6. It can process structured, semi-structured, and unstructured data.
7. It supports more operations than just Map and Reduce.
8. It provides the optimization of the queries.
9. It provides simple APIs in Scala, Java, and Python.
[Link] offers an interactive shell for easy data analysis and learning.

Difference between SparkSQL and Pandas for data analysis.

Aspect Spark SQL Pandas

What it is Big-data SQL tool in Spark Python data analysis library

Data size Handles very large data Handles small data


Machine use Uses many machines Uses one machine
Storage Disk + memory Memory only
Speed Fast for big data Fast for small data
Data type Structured data Structured data
Main use Big-data analytics, ETL Data cleaning, analysis
Visualization Needs other tools Built-in plotting support
Explain Five-Layer Architecture of Spark Stack
Five-Layer Architecture of Spark Stack are:

1. Application Support Layer


o Contains tools like Spark SQL, Spark Streaming, SparkR, and Spark MLlib.
o Spark SQL → runs SQL queries on structured data.
o Spark Streaming → processes real-time data.
o SparkR → allows using Spark with R language.
o Spark MLlib → provides machine learning algorithms.
2. Spark Core Layer
o The main engine of Spark.
o Manages task execution, memory, fault tolerance, and RDDs.
3. Data Storage Layer
o Provides input data to Spark.
o Supports sources like HDFS, Hive, Cassandra, etc.
4. Resource Management Layer
o Uses YARN to manage cluster resources and job scheduling.
5. General Spark Stack Layer
o Makes Spark flexible and high-performance.
o Supports in-memory computing and faster data processing.
Explain Text Mining Process
Text mining is the process of deriving meaningful insights and knowledge from unstructured textual data. The
process involves multiple steps to clean, process, analyze, and interpret text. The key steps in the text mining
process are:

Phase 1: Text Pre-processing: Cleans and prepares text for analysis. Steps include:

1. Text cleanup – Remove unwanted information, fix typos, remove outliers, handle missing values, and
clean URLs.
2. Tokenization – Split text into words or tokens for better analyzing.
3. POS Tagging – Label each word with its part of speech (noun, verb, etc.)
4. Word Sense Disambiguation – Determine the correct meaning of a word with multiple meanings based
on context.

Phase 2: Feature Generation: Convert text into features for analysis. Includes:

1. Bag of Words (BoW) – It groups the words with their respective frequencies.
2. Stemming – Reduce words to their root form (e.g., “speaking,” “speaks” → “speak”).
3. Stop Word Removal – Remove common words like “a,” “the,” “in” that do not add meaning.
4. Even uses Vector Space Model (VSM) & TF-IDF

Phase 3: Features Selection : Analyze features to find patterns. Methods include:

1. Classification – Automatically put text into categories (like spam or news).


2. Trend Detection – Find important or changing topics in text over time.

Phase 4: Data Mining : Derive meaningful insights from the patterns and classifications. For
example, summarize trends, highlight key topics, etc. This phase converts patterns into useful
information for making decisions.

Phase 5: Analyzing Results : Evaluate and use the results, Check if results are correct and
useful.

1. Visualization – Create charts or visuals to present insights.


2. Interpretation – Understand what the results mean.

Application: After data mining, the results are sent to the application for use.
Explain Web Mining and its types web content, structure and usage
mining.
Web data includes:

1. Web content – text, images, audio, video, tables, and records


2. Web structure – hyperlinks and HTML tags
3. Web usage – HTTP logs and application server logs

Web mining refers to the use of techniques and algorithms that extract knowledge from web data
available in the form of web documents.

➢ Types of Web Mining (Web Mining Taxonomy)


Web mining is broadly classified into three types based on the type of web data mined:

1. Web Content Mining


2. Web Structure Mining
3. Web Usage Mining

1. Web Content Mining


Web Content Mining is the process of extracting useful information from the contents of web documents
available on the World Wide Web.

The content may include:

• Text, Images, Audio and video


• Structured data such as lists and tables

Web content mining can be done by Direct mining of web document and Mining through search engines (faster
than direct mining)

2. Web Structure Mining


Web Structure Mining is the process of discovering structural information from the web by analyzing the links
between web pages.

Types of Structure Information

1. Hyperlinks
o Intra-document hyperlinks (within the same page)
o Inter-document hyperlinks (between different pages)
2. Document Structure
o Web pages are represented as nodes
o Hyperlinks are represented as edges
o Together they form a web graph
Purpose

• Identify relationships between web pages


• Discover important pages using link analysis (e.g., PageRank)
• Analyze the structure of the web graph

3. Web Usage Mining


Web Usage Mining is the application of data mining techniques to discover interesting usage patterns from
web usage data.

It analyzes user behavior based on how users interact with web resources.

Sources of Web Usage Data

1. Web Server Logs: IP address, Page accessed, Access time


2. Application Server Logs
o Logs maintained by application servers
o Useful for troubleshooting and service analysis
3. Application Level Logs
o Records events generated by application software
o Used for auditing and understanding system activities

Purpose

• Analyze click streams


• Identify user sessions and browsing patterns
• Detect malicious activities
• Discover frequently accessed paths

PageRank Algorithm using Relative Authority of Linked Pages


PageRank Algorithm (Simple Explanation):

• PageRank is used by Google to rank web pages.


• It checks how many pages link to a page.
• Links from important pages increase the rank more.
• Pages with more good-quality links get a higher rank.
• It helps search engines show useful pages first.

Link Terms in PageRank:

• In-degree (Visibility): Number of links coming into a page.


• Out-degree (Luminosity): Number of links going out from a page.
• A page with more in-links than out-links is usually more important.
➢ Assumptions and Notations
Let:

• Pgv be page v whose rank is to be calculated.


• PA(v) be the set of parent pages (in-links) of page v.
• R(v) be the PageRank of page v.
• R(u) be the PageRank (authority) of parent page u.
• ch(u) be the number of out-links (children) of page u.
• nc be the normalization constant (sum of ranks equals 1).

➢ PageRank Formula (Relative Authority)


The PageRank of page v is calculated as:

Meaning:

• PageRank of v is the sum of contributions from all its parent pages.


• Contribution from each parent page is:
o Directly proportional to the rank of the parent R(u).
o Inversely proportional to the number of out-links of that parent ch(u).

➢ Rank Source Addition (Random Jump)


To avoid dead ends (pages with no out-link s), a rank source E(v) is added.

• E(v) is a fixed fraction α of the rank added to every page.


• It represents the probability that a user jumps to a page randomly.

The modified PageRank equation becomes:

Where:

• α is the damping factor.


• nc normalizes the rank values.

Common questions

Powered by AI

Web structure mining determines the importance of web pages by analyzing the relationship and structure formed by hyperlinks between them. Hyperlinks serve as important cues for identifying relationships, with intra-document and inter-document links providing information on how pages are connected. The discovery of these links allows for the generation of a web graph, where pages represented as nodes and links as edges are analyzed for patterns. Techniques like link analysis (e.g., PageRank) utilize the quantity and quality of in-links and out-links to estimate a page's authority and importance, providing insight into how information flows across the web .

The random jump addition in the PageRank algorithm, often implemented as a damping factor, is necessary to address the issue of dead ends, or pages with no out-links. By adding a fixed fraction of rank—representing the probability of a user randomly jumping to any page—the algorithm ensures that all pages maintain at least some minimal rank. This prevents the PageRank from falling into traps where pages become sink nodes with no further page to point to, maintaining continuity in the web graph and ensuring the stability of PageRank distribution across pages .

Feature generation in text mining transforms textual data into analyzable features by utilizing several key techniques. These include the Bag of Words model, which counts word frequencies; stemming, which reduces words to their root form; stop word removal, which filters out common but non-informative words; and the Vector Space Model (VSM) in conjunction with TF-IDF (Term Frequency-Inverse Document Frequency), which weighs terms based on their importance in a document relative to a corpus. These processes convert unstructured text into structured, numerical data that can be used for further analysis like classification and trend detection .

The resource management layer in the Spark Stack is crucial for managing computational resources across clusters and for efficient job scheduling. It specifically uses YARN (Yet Another Resource Negotiator) to handle these tasks. YARN manages resources within a Hadoop ecosystem, allowing Spark applications to share resources effectively with other applications running on the same cluster. The use of YARN ensures that Spark can scale with large datasets and manage the distribution of resources based on task requirements, thereby optimizing performance across the entire cluster operation .

Visualization in the final phase of the text mining process plays a critical role in conveying complex insights derived from data analysis. It involves creating charts, graphs, and other visual representations that help present patterns and findings in an accessible and understandable format. This visualization aids in interpretation by highlighting key trends and relationships, making it easier for stakeholders to comprehend and act upon the insights. Effective visualization transforms abstract data patterns into actionable intelligence, thereby enhancing decision-making processes by providing clarity and context to the analyzed data .

The PageRank algorithm calculates the rank of a web page based on the authority of its linked pages by adding up contributions from all its parent pages (in-links). Each contribution is directly proportional to the rank of the parent page and inversely proportional to the number of out-links the parent has, encouraging a more even distribution of PageRank. The algorithm assumes that links from higher-ranking pages contribute more significantly. Additionally, a random jump factor, represented by a damping factor α, is incorporated to account for dead ends and simulate a user randomly jumping to a page, ensuring connectivity and non-zero rank across the web graph .

The Spark Stack architecture is composed of five primary layers: 1) Application Support Layer, which includes tools like Spark SQL for structured data querying, Spark Streaming for real-time processing, SparkR for R integration, and Spark MLlib for machine learning algorithms; 2) Spark Core Layer, which serves as the main engine managing task execution, memory, fault tolerance, and RDDs (Resilient Distributed Datasets); 3) Data Storage Layer, which supplies input data to Spark and supports various data sources like HDFS and Hive; 4) Resource Management Layer, which utilitzes YARN for managing cluster resources and job scheduling; 5) General Spark Stack Layer, making Spark flexible and enabling high-performance through in-memory computing .

Spark SQL is designed as a big-data SQL tool within the Spark ecosystem, capable of handling very large datasets utilizing multiple machines and a combination of disk and memory storage. It is primarily used for big-data analytics and ETL processes. In contrast, Pandas is a Python data analysis library intended for smaller data volumes, operating on a single machine with memory-only storage. Pandas excels in data cleaning and analysis tasks with built-in plotting support for visualization but lacks the scalability of Spark SQL for large-scale operations .

The text mining process offers substantial implications for modern data-driven decision-making. It involves cleaning, processing, and analyzing unstructured textual data to extract meaningful patterns and insights. By converting text data into structured features and mining these for trends and classifications, organizations can summarize key topics and detect trends over time. This facilitates more informed strategic decisions by providing insights into public sentiment, emerging trends, and potential market shifts. The ability to visualize and interpret results allows stakeholders to make timely and effective decisions based on data-driven evidence .

Apache Spark utilizes in-memory computing to significantly enhance data processing speeds, working up to 100× faster compared to traditional disk-based processing. It does so by first using memory to handle data operations and only resorts to disk storage when absolutely necessary. This approach minimizes read-and-write operations to disk, which are typically time-consuming. The implications for big data analytics are profound as it allows for more complex computations to be performed quickly and efficiently, thus enabling real-time processing and analysis of large data sets .

You might also like