attributes
attributes
Types of Attributes
Qualitative Attributes
These attributes represent categories and do not have a meaningful numeric
interpretation. Examples include gender, color, or product type.
The types of Qualitative attributes are nominal, ordinal or binary attributes.
Nominal Attributes
• Nominal means "relating to names" . The utilities of a nominal attribute are sign or
title of objects . Each value represents some kind of category, code or state, and so
nominal attributes are also referred to as categorical.
• Example : Suppose that skin color and education status are two attributes of
expressing person objects. In our implementation, possible values for skin color are
dark, white, brown. The attributes for education status can contain the values-
undergraduate, postgraduate, matriculate.
Binary Attributes
• A binary attribute is a category of nominal attributes that contains only two classes: 0
or 1, where 0 often tells that the attribute is not present, and 1 tells that it is existing.
Binary attributes are mentioned as Boolean if the two conditions agree to true and
false.
• Example - Given the attribute drinker narrate a patient item, 1 specify that the drinker
drinks, while 0 specify that the patient does not. Similarly, suppose the patient
undergoes a medical test that has two practicable outcomes.
Ordinal Attributes
• Ordinal data is a type of categorical data that possesses a meaningful order or ranking
among its categories, yet the intervals between consecutive values are not consistently
measurable or well-defined.
• Example -In the context of sports, an ordinal data example would be medal rankings
in a competition, such as gold, silver, and bronze.
Quantitative Attributes
A numeric attribute is calculable, that is, it is a quantifiable amount that constitutes
integer or real values. Numeric attributes can be of two types as follows: Interval- scaled, and
Ratio - scaled.
Interval - Scaled Attributes
• Interval - scaled attributes are calculated on a lamella of uniform- size units. The
values of interval-scaled attributes have order and can be positive, 0, or negative.
Thus, in addition to providing a ranking of values, such attributes allow us to compare
and quantify the difference between values.
• Example - A temperature attribute is an interval - scaled. We have different
temperature values for every new day, where each day is an entity. By sequencing the
values, we obtain an arrangement of entities with reference to temperature. In
addition, we can quantify the difference in the value between values, for example, a
temperature of 20 degrees C is five degrees higher than a temperature of 15 degrees
C.
Ratio - Scaled Attributes :
• A ratio - scaled attribute is a category of a numeric attribute with imminent or fix zero
points. In inclusion, the entities are structured, and we can also compute the difference
between values, as well as the mean, median, and mode.
• Example - The Kelvin (K) temperature scale has what is contemplated as a true zero
point. It is the point at which the tiny bits that consist of matter has zero kinetic
energy.
Data Types
Numerical Data
Numerical data represents measurable quantities and is further divided into:
• Integer (int)
Whole numbers without fractions. It Used in counting, indexing, IDs, and discrete
values. Examples: 0, 1, -10, 205
Use cases:
▪ Counting occurrences (frequency counts)
▪ Loop iterations and indexing in data structures
▪ Discrete variables in machine learning (like number of purchases)
• Float (float)
Numbers with decimal points. It Can represent continuous values. Examples: 3.14,
-0.001, 2.71828
Use cases:
▪ Statistical analysis (mean, variance, standard deviation)
▪ Continuous features in regression models
▪ Sensor readings, stock prices, probabilities
• Complex Numbers
Numbers with real and imaginary parts. Examples: 2 + 3j, -1 + 0.5j
Use cases:
▪ Fourier transforms
▪ Scientific computations in engineering datasets
Categorical (Qualitative) Data
Categorical data represents labels, groups, or types. It cannot be directly used in
mathematical operations without encoding.
• Nominal Data
Categories without any natural order. Examples: Colors: Red, Green, Blue,Fruit types:
Apple, Banana, Orange and Country names: USA, India, Brazil.
Use cases:
▪ One-hot encoding for machine learning models
▪ Counting frequencies, pie charts
• Ordinal Data
Categories with a meaningful order but unequal intervals. Examples: Education level:
High School < Bachelor < Master < PhD,Ratings: Poor < Average < Good < Excellent and
Customer satisfaction: 1-5 stars.
Use cases:
▪ Label encoding for ML models
▪ Ranking analysis and correlation studies
Text (String) Data
Strings represent textual data or sequences of characters.
Examples:
"New York", "Data Science", "ID_12345"
Use cases:
▪ Natural Language Processing (NLP) tasks: sentiment analysis, text classification
▪ Cleaning and preprocessing data: removing punctuation, lowercasing, tokenization
▪ Feature extraction: word counts, TF-IDF
Boolean (Logical) Data
Boolean data has two possible values: True or False.
Examples:
True, False, 1 (True), 0 (False)
Use cases:
▪ Filtering datasets (e.g., df[df['Age'] > 18])
▪ Binary classification problems
▪ Logical operations in conditional statements
Structured Data
Data with rows and columns, typically stored in databases or spreadsheets.
Examples:
▪ SQL tables, Excel spreadsheets, CSV files
▪ Columns: Name, Age, Salary
Use cases:
▪ Tabular data analysis with Pandas or SQL
▪ Machine learning with structured features
▪ Aggregation, pivot tables, and group-by operations
Unstructured Data
Data without a predefined schema, often large and heterogeneous.
Examples:
▪ Text documents, PDFs, emails
▪ Images, videos, audio files
▪ Social media posts
Use cases:
▪ NLP: sentiment analysis, document classification
▪ Computer vision: image recognition, object detection
▪ Speech recognition and audio processing
Semi-Structured Data
Data that has some organization but not strictly tabular.
Examples:
▪ JSON, XML, HTML, log files
▪ Key-value stores
Use cases:
▪ Data from APIs or web scraping
▪ Big data processing in NoSQL databases
▪ Flexible ingestion into data pipelines
[Link] BAYES IN R
Naive Bayes Classifier is a machine learning algorithm used to classify data into
categories. It uses Bayes' Theorem to calculate the probability of each class based on the
input features. It assumes that all features are independent of each other.
Where:
• P(A|B) = Conditional probability of A given B.
• P(B|A) = Conditional probability of B given A.
• P(A) = Probability of event A.
• P(B) = Probability of event B.
For many predictors, we can formulate the posterior probability as follows:
P(A∣B)=P(B1∣A)⋅P(B2∣A)⋅P(B3∣A)⋅P(B4∣A)⋯P(A∣B)=P(B1∣A)⋅P(B2∣A)⋅P(B3∣A)⋅P(B4∣A)⋯
[Link]("e1071")
[Link]("caTools")
[Link]("caret")
library(e1071)
library(caTools)
library(caret)
data(iris)
head(iris)
[Link](123)
split <- [Link](iris, SplitRatio = 0.7)
train_cl <- subset(iris, split == TRUE)
test_cl <- subset(iris, split == FALSE)
6. Making Predictions
We use the trained model to predict species on the test data.
• predict(): Uses the trained classifier to predict the target variable (Species) for the test
data (test_cl). The predicted values are stored in the y_pred variable.
Machine Learning (ML) and Deep Learning (DL) are two core branches of Artificial
Intelligence (AI) that focus on enabling computers to learn from data. While both are used
to make predictions and automate decision-making, they differ in how they process data
and the complexity of models they use.
Machine Learning
Machine Learning is a branch of Artificial Intelligence that enables computer systems to
learn patterns from data and make predictions or decisions without being explicitly
programmed by humans.
• Works with smaller datasets.
• Requires manual feature extraction.
• Easier to interpret and implement.
• Best for structured data like tables or CSV files.
Applications:
1. Spam Emails: Detecting spam emails or fraudulent transactions.
2. Recommendation Systems: Building recommendation systems for movies, products or
content.
3. Analytics: Predictive analytics in finance, healthcare and marketing.
Deep Learning
Deep Learning uses artificial neural networks with multiple hidden layers that can
automatically learn complex patterns from raw data like images, sound, and text. It’s used
in applications such as image recognition, natural language processing, and speech
recognition.
• Learns features automatically from data.
• Performs better with large datasets.
• Needs GPUs or TPUs for training.
• Best for unstructured data such as images, audio or text.
• Used in complex applications like self-driving cars or chatbots.
Types of Deep Learning
Deep learning encompasses various architectures, each suited to different types of tasks:
1. Convolutional Neural Networks: Used for image processing tasks, CNNs are designed
to adaptively learn spatial hierarchies of features through convolutional layers.
2. Recurrent Neural Networks: Ideal for sequential data. RNNs have loops that allow
information to persist, effective for tasks like speech recognition and language
modeling.
3. Long Short-Term Memory Networks: A type of RNN that addresses the vanishing
gradient problem. They are used for complex sequences including text and speech.
4. Generative Adversarial Networks: GANs consist of two neural networks that are
generator and discriminator that compete against each other, creates synthetic data such
as images.
5. Transformers: Handles long-range dependencies in data. They are the backbone of
models like GPT and BERT, used in natural language processing.
Applications
1. Object Detection: Recognizing objects and faces in images or videos.
2. Natural Language Processing: Converting spoken language into text and understanding
speech commands.
3. Autonomous Vehicle: Enabling autonomous vehicles to perceive and navigate their
environment.
Data Works well with small to medium Requires large datasets for
Requirement datasets. effective learning.