%example (Id, Class, AVS) - PowerPoint PPT Presentation

1 / 36
About This Presentation
Title:

%example (Id, Class, AVS)

Description:

????? ?? ??????????? ?? ????????? ? ??????????. ???????-???????? ... example(a10,amphibian,[has_covering = none, milk = f, homeothermic = f, habitat ... – PowerPoint PPT presentation

Number of Views:21
Avg rating:3.0/5.0
Slides: 37
Provided by: abc778
Category:
Tags: avs | amphibian | class | example

less

Transcript and Presenter's Notes

Title: %example (Id, Class, AVS)


1
????????? ?????????????????? ? 10
  • ????. ???????????, ???
  • 2004/2005

2
??????? ????????????
  • ????????? ?? ???????? ?? ??????? (????????)
  • ???????
  • ???????????
  • ???????????
  • ????????? ???????
  • ??????? ???????
  • ???????? ??
  • ???? ???????
  • ????? ???????

3
??????? ????????????
  • ????? ?? ??????????? ?? ????????? ? ??????????
  • ???????-????????
  • ?????????? ????
  • ?????

4
???? ??????? ????????
  • ??????????? ?? ?????????
  • example (Id, Class, AVS)
  • example(a4,mammal,has_covering hair,
  • milk t, homeothermic t,
  • habitat air, eggs f, gills f).
  • example(a5,fish,has_covering scales,
  • milk f, homeothermic f,
  • habitat sea, eggs t, gills t).
  • example(a6,reptile,has_covering scales,
  • milk f, homeothermic f,
  • habitat land, eggs t, gills f).

5
???? ??????? ????????
  • ??????????? ?? ??????????
  • IF AiVij AkVkm THEN Classp
  • IF AsVst AnVnl THEN Classq

6
?????? ???????? ? ?????????
  • ?????????
  • ???????
  • ??????????

7
  • learn(H)-
  • findall(ClassAVS,
  • example(_,Class,AVS),
  • Ex),
  • lrn(Ex,H).

8
  • lrn(E,H) -
  • del(ClassA,E,E1),
  • del(ClassB,E1,E2),
  • lgg(A,B,LGG,Class),
  • \((member(C1LGG,E2),
  • \(ClassC1))),
  • lrn(ClassLGGE2,H).
  • lrn(H,H).

9
  • lgg(,,,Class).
  • lgg(AV1Rest1,AV2Rest2, AH1Hyp,Class)
    -
  • lgg1(A,V1,V2,H1,Class),
  • lgg(Rest1,Rest2,Hyp,Class).

10
  • lgg1(_,X,Y,X,_)- XY,!.
  • lgg1(A,X,Y,_,C)-
  • X \ Y,
  • nominal(C,N),member(A,N).
  • lgg1(A,X,Y,H,C)-
  • X \Y,
  • linear(C,L),member(A,L),
  • cover(X,Y,H).
  • lgg1(A,X,Y,H,C)-
  • X \Y,
  • struct(C,L),member(A,L),
  • common_parent(X,Y,H,C).

11
  • cover(X,X,X)-!.
  • cover(X,Y,Min,Max)-
  • atom(X),atom(Y),!,
  • min(X,Y,Min),
  • max(X,Y,Max).
  • cover(X,Y1,Y2,Min,Max)-
  • atom(X),!,
  • min(X,Y1,Min),
  • max(X,Y2,Max).
  • cover(X1,X2,Y,Min,Max)-
  • atom(Y),!,
  • min(X1,Y,Min),
  • max(X2,Y,Max).
  • cover(X1,X2,Y1,Y2,Min,Max)-
  • min(X1,Y1,Min),
  • max(X2,Y2,Max).

12
  • min(X,X,X)-!.
  • min(X,Y,X)-XltY,!.
  • min(X,Y,Y)-XgtY.
  • max(X,X,X)-!.
  • max(X,Y,X)-XgtY,!.
  • max(X,Y,Y)-XltY.

13
  • common_parent(X,Y,H,C)-
  • parent(H,X,C),
  • parent(H,Y,C).
  • parent(X,X,C).
  • parent(X,Y,C)-isa(C,Y,X).
  • parent(X,Y,C)-isa(C,Y,Z),parent(X,Z,C).

14
  • del(X,XT,T).
  • del(X,YT,YV) -
  • del(X,T,V).
  • member(X,X_).
  • member(X,_T) -
  • member(X,T).
  • write_list().
  • write_list(HRest)-
  • write(H),nl,
  • write_list(Rest).

15
??????
  • example(a1,mammal,has_covering hair, milk
    t, homeothermic t, habitat land, eggs f,
    gills f).
  • example(a2,mammal,has_covering none, milk
    t, homeothermic t, habitat sea, eggs f,
    gills f).
  • example(a3,mammal,has_covering hair, milk
    t, homeothermic t, habitat sea, eggs t,
    gills f).
  • example(a4,mammal,has_covering hair, milk
    t, homeothermic t, habitat air, eggs f,
    gills f).
  • example(a5,fish,has_covering scales, milk
    f, homeothermic f, habitat sea, eggs t,
    gills t).

16
??????
  • example(a6,reptile,has_covering scales, milk
    f, homeothermic f, habitat land, eggs t,
    gills f).
  • example(a7,reptile,has_covering scales, milk
    f, homeothermic f, habitat sea, eggs t,
    gills f).
  • example(a8,bird,has_covering feathers, milk
    f, homeothermic t, habitat air, eggs t,
    gills f).
  • example(a9,bird,has_covering feathers, milk
    f, homeothermic t, habitat land, eggs t,
    gills f).
  • example(a10,amphibian,has_covering none, milk
    f, homeothermic f, habitat land, eggs t,
    gills f).

17
??????
  • struct(_,).
  • linear(_,).
  • nominal(_,has_covering,milk,homeothermic,habitat,
    eggs,gills)

18
??????
  • ?- learn(H),write_list(H).
    bird,has_coveringfeathers,milkf,homeoth
    ermict,
  • habitat_3699,eggst,gillsf
  • reptile,has_coveringscales,milkf,
  • homeothermicf,habitat_3039,eggst,gillsf
  • mammal,has_covering_2095,milkt,homeothermict,
  • habitat_2324,eggs_2464,gillsf
  • fish,has_coveringscales,milkf,homeothermicf,
  • habitatsea,eggst,gillst
  • amphibian,has_coveringnone,milkf,homeothermicf
    ,habitatland,eggst,gillsf

19
??????
  • example(1,pos,hs octagon, bs octagon, sm
    no, ho sword, jc red, ti yes).
  • example(2,pos,hs octagon, bs octagon, sm
    yes, ho sword, jc red, ti yes).
  • example(3,neg,hs round, bs square, sm
    yes, ho sword, jc blue, ti no).
  • example(4,neg,hs round, bs square, sm
    yes, ho flag, jc green, ti yes).
  • example(5,pos,hs octagon, bs round, sm
    yes, ho sword, jc red, ti yes).
  • example(6,pos,hs square, bs octagon, sm
    yes, ho sword, jc red, ti yes).
  • example(7,pos,hs square, bs square, sm
    no, ho sword, jc red, ti yes).

20
??????? ????????????
  • ?- learn(H),write_list(H).
    neg,hsoctagon,bssquare,smyes,ho_125218,j
    cblue,
  • tino
  • neg,hssquare,bsround,sm_123819,ho_123946,jcg
    reen,
  • ti_124150
  • neg,hsoctagon,bsround,sm_120834,ho_120961,jc
    yellow,tino
  • neg,hssquare,bsoctagon,sm_116815,ho_116942,jc
    green,ti_117146
  • neg,hssquare,bsround,sm_113808,ho_113935,jcy
    ellow,
  • tino
  • neg,hssquare,bsround,sm_111648,ho_111775,jcb
    lue,
  • ti_111979
  • neg,hsround,bsoctagon,sm_106498,ho_106625,jc
    yellow,ti_106829
  • neg,hsround,bsoctagon,sm_101722,ho_101849,jc
    green,
  • ti_102053

21
  • neg,hsround,bsoctagon,sm_100472,ho_100599,jc
    blue,
  • ti_100803
  • pos,hsround,bsround,sm_93315,ho_93442,jc_935
    82,
  • ti_93735
  • pos,hssquare,bssquare,sm_84522,ho_84649,jc_8
    4789,
  • ti_84942
  • pos,hsoctagon,bsoctagon,sm_70090,ho_70217,jc
    _70357,
  • ti_70510
  • neg,hsround,bssquare,sm_55652,ho_55779,jcyel
    low,
  • ti_55983
  • neg,hsround,bssquare,sm_51710,ho_51837,jcgre
    en,
  • ti_52041
  • neg,hsround,bssquare,sm_45417,ho_45544,jcblu
    e,
  • ti_45748
  • pos,hs_41557,bs_41658,sm_41772,ho_41899,jcre
    d,
  • ti_42103
  • neg,hsoctagon,bsround,smno,hoflag,jcgreen,ti
    no
  • neg,hssquare,bsoctagon,smyes,hoballoon,jcblu
    e,tino
  • neg,hssquare,bsoctagon,smno,hoflag,jcyellow,
    tiyes

22
(No Transcript)
23
???? ??????? ????????
  • attribute(size,small,large).
  • attribute(shape,long,compact,other).
  • attribute(holes,none,1,2,3,many).

24
???? ??????? ????????
  • ??????????? ?? ?????????
  • example (Class, AVS)
  • example(nut,sizesmall,shapecompact,holes1).
  • example(screw,sizesmall,shapelong,holesnone).
  • example(key,sizesmall,shapelong,holes1).
  • example(nut,sizesmall,shapecompact,holes1).
  • example(key,sizelarge,shapelong,holes1).
  • example(screw,sizesmall,shapecompact,holesnone
    ).
  • example(nut,sizesmall,shapecompact,holes1).
  • example(pen,sizelarge,shapelong,holesnone).
  • example(scissors,sizelarge,shapelong,holes2).
  • example(pen,sizelarge,shapelong,holesnone).
  • example(scissors,sizelarge,shapeother,holes2)
    .
  • example(key,sizesmall,shapeother,holes2).

25
  • match(Object,Description)-
  • member(Conjunction,Description),
  • satisfy(Object,Conjunction).
  • satisfy(Object,Conjunction)-
  • not ( member(AttVal,Conjunction),
  • member(AttValX,Object),
  • ValX \ Val ).

26
  • -op(300,xfx,lt).
  • learn(Class)-
  • bagof(example(CalssX,Obj),
  • example(CalssX,Obj),
  • Examples),
  • learn(Examples,Class,Description),
  • nl,write(Class),write(lt),nl,
  • writelist(Description),
  • assert(ClassltDescription).

27
  • learn(Examples,Class,)-
  • not member(example(Calss,_),Examples).
  • learn(Examples,Class,ConjConjs)-
  • learn_conj(Examples,Class,Conj),
  • remove(Examples,Conj,RestExamples),
  • learn(REstExamples,Class,Conjs).

28
  • learn_conj(Examples,Class,)-
  • not (member(example(CalsX,_),Examples),
  • ClasX \ Class).
  • learn_conj(Examples,Class,CondConds)-
  • choose_cond(Examples,Class,Cond),
  • filter(Examples,Cond,Examples1),
  • learn_conj(Examples1,Class,Conds).
  • learn_conj(Examples,_,).

29
  • choose_cond(Examples,Class,AttVal)-
  • findall(AV/Score,
  • score(Examples,Class,AV,Score),
  • AVs),
  • best(AVs,AttVal).
  • best(AttVal/_,AttVal).
  • best(AV0/S0, AV1/S1 AVSlist,AttVal)-
  • S1 gt S0, !,
  • best(AV1/S1 AVSlist,AttVal)
  • best(AV0/S0 AVSlist,AttVal).

30
  • filter(Examples,Cond,Examples1)-
  • findall(example(Calss,Obj),
  • (member(example(Calss,Obj),Examples),
  • satisfy(Obj,Cond)),
  • Examples1).

31
  • remove(,_,).
  • remove(example(Class,Obj)Es,Conj,Es1)-
  • satisfy(Obj,Conj),!,
  • remove(Es,Conj,Es1).
  • remove(EEs,Conj,EEs1)-
  • remove(Es,Conj,Es1).

32
  • satisfy(Object,Conjunction)-
  • not ( member(AttVal,Conjunction),
  • member(AttValX,Object),
  • ValX \ Val ).
  • score(Examples,Class,AttVal,Score)-
  • candidate(Examples,Class,AttVal),
  • filter(Examples,AttVal,Examples1),
  • length(Examples1,N1),
  • count_pos(Examples1,Class,NPos1),
  • NPos1 gt0,
  • Score is 2NPos1 N1.

33
  • candidate(Examples,Class,AttVal)-
  • attribute(Att,Values),
  • member(Val,Values),
  • suitable(AttVal,Examples,Class).
  • suitable(AttVal,Examples,Class)-
  • member(example(ClassX,ObjX),Examples),
  • ClassX \ Class,
  • not satisfy(ObjX, AttVal),!.

34
  • count_pos(,_,0).
  • count_pos(example(ClassX,_)Ex,Class,N)-
  • count_pos(Ex,Class,N1),
  • (ClassXClass,!, N is N11 N N1).
  • writelist().
  • writelist(XL)-
  • tab(2), write(X), nl,
  • writelist(L).

35
  • ?- learn(pen).
  • penlt
  • holesnone,sizelarge
  • yes
  • ?- learn(key).
    keylt
  • shapeother,sizesmall holes1,shapelong
  • yes
  • ?- learn(nut).
  • nutlt
  • shapecompact,holes1
  • yes

36
  • ?- learn(screw).
  • screwlt
  • holesnone,sizesmall
  • yes
  • ?- learn(scissors).
  • scissorslt
  • holes2,sizelarge
  • yes
Write a Comment
User Comments (0)
About PowerShow.com