0% found this document useful (0 votes)
4 views17 pages

Module 5 Important Questions

The document provides an overview of Machine Learning and Regression Analysis, detailing various types of regression including Simple Linear, Multiple Linear, Non-linear, Polynomial, Logistic, Ridge, Lasso, and Support Vector Regression. It also explains K-means clustering, Naive Bayes Theorem, text mining phases, web usage mining, the Apriori algorithm, and social network analysis using centralities and PageRank. Each section includes definitions, methodologies, examples, and applications relevant to the respective topics.

Uploaded by

Lavanya M G
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)
4 views17 pages

Module 5 Important Questions

The document provides an overview of Machine Learning and Regression Analysis, detailing various types of regression including Simple Linear, Multiple Linear, Non-linear, Polynomial, Logistic, Ridge, Lasso, and Support Vector Regression. It also explains K-means clustering, Naive Bayes Theorem, text mining phases, web usage mining, the Apriori algorithm, and social network analysis using centralities and PageRank. Each section includes definitions, methodologies, examples, and applications relevant to the respective topics.

Uploaded by

Lavanya M G
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

Module-5

…- Question from model paper

…- SuperIMP for IA

…- question from IA question bank

1 What is Machine Learning? Explain different types of Regression Analysis.

Machine Learning (ML) - Overview

• Definition: A subset of Artificial Intelligence (AI) focused on creating algorithms that learn
from data and make predictions.

• Core Idea: Uses statistical techniques to let machines improve over time on tasks without
explicit programming.

• Categories:

o Supervised Learning: Learns from labeled data (e.g., classification, regression).

o Unsupervised Learning: Works with unlabeled data (e.g., clustering, dimensionality


reduction).

o Reinforcement Learning: Learns via trial-and-error interactions with an


environment (e.g., game playing, robotics).

Regression Analysis - Overview

• Definition: A statistical method to estimate relationships among variables.

• Purpose: Predict a dependent variable based on one or more independent variables.

Types of Regression Analysis

1. Simple Linear Regression

• Definition: Models relationship between 1 independent variable and 1 dependent variable


using a straight line.

• Equation: y=mx+by = mx + b

• Goal: Minimize the error (difference between predicted and actual values).

• Use Case: Predicting salary based on years of experience.

2. Multiple Linear Regression

• Definition: Extension of simple linear regression using 2 or more independent variables.

• Equation: y=b0+b1x1+b2x2+...+bnxny = b_0 + b_1x_1 + b_2x_2 + ... + b_nx_n

• Purpose: Understand how each variable independently affects the outcome while keeping
others constant.
• Use Case: Predicting house price based on area, number of rooms, location, etc.

3. Non-linear Regression

• Definition: Models the relationship using a non-linear equation.

• When to Use: When data shows a curved pattern not captured by a straight line.

• Example: Growth of bacteria over time (exponential curve).

4. Polynomial Regression

• Definition: A special case of non-linear regression where the model is a polynomial function.

• Equation: y=b0+b1x+b2x2+...+bnxny = b_0 + b_1x + b_2x^2 + ... + b_nx^n

• Flexibility: Captures more complex curves in data.

• Use Case: Predicting temperature variation throughout the day.

5. Logistic Regression

• Definition: Despite the name, used for classification, not regression.

• Purpose: Predict probabilities for binary outcomes (e.g., 0 or 1).

• Function Used: Sigmoid (Logistic) function.

• Use Case: Spam email detection (spam or not spam).

6. Ridge and Lasso Regression

• Goal: Handle overfitting in linear models through regularization.

o Ridge Regression:

▪ Adds L2 penalty: square of coefficients.

▪ Effect: Shrinks coefficients but doesn't eliminate them.

▪ Use: When many features have small but non-zero effects.

o Lasso Regression:

▪ Adds L1 penalty: absolute value of coefficients.

▪ Effect: Can reduce some coefficients to zero (feature selection).

▪ Use: Useful when we suspect only a few features are important.

7. Support Vector Regression (SVR)

• Extension of SVM: Adapted for regression tasks.

• Key Idea: Fit the best function with a margin of tolerance (ε) around actual values.

• Focus: Tries to balance accuracy and margin tolerance.

• Use Case: Stock price prediction with a controlled error margin.


2 Explain with neat diagram K-means clustering.

K-Means Clustering
• Purpose: To partition a dataset into K distinct clusters, where each data point belongs to the
cluster with the nearest mean.
• Type: Unsupervised learning algorithm (no labeled output).
• Common Use Cases: Customer segmentation, image compression, document categorization.

How K-Means Works – Step-by-Step


1. Initialization
• Choose K: Decide the number of clusters K beforehand.
• Select Initial Centroids:
o Randomly pick K data points from the dataset as initial centroids.
o These centroids represent the center of clusters initially.

2. Assignment Step
• For Each Data Point:
o Compute the distance (usually Euclidean) to all centroids.
o Assign the point to the nearest centroid’s cluster.
• Goal: Group similar points based on closeness to centroid.

3. Update Step
• Recompute Centroids:
o For each cluster, calculate the mean of all its assigned data points.
o New centroid = average position of the points in the cluster.
• Centroid Shift: This step moves centroids towards the true center of their assigned points.

4. Repeat
• Iteration:
o Repeat the assignment and update steps.
• Stopping Criteria:
o Centroids stop changing significantly, OR
o A fixed number of iterations is reached.

5. Output
• Final Result:
o K clusters with assigned data points.
o The final centroids representing the center of each cluster.
• Interpretation: Each cluster groups similar data points, reducing intra-cluster variance.

Advantages
• Simple and fast to implement.
• Efficient on large datasets.
• Works well when clusters are well-separated and spherical.

Limitations
• Must specify K in advance.
• Sensitive to initial centroids – different initializations may lead to different results.
• Not ideal for non-spherical or overlapping clusters.
• Affected by outliers – extreme values can skew centroids.

Example
Imagine clustering customers based on annual income and spending score:
• K-means might group them into 3 clusters:
o Cluster 1: High income, high spenders.
o Cluster 2: Low income, low spenders.
o Cluster 3: Medium income, balanced spenders.

3 Explain Naive Bayes Theorem with example.


4 Explain five phases in a process pipeline text mining.
Text Mining is a rapidly evolving area of research. As the amount of social media and other text data
grows, there is need for efficient abstraction and categorization of meaningful information from the
text.

Text Mining Phases & Methods:

1. Text Pre-processing

Goal: Clean and prepare raw text data for further analysis.

• Tokenization:

o Definition: Splitting text into individual words or tokens.

o Example: "Text mining is useful" → ["Text", "mining", "is", "useful"].

• Normalization:

o Definition: Standardizing text (e.g., lowercasing).

o Example: "Text" → "text".

• Removing Stop Words:

o Definition: Eliminating commonly used words that carry little meaning.

o Examples: "the", "is", "and", "a".

• Stemming and Lemmatization:

o Stemming: Cuts words to root form by chopping suffixes.

▪ "playing" → "play"

o Lemmatization: Converts words to base dictionary form (considers context).

▪ "better" → "good"

2. Feature Extraction

Goal: Convert cleaned text into a numerical format suitable for modeling.

• Vectorization:

o Definition: Convert text to vectors using techniques like:


▪ TF-IDF (Term Frequency-Inverse Document Frequency)

▪ Bag of Words

▪ Word Embeddings (e.g., Word2Vec, GloVe)

o Example: "text mining useful" → [0.3, 0.5, 0.2]

• Identifying Key Phrases:

o Definition: Extract important terms or phrases.

o Example: From product reviews, extract "battery life", "camera quality".

3. Modeling

Goal: Apply analytical methods to understand or predict based on extracted features.

• Classification:

o Assign documents to predefined categories.

o Example: Email → Spam or Not Spam.

• Clustering:

o Group similar documents without labels.

o Example: Grouping news articles by topic.

• Sentiment Analysis:

o Detect emotion or opinion in text.

o Example: "The product is great!" → Positive sentiment.

4. Evaluation

Goal: Measure the performance of the text mining model.

• Performance Metrics:

o Precision: % of correct positive predictions.

o Recall: % of actual positives captured.

o F1-score: Harmonic mean of precision and recall.

o Example: For a sentiment model, check how well it identifies true positives.

• Cross-Validation:

o Definition: Split data into parts and test model on different subsets.

o Purpose: Ensure model is robust and generalizes well.


5. Analysis of Results

Goal: Derive actionable insights from the output.

• Visualizing Data:

o Create charts like word clouds, bar plots, heatmaps.

o Example: Visualize most common words in customer reviews.

• Using Results for Decision Making:

o Apply insights to:

▪ Improve marketing (e.g., identify customer pain points).

▪ Enhance services (e.g., detect frequent complaints).

▪ Automate responses (e.g., route support tickets by category).

Summary

Each phase—from raw text to insights—is essential and often iterative, ensuring continuous
refinement and better decision-making through structured text mining.

5 Explain Web Usage Mining.

Here is a point-wise, structured explanation of Web Usage Mining, covering all key phases and
applications, with bolded keywords for clarity:

Definition

• Web Usage Mining: A subfield of data mining focused on analyzing user behavior based on
web usage data.

• Purpose: Understand how users interact with websites to improve user experience, site
design, and marketing.

Phases of Web Usage Mining


1. Pre-processing

• Goal: Convert raw web log data into a clean, structured format for analysis.

• Data Sources: Web server logs, browser logs, proxy server logs, cookies.

• Key Information Extracted:

o IP Address of the user

o Pages visited

o Timestamp of access

• Steps Involved:

o Data Cleaning: Remove irrelevant records (e.g., image file requests).

o User Identification: Identify unique users (based on IP, cookies).

o Session Identification: Segment data into user sessions (based on time gaps).

o Path Completion: Fill in missing pages caused by caching or proxy issues.

2. Pattern Discovery

• Goal: Apply algorithms to find patterns in the processed data.

• Techniques Used:

o Clustering: Group similar users based on behavior.

▪ Example: Users who follow similar navigation paths.

o Classification: Predict user behavior based on past patterns.

▪ Example: Predict if a user will make a purchase.

o Association Rule Mining: Discover frequently co-visited pages.

▪ Example: "Users who visited page A also visited page B."

o Sequential Pattern Mining: Identify common clickstream paths.

▪ Example: Homepage → Product Page → Cart → Checkout.

3. Pattern Analysis

• Goal: Interpret discovered patterns to derive actionable insights.

• Techniques Used:

o Visualization: Graphs, charts, or heatmaps for usage trends.

o Query Mechanisms: SQL-like queries on mined patterns.

o Summarization: Highlight key insights from large pattern sets.


• Insights Gained:

o Peak usage times

o Most/least visited pages

o Typical navigation paths

o User preferences and interests

Applications of Web Usage Mining

1. Website Optimization

• Description: Improve site structure, layout, and content.

• Example: Rearranging menus based on user click patterns.

2. Targeted Marketing

• Description: Customize marketing campaigns based on user interest.

• Example: Recommending products based on past visits.

3. Fraud Detection

• Description: Identify unusual behavior that may indicate fraud.

• Example: Detect multiple failed login attempts from the same IP.

6 Apply and Illustrate the Apriori algorithm to evaluate candidate key with suitable example.

Here's a structured and concise explanation of the Apriori Algorithm with clear steps and
explanations:

Overview
• Goal: Discover frequent itemsets and generate association rules.
• Input: Transaction database, minimum support threshold.
• Key Principle: Uses the Apriori property – all subsets of a frequent itemset must also be
frequent.

Key Terms
• Ck: Candidate itemsets of size k
• Fk: Frequent itemsets of size k

Apriori Algorithm: Step-by-Step

1. Initialization (k = 1)
• Scan database to count support of individual items.
• F₁ = All items with support ≥ min_support.

2. Candidate Generation (Cₖ₊₁)


• Join Step:
o Join Fk with Fk to form Cₖ₊₁ (e.g., join {A, B} with {A, C} → {A, B, C}).
• No transaction scan during this step.

3. Pruning
• Subset Check:
o For each candidate in Cₖ₊₁, check if all (k-sized) subsets exist in Fk.
o Example:
▪ Candidate = {A, B, C}
▪ Check if {A, B}, {A, C}, and {B, C} are all in Fk.
▪ If not, discard it.

4. Counting Support
• For each transaction t:
o Identify which candidates from Cₖ₊₁ are subsets of t.
o Increment their count.

5. Filtering Frequent Itemsets


• Fk+1 = All candidates in Cₖ₊₁ with support ≥ min_support.
• Repeat steps for next k until Fk+1 is empty.

Important Properties Used


• Downward Closure Property:
o If an itemset is not frequent, its supersets can’t be frequent.
• Efficiency Gain:
o Avoids checking all itemsets by pruning early.
o Reduces search space.

Example (Simplified)
• Transactions:
T1: A, B, C
T2: A, C
T3: A, D
T4: B, C
T5: A, C, D
• min_support = 2
1. F1: {A, B, C, D} → all occur ≥2 times
2. C2: {A,B}, {A,C}, {A,D}, {B,C}, {C,D}
3. F2: Keep only those with support ≥2
4. C3: Generate {A,C,D} (only if all pairs {A,C}, {A,D}, {C,D} are in F2)
5. Prune if any subset not in F2

7 Define Web Mining. Discuss the broad classification of web mining and their application

Web Mining: Definition

• Web Mining is the process of using data mining techniques to extract useful knowledge or
patterns from web data.

• Web data can include:

o Web documents (HTML, text)

o Web structure (links, graphs)

o Web usage data (logs, clicks, sessions)

Key Activities in Web Mining

1. Content Extraction

• Goal: Extract meaningful fragments from web pages.

• Example: Getting the main article content from a news webpage, ignoring ads/menus.

2. Web Structure Mining

• Goal: Analyze the link structure of the web (treated as a graph).


• Tasks:

o Discover interesting graph patterns.

o Compute metrics like PageRank, HITS, etc.

3. Web Usage Mining

• Goal: Analyze user behavior from web logs.

• Tasks:

o User identification (who is the user?)

o Session creation (track user's click sequence)

o Malicious activity detection (bots, attacks)

o Usage path extraction (most common click paths)

8 Define social network. Identify and explain the parameters in social graph network
topological analysis using centralities and Page Rank.

Social Network Definition:

A social network is a structure consisting of nodes (individuals or organizations) connected by edges


representing relationships such as friendship, kinship, financial exchanges, beliefs, etc. These
networks can be analyzed using various metrics to understand the dynamics between individuals and
their social interactions.

Parameters in Social Graph Network Topological Analysis using Centralities and PageRank:

Social Network as Graphs

• Nodes: Individuals or organizations.

• Edges: Connections between nodes representing relationships such as friendship, kinship,


etc.

• Graph analysis provides metrics to evaluate network properties, including degree, closeness,
betweenness, clustering, etc.

1. Degree:

o Definition: The total number of edges connected to a vertex.

o In-degree: Number of incoming edges (edges from other vertices to the node).

o Out-degree: Number of outgoing edges (edges directed from the node to other
vertices).

o Example:

▪ In a social network, a person with 5 friends has a degree of 5.


▪ If 5 people follow them, their in-degree is 5.

2. Closeness Centrality:

o Definition: Measures how close a vertex is to all other vertices in the network.

o Formula:

o Interpretation: Vertices with high closeness centrality can reach all other vertices
quickly.

o Effective Closeness: Uses an approximate average distance instead of exact shortest


paths to reduce computation time in large networks.

3. Betweenness Centrality:

o Definition: Measures how often a vertex lies on the shortest path between pairs of
other vertices.

o Formula:

o Interpretation: High betweenness centrality indicates that the node acts as a bridge
between different parts of the network.

4. PageRank:

o Definition: A ranking metric that measures the importance of a vertex based on the
number and quality of incoming edges.

o Interpretation: A vertex with many incoming edges from important nodes will have a
high PageRank.

o Example: In a social network, a person followed by many influential people will have
a higher PageRank.

5. Contacts Size:

o Definition: Refers to the number of connections a vertex has to other vertices.

o Interpretation: A node with many connections has a large contact size, but this does
not necessarily imply influence or importance on its own.

o Example: A social media influencer may have a large contact size, but their influence
is measured by centrality metrics, not just the number of followers.
9 Demonstrate frequent set mining and association rule mining.
1. Frequent Itemset Mining (FIM):
o Definition: Discovering itemsets (sets of items) that appear together frequently in a
dataset.
o Example:
▪ Dataset of CS students’ courses: {Python, Big Data Analytics} is frequently
chosen together by students.
o Steps:
▪ Identify itemsets that appear frequently (above a certain support threshold).
▪ Support: Proportion of transactions in which the itemset appears.
Example Scenario:
Consider a shopping dataset where transactions contain the following items:
o Transaction 1: {Milk, Bread, Butter}
o Transaction 2: {Milk, Butter}
o Transaction 3: {Bread, Butter}
o Transaction 4: {Milk, Bread}
Step 1: Identify frequent 1-itemsets.
o Milk appears in 3 out of 4 transactions → Frequent.
o Bread appears in 3 out of 4 transactions → Frequent.
o Butter appears in 3 out of 4 transactions → Frequent.
Step 2: Identify frequent 2-itemsets.
o {Milk, Bread} appears in 2 out of 4 transactions → Frequent.
o {Milk, Butter} appears in 2 out of 4 transactions → Frequent.
o {Bread, Butter} appears in 2 out of 4 transactions → Frequent.
Step 3: Identify frequent 3-itemsets.
o {Milk, Bread, Butter} appears in 1 out of 4 transactions → Not frequent (support <
threshold).
2. Association Rule Mining:
o Definition: Finds relationships between frequently occurring items in large datasets
(e.g., "If a person buys item A, they are likely to buy item B").
o Purpose: Discover rules that predict the occurrence of an item based on the
occurrence of other items.
o Mahout Algorithm: A parallelized algorithm used to identify co-occurring items using
frequent pattern growth.
Example of Association Rule:
o From the frequent itemsets identified above, an association rule might be:
▪ Rule: {Milk} → {Bread} (If a person buys Milk, they are likely to buy Bread)
▪ Support: The percentage of transactions that contain both Milk and Bread.
▪ Confidence: The percentage of transactions with Milk that also contain
Bread.
3. Apriori Algorithm (for Frequent Itemsets and Association Rules):
o Principle:
▪ Apriori Principle: If an itemset is frequent, all its subsets must also be
frequent.
▪ Example: If {A, B, C} is frequent, subsets {A}, {B}, {C}, {A, B}, {B, C}, {A, C} must
also be frequent.
o Process:
▪ Step 1: Generate candidate itemsets (starting with individual items).
▪ Step 2: Calculate support for each itemset and prune non-frequent itemsets.
▪ Step 3: Expand frequent itemsets to larger itemsets (k-itemsets to (k+1)-
itemsets).
Example: Given transactions:
o Transaction 1: {A, B, C}
o Transaction 2: {A, C}
o Transaction 3: {A, B}
o Transaction 4: {B, C}
Step 1: Identify frequent 1-itemsets.
o {A}, {B}, {C} appear in at least 2 transactions → Frequent.
Step 2: Identify frequent 2-itemsets.
o {A, B}, {A, C}, {B, C} appear in at least 2 transactions → Frequent.
Step 3: Identify frequent 3-itemsets.
o {A, B, C} appears in 1 transaction → Not frequent.
4. Evaluation of Candidate Rules:
o Support: Measures the frequency of the rule in the dataset.
▪ Example: {Milk} → {Bread} appears in 2 transactions out of 4 → Support =
2/4 = 0.5.
o Confidence: Measures the likelihood that the rule holds true.
▪ Example: For the rule {Milk} → {Bread}, if Milk appears in 3 transactions and
Bread in 2, then confidence = 2/3 ≈ 0.67.
o Lift: Measures the strength of the rule, considering the frequency of both items.
▪ Example: Lift = Confidence / (Support of Milk * Support of Bread).

Steps for Frequent Itemset Mining & Association Rule Mining:


1. Identify Frequent Itemsets:
o Calculate support for various itemsets.
o Identify frequent itemsets that appear above the support threshold.
2. Generate Association Rules:
o For each frequent itemset, generate possible association rules.
o Calculate support, confidence, and lift for each rule.
3. Evaluate the Rules:
o Select the rules with high confidence and lift for further use in applications (e.g.,
market basket analysis, recommendation systems).

You might also like