Sample Problems for PJWSTK students (2008):
Problem 1.
Assume that {Table 1, Table 2} represents distributed knowledge system. Find objects in Table2
satisfying the query q = (a,2)*(d,2)*(g,0). For a definition of a non-local attribute contact Table1.
If possible, assign the confidence to all objects retrieved.
a
x1
1
x2
3
x3
1
x4
2
x5
3
x6
3
x7
2
Table 1.
c
2
2
2
1
2
1
1
d
1
2
1
2
2
2
2
(d,2)*={2,4,5,6,7},
(a,2)*={4,7}< (d,2)* , (a,2) => (d,2) zauf=1
(a,3)*={2,5,6}< (d,2)* , (a,3) => (d,2) zauf=1
(c,1)*={4,6,7}< (d,2)* , (c,1) => (d,2) zauf=1
(c,2)*={1,2,3,5}, (c,2) => (d,2) zauf= 2/4
q = (a,2)*(d,2)*(g,0) > q = (a,2)*[(a,2) + (a,3) +(c,1) + (c,2)]*(g,0)=
1
1
1
2/4
(a,2)*(g,0)+ (a,2)*(c,1)*(g,0)+(a,2)*(c,2)*(g,0) = (a,2)*(g,0)
1
1
½
y2,y5,y7
a
y1
1
y2
2
y3
1
y4
1
y5
2
y6
2
y7
2
Table 2.
e
1
1
2
1
1
1
2
c
2
2
2
1
2
1
1
g
1
0
1
1
0
1
0
Problem 2.
Use LERS, CART, ID3, & RSES strategy to find rules describing D in terms of A, B, C from
the table below.
X
x1
x2
x3
x4
x5
A
1
0
2
0
1
B
0
0
0
0
2
C
1
1
2
2
1
D
1
2
1
2
1
LERS:
(d,2)*={2,4}, (d,1)*={1,3,5}
(a,0)*={2,4}<(d,2)*, (a,1)*={1,5}<(d,1)*, (a,2)*={3}<(d,1)*
(b,0)*={1,2,3,4}, (b,2)*={5}<(d,1)*
(c,1)*={1,2,5}, (c,2)*={3,4}
[(b,0)*(c,1)]*={1,2}, [(b,0)*(c,2)]*=(c,2)*
(a,0) => (d,2) zauf=1, (a,1) => (d,1) zauf=1, (a,2) => (d,1) zauf = 1
(b,0) => (d,1) zauf = 2/4, (b,0) => (d,2) zauf=2/4
(b,2) => (d,1) zauf = 1, (c,1) => (d,1) zauf= 2/3, (c,1) => (d,2) 1/3
(c,2) => (d,1) zauf = 1/2 (c,2) => (d,2) zauf = ½
(b,0)*(c,1) => (d,1) zauf=1/2, (b,0)*(c,1) => (d,2) zauf=1/2
X
x1
x2
x3
x4
x5
A
1
0
2
0
1
B
0
0
0
0
2
C
1
1
2
2
1
D
1
2
1
2
1
G(S)= 2/5 * 3/5 = 6/25
G(A,S)= 2/5[0 ] + 2/5[ 0] + 1/5[0]=0, Zysk(A)=6/25 – 0 = 6/25
G(B,S)= 4/5[2/4 * 2/4 ] + 1/5[0]= 1/5, Zysk(B)= 6/25 – 5/25 = 1/25
G(C,S)= 2/5 [1/2 * 1/2] + 3/5[1/3 * 2/3] =
A
1
D=1
2
D=1
0
D=2
ID3 (C4.5, See5)
E(S)= - 2/5log(2/5) – 3/5log(3/5)
E(A,S) = 2/5[ 0] + 2/5 [0] +1/5[0] =0 , Zysk(A)=
E(B,S) =4/5[-2/4log(2/4) – 2/4log(2/4)] + 1/5[0], Zysk(B)
E(C,S)=2/5[-1/2log(1/2) – 1/2log(1/2)] + 3/5[-1/3log(1/3) – 2/3log(2/3)], Zysk(C)
X
x1
x2
x3
x4
x5
A
1
0
2
0
1
B
0
0
0
0
2
C
1
1
2
2
1
D
1
2
1
2
1
RSES
X1
X2 A
X3
CA
X4 CA
X5
BA
X1 x2
A
ABC
x3 x4
x5
F(S)= (C+A)*(B+A)=CB+CA+A +A*B
Fx4= C*(B+C)= C
Fx2= C*B
Problem 3.
Discretize both attributes a and b in the Decision Table T(d).
Use discernibilty formulas (RSES).
X
a
0.8
x1
x2
1
x3
1.3
x4
1
x5
1.4
x6
1.6
x7
1.3
Decision Table T(d).
b
2
0.5
3
1
2
3
1
d
1
0
1
0
0
1
1
X
b
b2
b1
b3
b1
b2
b3
b1
d
1
0
1
0
0
1
1
a
a1
a1
a2
a1
a2
a2
a2
x1
x2
x3
x4
x5
x6
x7
a: 0.8
1
p1
1.3
p2
1.4
1.6
p3
p4
;
b: 0.5
1
q1
2
q2
a: [0.8 -1.2), [1.2 -1.6] ; b: [0.5-1.5),[1.5-2.5),[2.5-3]
a: a1,a2
b: b1, b2, b3
F(1,2)=p1+q1+q2
3
q3
F(1,4)=p1+q2
F(1,5)=p1+p2+p3
F(2,3)=p2+q1+q2+q3
F(2,6)=p2+p3+p4+q1+q2+q3
F(2,7)=p2+q2
F(3,4)=p2+q2+q3
F(3,5)=p3+q3
F(4,6)=p2+p3+p4+q2+q3
F(4,7)=p2
F(5,6)=p4+q3
F(5,7)=p3+q2
F(S)= (p1+q2)*(p3+q3)*p2*(p4+q3)*(p3+q2)=
Problem 4
Let us assume that the following fields in Table 1 have to be hidden: c(x2), c(x6), a(x3).
Apply SCIKD algorithm to find secure masking for Table 1. [LERS]
a
x1
1
x2
3
x3
1
x4
2
x5
3
x6
3
x7
2
Table 1.
b
1
1
2
1
1
2
2
c
2
2
2
1
2
1
1
d
1
2
1
2
2
2
2
d1*={1,3}, d2*={2,4,5,6,7}
a1*={1,3}<d1*, a2*={4,7}<d2* , a3*={2,5,6}<d2*
b1*={1,2,4,5}, b2*={3,6,7}
c1*={4,6,7}<d2*, c2*={1,2,3,5}
[b1*c2]*={1,2,5}, [b2*c2]*={3}<d1*
a1 => d1, a2 => d2, a3 => d2, c1 => d2, b2*c2 => d1
c1*={4,6,7}, c2*={1,2,3,5}
d1*={1.3}<c2*, d2*={2,4,5,6,7}
a1*={1,3}< c2*, a2*={4,7}<c1*, a3*={2,5,6}
b1*={1,2,4,5}, b2*={3,6,7}
[d2*a3]*=a3*, [d2*b1]*={2,4,5}, [d2*b2]*={6,7}<c1*
[a3*b1]*={2,5}<c2*, [a3*b2]*={6}<c1*
[d2*b2*a3]*
d1 => c2, a1 =>c2 , a2 => c1, d2*b2 => c1, a3*b2 =>c1
a1*={1,3}, a2*={4,7}, a3*={2,5,6}
c1*={4,6,7}, c2*={1,2,3,5}
d1*={1,3}<a1*, d2*={2,4,5,6,7}
b1*={1,2,4,5}, b2*={3,6,7}
[c1*d2]*= c1*, [c1*b1]*={4}<a2*, [c1*b2]*={6,7}
[c2*d2]*={2,5}<a3*, [c2*b1]*={1,2,5}, [c2*b2]*={3}<a1*
[d2*b1]*= {2,4,5}, [d2*b2]*={6,7}
[c1*b2*d2]*, [c2*b1*d2]*, [d2*b1*c1]*, [d2*b2*c2]*
d1 => a1, c1*b1 =>a2, c2*d2 => a3, c2*b2 => a1
b1*={1,2,4,5}, b2*={3,6,7}
c1*={4,6,7}, c2*={1,2,3,5}
d1*={1,3}, d2*={2,4,5,6,7}
a1*={1,3}, a2*={4,7}, a3*={2,5,6}
c1.d1*= 0
c1.d2*=c1 c1.a1*=0
c1.a2*=a2 c1.a3*={6}<b2*
c2.d1*=d1
c2.d2*={2,5}<b1* c2.a1*=a1
c2.a2*=0 c2.a3*={2,5}<b1*
d1.a1*=d1 d1.a2*=0 d1.a3*=0
d2.a1*=0 d2.a2*=a2 d2.a3*=a3
BAZA Wiedzy:
a1 => d1, a2 => d2, a3 => d2, c1 => d2, b2*c2 => d1
d1 => c2, a1 =>c2 , a2 => c1, d2*b2 => c1, a3*b2 =>c1
d1 => a1, c1*b1 =>a2, c2*d2 => a3, c2*b2 => a1
c1*a3 =>b2, c2*d2 =>b1, c2*a3 => b1
a3*={a3,d2}
b1*={b1}
d2*={d2}
a3.b1*={a3,d2,b1}
a3.d2*=a3*
b1.d2*={b1,d2}
b1.d2.a3*={a3,d2,b1}
BAZA Wiedzy:
a1 => d1, a2 => d2, a3 => d2, c1 => d2, b2*c2 => d1
d1 => c2, a1 =>c2 , a2 => c1, d2*b2 => c1, a3*b2 =>c1
d1 => a1, c1*b1 =>a2, c2*d2 => a3, c2*b2 => a1
c1*a3 =>b2, c2*d2 =>b1, c2*a3 => b1
b2*={b2}
c2*={c2}
d1*={d1,c2,a1}
b2.c2*={b2,c2,d1,a1}
a
x1
1
x2
3
x3
x4
2
x5
3
x6
3
x7
2
Table 1.
b
1
1
2
1
1
2
2
c
2
d
1
2
1
2
2
2
2
2
1
Problem 5.
Assume that {Table 1, Table 2} represents distributed knowledge system. Find all certain and possible
objects in Table 2 satisfying user query
q = (age,m-age)*(d,2)*(f,1).
For a definition of a non-local attribute as well as definition of attribute “age” under user semantics contact
Table 2. Assign the confidence to all objects retrieved.
age
x1
young
x2
m-age
x3
young
x4
m-age
x5
old
x6
old
x7
m-age
Table 1.
b
c
2
2
2
1
2
1
1
1
1
2
1
1
2
2
m-age*={2,4,7}
d1*={1,3}=0 w przecieciu z m-age
c1*={4,6,7}
d
1
2
1
2
2
2
2
f
1
0
2
1
0
1
2
d2*={2,4,5,6,7}
c2*={1,2,3,5}
d2.c1*=c1* d2.c2*={2,5}
d2=>m-age zauf=3/5, c1=>m-age zauf=2/3, c2=>m-age zauf=1/4, d2.c2=>m-age zauf=1/2
f1*={1,4,6}
d1*={1,3} d2*={2,4,5,6,7}
c1*={4,6,7}
c2*={1,2,3,5}
[d1.c2]*=d1* d2.c2*={2,5}=0 jesli chodzi o przeciecie z f1*
[d2.c1]*=c1* [d1*c1]*=0
d1=>f1
zauf=1/2 , d2=>f1 zauf=2/5, c1=>f1 zauf=2/3, c2=>f1 zauf=1/4
q = (age,m-age)*(d,2)* (f,1) > [d2+ c1+ c2+ d2.c2]*d2*[d1 + d2 + c1 + c2] =
3/5 2/3 ¼ ½
½ 2/5 2/3 ¼
[d2 + c1*d2 + c2*d2] *[d1 + d2 + c1 + c2] = d2 + d2*c1 +d2*c2 + c1*d2 + c1*d2
3/5 2/3
age
y1
young
y2
m-age
y3
young
y4
young
y5
m-age
y6
m-age
y7
old
Table 2.
¼
½
e
1
1
2
1
1
1
2
2/5 2/3 ¼
c
2
2
2
1
2
1
2
6/25 6/15
d
1
2
1
1
2
2
2
3/20
4/15
4/9
g
1
0
1
1
0
1
1
Odpowiedz: (y2,6/25), (y5, 6/25), (y7, 6/25) ,(y6,4/9)
In user semantics and in Table 1 semantics, the meaning of young is [1- 25], m-age is [26-65] and old is
[66-…].
Also, we assume that integers are the smallest granules for attribute age which means that
Dom(age) in Table 2 contains the smallest granules.
Problem 6.
Find the set of all optimal rules in Table S below describing C in terms of A,F,G. Use either ID3 or
CART algorithm.
X
x1
x2
x3
x4
x5
x6
A
a2
a1
a1
a1
a2
a1
F
f1
f2
f2
f1
f2
f2
G
g3
g1
g2
g1
g2
g3
C
c2
c1
c1
c2
c2
c2
G(S)=2/6 * 4/6 = 8/36 =2/9
G(A,S)= 2/6 [ 0] + 4/6 [1/2*1/2 ]=4/24=1/6 , Gain(A,S) = 2/9 - 1/6
G(F,S)= 2/6 [0 ] + 4/6[ ½*1/2 ] = 1/6 , Gain(F,S) = 2/9 - 1/6
G(G,S)= 2/6 [ 0] + 2/6[1/2*1/2 ] + 2/6[1/2*1/2 ] = 4/6*1/4= 1/6 , Gain(G,S) = 2/9 -1/6
A
a2
[A=a2] => [C=c2]
a1
X F
x2 f2
x3 f2
x4 f1
x6 f2
C=c2
G C
g1 c1
g2 c1
g1 c2
g3 c2
Tablica S1
G(S1) = 2/4 * 2/4=1/4
G(F,S1)= Gain(F,S1)=1/4 G(G,S1)=
G(F,S1)= ¼[ 0 ] + ¾[ 1/3 * 2/3 ]
Problem 7. Assume that {Table 1, Table 2} represents distributed knowledge system.
Find all certain and possible objects in Table 1 satisfying user query
q = (age,m-age)*(d,2)*(g1).
For a definition of a non-local attribute as well as definition of attribute “age” under
user semantics contact Table 2. Assign the confidence to all objects retrieved.
age
x1
young
x2
m-age
x3
young
x4
m-age
x5
old
x6
old
x7
m-age
Table 1.
b
1
1
2
1
1
2
2
c
2
2
2
1
2
1
1
d
1
2
1
2
2
2
2
f
1
0
2
1
0
1
2
age
y1
13
y2
40
y3
12
y4
20
y5
58
y6
62
y7
70
Table 2.
e
1
1
2
1
1
1
2
c
2
2
2
1
2
1
2
d
1
2
1
1
2
2
2
g
1
0
1
1
0
1
1
Assume the following semantics for attribute age:
In user semantics the meaning of young is [1- 25], m-age is [26-65] and
old is [66-…].
In Table 1 semantics the meaning of young is [1-18], m-age is [19-40] and
old is [41-…].
Also, we assume that integers are the smallest granules for attribute age which means that
Dom(age) in Table 2 contains the smallest granules.
Problem 8. Assume that {Table 1, Table 2, Table 3} represents distributed knowledge system.
1. Find all certain and possible objects in Table 2 satisfying the query q = (a,3)*(d,2)*(f,1). For a
definition of a non-local attribute contact Table 1. Assign the confidence to all objects retrieved.
2. Find all certain and possible objects in Table 2 and Table 3 satisfying the query q =
(a,3)*(d,2)*(f,1). You have to contact other tables for definitions of non-local attributes either in
Table 1 or Table 3. Assign the confidence to all objects retrieved. Explain your strategy.
a
x1
1
x2
2
x3
1
x4
2
x5
3
x6
3
x7
2
Table 1.
b
a
y1
1
y2
2
y3
1
y4
1
y5
3
y6
3
y7
3
Table 2.
e
z1
z2
z3
z4
z5
z6
Table 3
g
0
0
0
1
0
1
1
1
2
1
1
2
2
c
2
2
2
1
2
1
1
c
1
2
1
2
2
2
1
1
1
2
1
1
2
2
q = (a,3)*(d,2)* (f,1).
a
2
2
1
2
2
1
e
1
2
2
1
2
1
d
1
2
1
2
2
2
2
f
1
0
2
1
0
1
2
d
1
2
1
1
2
2
2
g
1
0
1
1
0
1
1
b
1
1
2
2
1
2
Problem 9.
For the information system given below, find the set of rules describing C in terms of E, F,G by
following ERID algorithm. Use ½ for minimum confidence and ½ for minimum support.
Assume that Dom(E)={e1,e2}, Dom(F)={f1,f2}, Dom(C)={c1,c2}, G={g1,g2}.
Use Chase with threshold 1/3 to check if C(x4) will change its value based on discovered rules.
X
E
F
G
C
x1
e2
f2
c2
(g1,1/2)(g2,1/2)
x2
e1
g1
c1
(f1,1/2)(f2,1/2)
x3
f2
g2
c1
(e1,1/2)(e2,1/2)
x4
e1
f1
g1
(c1,1/2)(c2,1/2)
x5
e2
f2
g1
c2
x6
e1
f1
c2
(g1,1/2)(g2,1/2)
KB={ e1 => c1 wsp= 2 , zauf= 4/7 ;
e2 =>c2 wsp=2, zauf=4/5 ;
f1 => c2 wsp=3/2 zauf = 6/10 ; f2 => c2 wsp=2, zauf= 4/7 ;
g1 => c2 wsp =5/2 zauf = 5/8 ; g2 => c1 wsp = 1 zauf = ½ ;
g2 => c2 wsp=1, zauf=1/2 ; f1*g1 => c1 wsp=1, zauf=1/2 } dla cechy C.
c1: 1*2* 4/7 + 1*1*1*1/2 =8/7 + ½ = 16/14 + 7/14 = 23/14 = p1
p1/(p1+p2)
c2: 1*3/2 * 6/10 + 1*5/2 * 5/8= 9/10 + 25/16= p2
p2/(p1+p2)> 2/3
Table
c1*={x2,x3,(x4,1/2)}, c2*={x1,(x4,1/2), x5,x6}
e1*={x2,(x3,1/2),x4,x6}, e2*={x1,(x3,1/2),x5}
f1*={(x2,1/2),x4,x6}, f2*={x1,(x2,1/2),x3,x5}
g1*={(x1,1/2),x2,x4,x5,(x6,1/2)}, g2*={(x1,1/2), x3, (x6,1/2)}
e1 => c1
e2 => c1
f1 => c1
f2 => c1
g1 => c1
g2 => c1
wsp= 1+1/2+1/2=2>1/2 , zauf= 4/7 >= 1/2 e1 => c2 wsp=1/2+1=3/2, zauf= 3/2 : 7/2= 3/7
wsp=1/2, zauf = ½ :5/2=2/10 ; e2 =>c2 wsp=1+1=2, zauf=4/5
wsp=1/2+1/2=1, zauf=2/5 ; f1 => c2 wsp=1/2+1=3/2 zauf = 3/2 : 5/2=6/10
wsp= ½+1=3/2 , zauf=3/2 : 7/2 = 6/14; f2 => c2 wsp= 1+1=2, zauf= 4/7
wsp = 1+1/2=3/2, zauf= 3/8 , g1 => c2 wsp = ½+1/2+1+1/2=5/2 zauf = 5/8
wsp = 1 zauf = ½, g2 => c2 wsp=1/2+1/2=1, zauf=1/2
[e2*f1]*= 0
[e2*f2]*={x1,(x3,1/2),x5}=e2*
[e2*g1]*={(x1,1/2), x5}
e2*g1=> c1 wsp=0 nie ma reguly
[f1*g1]* = {(x2,1/2),x4,(x6,1/2)}
f1*g1 => c1 wsp=1/2+1/2=1, zauf=1/2
[f2*g1]*= {(x1,1/2),(x2,1/2),x5}
f2*g1 => c1 wsp=1/2 zauf=1/2 : 2
KB={ e1 => c1 wsp= 2 , zauf= 4/7 ;
e2 =>c2 wsp=2, zauf=4/5 ;
f1 => c2 wsp=3/2 zauf = 6/10 ; f2 => c2 wsp=2, zauf= 4/7 ;
g1 => c2 wsp =5/2 zauf = 5/8 ; g2 => c1 wsp = 1 zauf = ½ ;
g2 => c2 wsp=1, zauf=1/2 ; f1*g1 => c1 wsp=1, zauf=1/2 } dla cechy C.
Problem 10.
Let S=(X, {a,b,c,d}) be a decision system, where {a,c} are stable attributes and {b,d} flexible.
Attribute d is the decision attribute. Extract all action rules from S following Action Forest, Action
Tree, StrategyGenerator algorithms. Find their confidence and support.
x1
x2
x3
x4
x5
x6
System S
a
a1
a2
a1
a2
a1
a3
b
b2
b2
b1
b2
b1
b2
c
c1
c1
c2
c2
c3
c2
d
d1
d2
d2
d2
d1
d2
d1*={1,5}, d2*={2,3,4.6}
a1*= {1,3,5}, a2*={2,4}<d2*, a3*={6}<d2*
b1*={3,5}, b2*={1,2,4,6}
c1*={1,2}, c2*={3,4,6}<d2*, c3*={5}<d1*
[a1*b1]*=b1*, [a1*b2]*={1}<d1*, [a1*c1]*={1}<d1*
[b1*c1]*=0, [b2*c1]*=c1*
a2 => d2 conf=1; a3 => d2 conf =1; c2 => d2 conf = 1; c3 => d1 conf =1;
a1*b2 => d1* conf = 1; a1*c1 => d1 conf = 1
a1 => d1 conf= 2/3; b2 => d2 conf = ¾;
a
A2
A3
b
c
d
D2
D2
D2
D1
D1
D1
D1
D2
C2
C3
A1
A1
A1
B2
C1
B2
D1
a
A1
A1
A1
b
c
C3
B2
C1
a
b
B2
-
?
c
C1
b
-
c
C1
b
-
A1
c
C3
c
?
C3
b
B2
-
b
-
D2
a
A2
A3
b
c
C2
B2
c
C2
a
-
?
b
-
a
A2
A3
-
b
B2
a
a
?
?
A3
A2
b
b
B2
(c, ?) * (a,?) (c,?) * (a,A1) (c,?)* (a,A1) (a,?)*(c,C3)
-
b
-
b
-
(b,B2)
(b, B2)
(b, ?)
(b, ?)
D1 -> D2
[(a,A1)*(b, ? => B2)]=>[d, D1 =>D2]
[(c,C3)*(b, ? =>B2)] => [d, D1 =>D2]
D2
D1
D1
D1
r1
r2
Wsparcie(r1) = WsparcieLewe(r1)((a,A1)=>(d,D1)) = 2
WsparciePrawe(r1)((a,A1)*(b,B2) => (d,D2)) = 0
ZaufLewe(r1) = WsparcieLewe(r1)/Wsparcie(a,A1)
ZaufPrawe(r1)= WsparciePrawe(r1)/Wsparcie[(a,A1)*(b,B2)] = 0
Zauf(r1)= ZaufLewe(r1)* ZaufPrawe(r1)
© Copyright 2026 Paperzz