It is defined as the relation between two sets.
Terminology used to describe sets Relationship
Membership (∈)
Subsets (⊆)/ Supersets (⊇)
Disjoint Sets
NULL Set ( ∅ )
Family Sets
Power Sets ( P(set Name) )
2. SET RELATIONSHIP
• It is defined as the relation between two sets.
• Terminology used to describe sets Relationship
• Membership (∈)
• Subsets (⊆)/ Supersets (⊇)
• Disjoint Sets
• NULL Set ( ∅ )
• Family Sets
• Power Sets ( P(set Name) )
3. 1. Membership (∈): Membership happens when one element or a
set is found inside another set. This symbol is normally used in
describing a set.
For example:
{1, 2, 3} ∈ {6, 7, 8, 1, 2, 3}
2. Subsets (⊆)/ Supersets (⊇):If every member of set A is found
inside set B, then A is a subset of B (A ⊆ B). If set B has every
member of A and more then B is a super set of A (B ⊇ A).
For example:
A = {1, 2, 3}, B = {1, 2, 3, 4}, then A ⊆ B and also B ⊇ A
4. 3. Disjoint Sets: If every member of set A has no relation with set B and
vice versa then we say that A disjoint B.
There is no special symbol to show this relationship.
4. NULL Set ( ∅ ): Every universe or set or subset contains a NULL set. A
null set is an empty set ({ }) that carries no elements. We can say
that the NULL set is a subset for every set.
5. Family Sets: There are times when a set does not contain individual
elements but it contains many subsets. Conveniently this is call a
family set and is it describes using the curly bracket within a curly
bracket.
For example:
A = { {1, 2, 3, 4, 5} , {6, 7, 8, 9, 10} , {11, 12, 13, 14, 15} }
5. 6. Power Sets ( P(set Name) ): Remember that a set is a group that
may contain none or one (1) or more elements. A power set means
to show how many possible different ways to group all the
elements in a set. In other words power set is the set of all subsets
of a given set.
For example:
A = {1, 2, 3} , A has 3 elements, there is 8 possible ways to arrange this
(2)3 = 8.
P(A) = { ∅ , {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1, 2, 3} }
6. SET OPERATIONS
Terminology used to describe sets Operation
• Union (∪): Add in all elements that are found in both sets.
{a,e,i} ∪ {o, u} = {a, e, i, o, u}
• Intersect (∩): Show only elements that is found only in both sets.
{red, blue} ∩ {blue, yellow} = {blue}
• Difference (-): Also known as subtract, this show only elements that is
found in this set but NOT found in another sets.
{1, 2, 3, 4, 5} {1, 2, 3} = {4, 5}
7. • Complement (‘): Show only elements that is found in universal set but
NOT found in another sets.
U = {1, 2, 3, 4, 5, 6} and A = {1, 3, 5}. Then A' = {2, 4, 6}.
• Equality: Both sets must have exactly the same number of elements
with exactly the same value.
A={1, 2, 3} , B={2, 3, 1} therefore A = B
• Compatible: Two sets are compatible if all element in one of the set can
fit nicely inside another set.
A = {x, b} Z = {x, b, c} therefore A is compatible to Z
8. Use of set operation
• In formal language theory, a language is a set of strings and the study
of operations on languages is central. Some of these are the usual set
operations of intersection, union and complement.
• Databases are at the root of most applications. Databases are built to
process data in Sets, and the applications that use them negotiates
with the database in sets.
9. Set operation in RDBMS
• One of the primary applications is database query design and processing. All
queries onto RDBMS are in set notation and returned as sets.
• UNION operator in SQL Server acts as like as the union operation in
the Set Theory.
CREATE TABLE TABLE_A (FruitName VARCHAR(100))
INSERT INTO TABLE_A VALUES ('Apple'),('Orange'),('Strawberry'),('Lemon'),('Avocado')
CREATE TABLE TABLE_B (FruitName VARCHAR(100))
INSERT INTO TABLE_B VALUES ('Lemon'),('Avocado'),('Grapefruit'),('Apricot')
SELECT * FROM TABLE_A
UNION
SELECT * FROM TABLE_B
A = {Apple, Orange, Strawberry, Lemon, Avocado}
B = {Lemon, Avocado, Grapefruit, Apricot}
The union of the A and B sets will look as follow and it is denoted by A U B:
A U B = {Apple, Orange, Strawberry, Lemon, Avocado, Grapefruit, Apricot}
10. 1
2
3
SELECT * FROM TABLE_A
INTERSECT
SELECT * FROM TABLE_B
The INTERSECT operator implements the intersection logic of the Set
Theory to tables. Now, we will find the intersection of
the TABLE_A and TABLE_B with help of the following query:
A = {Apple, Orange, Strawberry, Lemon, Avocado}
B = {Lemon, Avocado, Grapefruit, Apricot}
A ∩ B = {Lemon, Avocado}
11. • In SQL Server, with the help of the EXCEPT operator, we can obtain
the difference between the two tables:
1
2
3
SELECT * FROM TABLE_A
EXCEPT
SELECT * FROM TABLE_B
A = {Apple, Orange, Strawberry, Lemon, Avocado}
B = {Lemon, Avocado, Grapefruit, Apricot}
A B = {Apple, Orange, Strawberry}
12. SIGMOID
• The Sigmoid Function curve looks like a S-shape.
• The main reason why we use sigmoid function is because it exists
between (0 to 1).
• it is especially used for models where we have to predict the
probability as an output.
• Since probability of anything exists only between the range of 0 and
1, sigmoid is the right choice.
13. USE OF SIGMOID
• A key area of machine learning where the sigmoid function is
essential is a logistic regression model. A logistic regression model is
used to estimate the probability of a binary event
• In logistic regression, a logistic sigmoid function is fit to a set of data
where the independent variable(s) can take any real value, and the
dependent variable is either 0 or 1.