0% found this document useful (0 votes)
24 views76 pages

A I 2020 Discussion 1105

The document discusses an AI course including topics like machine learning, deep learning, knowledge representation, search strategies, semantic nets, Prolog, and assignments. Prolog examples on map coloring, factorial, and Tower of Hanoi are provided.

Uploaded by

朝崴
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)
24 views76 pages

A I 2020 Discussion 1105

The document discusses an AI course including topics like machine learning, deep learning, knowledge representation, search strategies, semantic nets, Prolog, and assignments. Prolog examples on map coloring, factorial, and Tower of Hanoi are provided.

Uploaded by

朝崴
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
You are on page 1/ 76

AI 2020 Discussion

• 9/17, 9/24
• 10/8, 10/15, 10/22, 10/29
• 11/5
AI Hype
September 17, 2020
Data Driven
(ML, DL, …)

Knowledge
Based
Graduate Course
• Basics of AI
– Prolog as exercises
• Exploring your own interest
– Research in AI technologies
– Research in AI applications (in your field)
– AI techniques (like ML, DL, …)
• Results
– Survey paper
– System development
Textbook
• Ordering the textbook (AIMA book): NT1230
• Reading assignment
– Chapter 1 & Chapter 2
– https://people.eecs.berkeley.edu/~russell/aima1e/chapter01.pdf
– https://people.eecs.berkeley.edu/~russell/aima1e/chapter02.pdf
September 24, 2020
Assignments
• Lecture
– Read Textbook Chapter 3
• Survey paper
– Start explore what you want to write for a survey paper
– Collect related papers
– Propose possible topics by October 15
October 8, 2020
A Simple Example

9 possible slots Heuristics

8 possible slots
Rules
vs.
Machine
Learning
9 x 8 x 7 x … x 1 = 9!
362880 possible slots

10
Search Strategies
• Breadth-first search
• Depth-first search
Tic-Tac-Toe
Breadth-first search
Tic-Tac-Toe
Depth-first search
Tic-Tac-Toe
Heuristic search
科技大擂台 與AI對話(熱身賽)

https://fgc.stpi.narl.org.tw/activity/techai
科技大擂台 與AI對話(熱身賽)
• 線上教學  教學文件
– https://fgc.stpi.narl.org.tw/activity/video/techai
• TensorFlow
– https://www.tensorflow.org/
– https://www.tensorflow.org/tutorials/quickstart/beginner
• Keras
– https://keras.io/
• PyTorch
– https://pytorch.org/
• Kaggle
– https://www.kaggle.com/
Assignments
• Read Chapter 4
• Pick a machine learning or deep learning tool to gain some
experience
October 15, 2020
State Search
• Variety of uninformed search strategies
– Breadth First Search, Depth first Search, Iterative Deepening Search
• Problem formulation usually
– Modeling: abstraction into state space
• Graph search can be exponentially more efficient than tree
search
Figure 3.21
Summary of Algorithms
Chatbots
• Loebner Prize Winners
– https://aisb.org.uk/category/loebner-prize/
– https://aisb.org.uk/aisb-events/
– None of the chatbots competing in the finals managed to fool a judge into
believing it was human. The judges ranked the chatbots according to how
human-like they were. Scores out of 100% were:
• Mitsuku 33%, Tutor 30%, Colombina 25%, Uberbot 23%
– Past winners
• Mitsuku: https://www.pandorabots.com/mitsuku/
• A.L.I.C.E vs. Jabberwacky https://www.discovermagazine.com/technology/i-chat-
therefore-i-am
• https://www.chatbots.org/
Challenge in Real Use

https://www.chatbots.org/conversational/agent/chatbots.org_report_consumers_chatbot_usage_uk_us/
https://outlook.stpi.narl.org.tw/mailapp/load?arhId=4b1141006e7eb85a016e818390ad027c&mabId=4
b1141006e7eb85a016e818582430285&madId=4b1141dd6bf14de5016bf4b00fce610a

Nov 19, 2019 25


October 22, 2020
Prolog
• AI programming language
• Logic-based language
• Declarative nature
– Stating the facts and rules
– Asserting a statement
• SWI-Prolog
– https://www.swi-prolog.org/
• Very good Prolog tutorial
– https://www.cpp.edu/~jrfisher/www/prolog_tutorial/contents.html
lower case vs.
UPPER case Example Constant value vs.
Variable

teaching(alan, ai).
?- teaching(alan,X).
taking(angga, ai).
?- taking(rax,X).
taking(rax, ai).
?- taking(X,Y).

student_of(X,Y) :-
teaching(X,Z), ?- student_of(alan,Y).

taking(Y,Z).
No TAB allowed
Semantic Nets
• Used for propositional information (information that is either
true or false)
• Propositional net
• Declarative knowledge
• Labeled directed graph
• Nodes (objects) and arcs (links/edges)

Joseph Giarratano and Gary Riley, Expert Systems: Principles and Programming, Course Technology, 4th ed., 2005.
Semantic Nets (cont.)
Semantic Nets (cont.)
Initial Design Warning: not
quite working
• mother_of(susan, john).
• wife_of(susan, tom).

• father_of(tom, john).
• husband_of(tom, susan).

• mother_of(ann, susan).
• wife_of(ann, bill).
• sister_of(ann, carol).

• father_of(bill, susan).
• husband_of(bill, ann).
Predicate Definitions
• mother_of(susan, john).
• mother_of(ann, susan).

• wife_of(susan, tom).
• wife_of(ann, bill).

• father_of(tom, john).
• father_of(bill, susan).

• husband_of(tom, susan).
• husband_of(bill, ann).

• sister_of(ann, carol).
Basics
• To start at powershell or cmd
– swipl
• Within the SWI Prolog environment
– To read a file (file extension .pl)
• [finalname].
– To quit
• halt.
– To get another answer (binding different value to variable)
• ;
– To turn off the warning color
• set_prolog_flag(color_term, false).
Basic Operations in Family Tree Example
• [family2]. mother_of(susan, john).
mother_of(ann, susan).
• mother_of(susan, X).
wife_of(susan, tom).
• mother_of(X, john). wife_of(ann, bill).
• mother_of(X, Y). father_of(tom, john).
father_of(bill, susan).

husband_of(tom, susan).
husband_of(bill, ann).

sister_of(ann, carol).
Little Tricks
• dynamic
– dynamic mother_of/2.
• assert
– assert(mother_of(carol,tom)).
Prolog
• SWI Prolog
– http://www.swi-prolog.org/
• Prolog tutorial
– https://www.cpp.edu/~jrfisher/www/prolog_tutorial/contents.html
– http://ccckmit.wikidot.com/ai:prolog
– http://programmermagazine.github.io/201308/htm/article3.html
– https://en.wikibooks.org/wiki/Prolog
– http://www.cse.unsw.edu.au/~billw/prologdict.html
• Insight on learning Prolog
– https://www.ithome.com.tw/voice/110557
– https://kknews.cc/zh-tw/tech/gqralpy.html
• Online book
– https://www.metalevel.at/prolog
Original

Map Coloring 1: red


3: green
2: blue
4: yellow
5: blue
adjacent(1,2). adjacent(2,1). coloring-a
adjacent(1,3). adjacent(3,1). 1: red
adjacent(1,4). adjacent(4,1).
2: blue
adjacent(1,5). adjacent(5,1).
3: green
adjacent(2,3). adjacent(3,2).
adjacent(2,4). adjacent(4,2). 4: yellow
adjacent(3,4). adjacent(4,3). 5: blue
adjacent(4,5). adjacent(5,4). coloring-b
1: red
color(1,red,a). color(1,red,b). 2: blue
color(2,blue,a). color(2,blue,b).
3: green
color(3,green,a). color(3,green,b).
color(4,yellow,a). color(4,blue,b).
4: blue
color(5,blue,a). color(5,green,b). 5: green

https://www.cpp.edu/~jrfisher/www/prolog_tutorial/2_1.html
Map Coloring
adjacent(1,2). adjacent(2,1).
adjacent(1,3). adjacent(3,1). conflict(Coloring) :-
adjacent(1,4). adjacent(4,1). adjacent(X,Y),
adjacent(1,5). adjacent(5,1). color(X,Color,Coloring),
adjacent(2,3). adjacent(3,2). color(Y,Color,Coloring).
adjacent(2,4). adjacent(4,2).
adjacent(3,4). adjacent(4,3). ?- conflict(a).
adjacent(4,5). adjacent(5,4). false.

color(1,red,a). color(1,red,b). ?- conflict(b).


true
color(2,blue,a). color(2,blue,b).
color(3,green,a). color(3,green,b).
?- conflict(Which).
color(4,yellow,a). color(4,blue,b).
color(5,blue,a). color(5,green,b).
Which = b
https://www.cpp.edu/~jrfisher/www/prolog_tutorial/2_1.html
Factorial
factorial(0,1).

factorial(N,F) :-
N>0,
N1 is N-1,
factorial(N1,F1),
F is N * F1.

https://www.cpp.edu/~jrfisher/www/prolog_tutorial/2_2.html
Tower of Hanoi
move(1,X,Y,_) :-
write('Move top disk from '),
write(X),
write(' to '),
write(Y),
nl.
move(N,X,Y,Z) :-
N>1, ?- move(1,left,right,center).
M is N-1,
move(M,X,Z,Y), ?- move(2,left,right,center).
move(1,X,Y,_),
move(M,Z,Y,X). ?- move(3,left,right,center).

https://www.cpp.edu/~jrfisher/www/prolog_tutorial/2_3.html
Challenges
• Build your own family tree for over 20 people and 4 generations.
– Either yours or some famous people.
– Define some new relationships other than the basic ones.
– Try to come up with some “missions” that you could do with your
knowledge.
– Explain your achievement.
– Due: October 16 (posting on ecourse2)
• Try some tools mentioned by MOST or other tools
– https://fgc.stpi.narl.org.tw/activity/video/techai
– Due: October 30 to decide which tool to study
– Due: December 2 to demo an example
October 29, 2020
Search and Beyond Search
• State search
– Breadth first search, depth first search, iterative deepening search
– Greedy search, A* search
• Searching the unsearchable (because of the size of combinations of
states)
– Hill-climbing
– Simulated annealing, local beam, genetic algorithm
– Optimization algorithms like evolutional and metaheuristics algorithms
• More challenges (less information)
– Non-deterministic
– Partially observable
– Online search
Challenges for Prolog and ML/DL
• Build your own family tree for over 20 people and 4 generations.
– Either yours or some famous people.
– Define some new relationships other than the basic ones.
– Try to come up with some “missions” that you could do with your knowledge.
– Explain your achievement.
– Due: November 16 (posting on ecourse2)
• Try some tools mentioned by MOST
– https://fgc.stpi.narl.org.tw/activity/video/techai
– TensorFlow https://www.tensorflow.org/ https://www.tensorflow.org/tutorials
– Keras https://keras.io/
– PyTorch https://pytorch.org/
– Kaggle https://www.kaggle.com/
– Google colab https://colab.research.google.com/notebooks
– Due: November 4 to decide which tool to study
– Due: December 10 to demo an example
Grading Criteria
• Programming assignments 10%
• Report on a research topic 20%
– Presentation
– Written report
• Project 25%
– System development
– Progress report
– “ecourse2” discussion board
• Quiz 15%
• Final examination 30%
Report Assignments
• Paper + Presentation
• Topic (both)
– AI research
• Techniques and trends
– AI application in any field
• Content
– At least 4000 words
– At least 6 references
• Due date
– December 24 & 31 (presentation)
– January 11 (report): 100%
– January 18 (report): 90% or 500 more words for 100%
Term Paper Presentation
• Purpose of literature survey
– To investigate what’s going on in a research field
– To compare the related papers and discuss the similarities and differences along with
pros and cons
– To observe from the result
• What are the trends? What to avoid? What are new topics? …
• Content of presentation
– Describe and explain your topic
– List at least six related papers you have gathered and prepare to read (or have read)
• Be sure to use a correct and consistent citation format, i.e. IEEE or ACM
• You may state a portion of the abstract under the paper title
– Describe each paper
– Describe the expected results
• Why you have chosen such papers and what you want to compare?
• What do you expect to see?
Written Exams
• Quiz 1 (Nov. 5 or 12??)
– Ch.3 Searching techniques
– Ch.4 Local search
• Quiz 2 (Nov. 26 or Dec. 3??)
– Ch.5 Adversarial search
– Ch.6 Constraint satisfaction problem
• Final examination 30% (Jan. 7) 90-min exam
– Ch.7 ~ Ch.9 Logic and inference
– Ch.10 Planning
– Ch.14 Probabilistic reasoning*
– Ch.18 Learning*
– Something missed in quizzes
Prolog
Lists and Sequences
member(X,[X|R]).
member(X,[Y|R]) :- member(X,R).

?- member(2, [1,2,3]).

?- member(X, [1,2,3]).

https://www.cpp.edu/~jrfisher/www/prolog_tutorial/2_7.html
Lists and Sequences (cont.)
takeout(X,[X|R],R).
takeout(X,[F|R],[F|S]) :- takeout(X,R,S).

reverse([X|Y],Z,W) :- reverse(Y,[X|Z],W).
reverse([],X,X).
reverse(A,R) :- reverse(A,[],R).
Lists and Sequences (cont.)
mergesort([],[]).
mergesort([A],[A]).
mergesort([A,B|R],S) :-
split([A,B|R],L1,L2),
mergesort(L1,S1),
mergesort(L2,S2),
merge(S1,S2,S).

split([],[],[]).
split([A],[A],[]).
split([A,B|R],[A|Ra],[B|Rb]) :- split(R,Ra,Rb).

merge(A,[],A).
merge([],B,B).
merge([A|Ra],[B|Rb],[A|M]) :- A =<B, merge(Ra,[B|Rb],M).
merge([A|Ra],[B|Rb],[B|M]) :- A >B, merge([A|Ra],Rb,M).
Lists and Sequences (cont.)
• Predicate op/3
– op(+Precedence, +Type, :Name)
– Precedence: 0 ~ 1200
– Type: xf, yf, xfx, xfy, yfx, fy or fx
• f: position of the function
• y: position for term with precedence lower or equal to the precedence of the function
• x: position for term with precedence strictly lower
• Example
– 1200 xfx --> :-
– 1200 fx :- ?-
– 1000 xfy ,
– 200 fy + - \
– 100 yfx .
Use of op/3
:- op(500,xfx,'is_parent').
a is_parent b. c is_parent g. f is_parent l. j is_parent q.
a is_parent c. c is_parent h. f is_parent m. j is_parent r.
a is_parent d. c is_parent i. h is_parent n. j is_parent s.
b is_parent e. d is_parent j. i is_parent o. m is_parent t.
b is_parent f. e is_parent k. i is_parent p.

:- op(500,xfx,'is_sibling_of').
X is_sibling_of Y :- Z is_parent X,
Z is_parent Y,
X \== Y.
:-op(500,xfx,'is_same_level_as').

X is_same_level_as X .
X is_same_level_as Y :- W is_parent X,
Z is_parent Y,
W is_same_level_as Z.

https://www.cpp.edu/~jrfisher/www/prolog_tutorial/2_6.html
Original

Map Coloring 1: red


3: green
2: blue
4: yellow
5: blue
adjacent(1,2). adjacent(2,1). coloring-a
adjacent(1,3). adjacent(3,1). 1: red
adjacent(1,4). adjacent(4,1).
2: blue
adjacent(1,5). adjacent(5,1).
3: green
adjacent(2,3). adjacent(3,2).
adjacent(2,4). adjacent(4,2). 4: yellow
adjacent(3,4). adjacent(4,3). 5: blue
adjacent(4,5). adjacent(5,4). coloring-b
1: red
color(1,red,a). color(1,red,b). 2: blue
color(2,blue,a). color(2,blue,b).
3: green
color(3,green,a). color(3,green,b).
color(4,yellow,a). color(4,blue,b).
4: blue
color(5,blue,a). color(5,green,b). 5: green

https://www.cpp.edu/~jrfisher/www/prolog_tutorial/2_1.html
Map Coloring (v.2)
adjacent(1,2). adjacent(2,1).
adjacent(1,3). adjacent(3,1). [[1,2],[1,3],
adjacent(1,4). adjacent(4,1). [1,4],[1,5],
adjacent(1,5). adjacent(5,1). [2,3],[2,4],
adjacent(2,3). adjacent(3,2). [3,4],[4,5]]
adjacent(2,4). adjacent(4,2).
adjacent(3,4). adjacent(4,3).
adjacent(4,5). adjacent(5,4).

?- color([[1,2],[1,3],[1,4],[1,5],[2,3],[2,4],[3,4],[4,5]],
[red,green,blue,yellow],
Coloring).
Coloring = [[5,red],[4,green],[3,red],[1,blue],[2,yellow]] ; ... /* 48 solutions */

https://www.cpp.edu/~jrfisher/www/prolog_tutorial/2_9.html
Map Coloring (v.2)
adjacent(X,Y,Map) :- color(Map,Colors,Coloring) :-
member([X,Y],Map) ; member([Y,X],Map). find_regions(Map,[],Regions),
color_all(Regions,Colors,Coloring),
find_regions([],R,R). \+ conflict(Map,Coloring).
find_regions([[X,Y]|S], R, A) :- color_all([R|Rs],Colors,[[R,C]|A]) :-
(member(X,R) -> member(C,Colors),
(member(Y,R) -> find_regions(S,R,A) ; color_all(Rs,Colors,A).
find_regions(S,[Y|R],A)) ; color_all([],_,[]).
(member(Y,R) -> find_regions(S,[X|R],A) ;
find_regions(S,[X,Y|R],A) ) ).
conflict(Map,Coloring) :-
IF member(X,R) member([R1,C],Coloring),
THEN {IF member(Y,R) THEN find_regions(S,R,A) member([R2,C],Coloring),
ELSE find_regions(S,[Y|R],A)} adjacent(R1,R2,Map).
ELSE {IF member(Y,R) THEN find_regions(S,[X|R],A)
ELSE find_regions(S,[X,Y|R],A)} map1([[1,2],[1,3],[1,4],[1,5],[2,3],[2,4],[3,4],[4,5]] ).

https://www.cpp.edu/~jrfisher/www/prolog_tutorial/2_9.html
4-Queens Problem
• [3, 1, 4, 2].

• Two queens are on the same / diagonal if and only if


– the sum of the row and column is the same for each
– e.g. 1 + 3, 2 + 1, 3 + 4, 4 + 2
• They are on the same \ diagonal if and only if
– the difference of their row and column is the same number.
– e.g. 1 – 3, 2 – 1, 3 – 4, 4 – 2
https://www.cpp.edu/~jrfisher/www/prolog_tutorial/2_11.html
4-Queens Problem
perm([X|Y],Z) :- combine([X1|X],[Y1|Y],[S1|S],[D1|D]) :-
perm(Y,W), S1 is X1 +Y1,
takeout(X,Z,W). D1 is X1 - Y1,
perm([],[]). combine(X,Y,S,D).
combine([],[],[],[]).
takeout(X,[X|R],R).
takeout(X,[F|R],[F|S]) :- all_diff([X|Y]) :-
takeout(X,R,S). \+member(X,Y), all_diff(Y).
all_diff([X]).
solve(P) :-
perm([1,2,3,4],P),
combine([1,2,3,4],P,S,D),
all_diff(S),
all_diff(D).
November 5, 2020

Quiz next week!


Adversarial Search
• Minimax
• Alpha-Beta pruning
• Constraints
– Real-time
– Non-deterministic
– Partially observable
Original

Map Coloring 1: red


3: green
2: blue
4: yellow
5: blue
adjacent(1,2). adjacent(2,1). coloring-a
adjacent(1,3). adjacent(3,1). 1: red
adjacent(1,4). adjacent(4,1).
2: blue
adjacent(1,5). adjacent(5,1).
3: green
adjacent(2,3). adjacent(3,2).
adjacent(2,4). adjacent(4,2). 4: yellow
adjacent(3,4). adjacent(4,3). 5: blue
adjacent(4,5). adjacent(5,4). coloring-b
1: red
color(1,red,a). color(1,red,b). 2: blue
color(2,blue,a). color(2,blue,b).
3: green
color(3,green,a). color(3,green,b).
color(4,yellow,a). color(4,blue,b).
4: blue
color(5,blue,a). color(5,green,b). 5: green

https://www.cpp.edu/~jrfisher/www/prolog_tutorial/2_1.html
Map Coloring
adjacent(1,2). adjacent(2,1).
adjacent(1,3). adjacent(3,1). conflict(Coloring) :-
adjacent(1,4). adjacent(4,1). adjacent(X,Y),
adjacent(1,5). adjacent(5,1). color(X,Color,Coloring),
adjacent(2,3). adjacent(3,2). color(Y,Color,Coloring).
adjacent(2,4). adjacent(4,2).
adjacent(3,4). adjacent(4,3). ?- conflict(a).
adjacent(4,5). adjacent(5,4). false.

color(1,red,a). color(1,red,b). ?- conflict(b).


true
color(2,blue,a). color(2,blue,b).
color(3,green,a). color(3,green,b).
?- conflict(Which).
color(4,yellow,a). color(4,blue,b).
color(5,blue,a). color(5,green,b).
Which = b
https://www.cpp.edu/~jrfisher/www/prolog_tutorial/2_1.html
Map Coloring (v.2)
adjacent(1,2). adjacent(2,1).
adjacent(1,3). adjacent(3,1). [[1,2],[1,3],
adjacent(1,4). adjacent(4,1). [1,4],[1,5],
adjacent(1,5). adjacent(5,1). [2,3],[2,4],
adjacent(2,3). adjacent(3,2). [3,4],[4,5]]
adjacent(2,4). adjacent(4,2).
adjacent(3,4). adjacent(4,3).
adjacent(4,5). adjacent(5,4).

?- color([[1,2],[1,3],[1,4],[1,5],[2,3],[2,4],[3,4],[4,5]],
[red,green,blue,yellow],
Coloring).
Coloring = [[5,red],[4,green],[3,red],[1,blue],[2,yellow]] ; ... /* 48 solutions */

https://www.cpp.edu/~jrfisher/www/prolog_tutorial/2_9.html
Map Coloring (v.2)
adjacent(X,Y,Map) :- color(Map,Colors,Coloring) :-
member([X,Y],Map) ; member([Y,X],Map). find_regions(Map,[],Regions),
color_all(Regions,Colors,Coloring),
find_regions([],R,R). \+ conflict(Map,Coloring).
find_regions([[X,Y]|S], R, A) :- color_all([R|Rs],Colors,[[R,C]|A]) :-
(member(X,R) -> member(C,Colors),
(member(Y,R) -> find_regions(S,R,A) ; color_all(Rs,Colors,A).
find_regions(S,[Y|R],A)) ; color_all([],_,[]).
(member(Y,R) -> find_regions(S,[X|R],A) ;
find_regions(S,[X,Y|R],A) ) ).
conflict(Map,Coloring) :-
IF member(X,R) member([R1,C],Coloring),
THEN {IF member(Y,R) THEN find_regions(S,R,A) member([R2,C],Coloring),
ELSE find_regions(S,[Y|R],A)} adjacent(R1,R2,Map).
ELSE {IF member(Y,R) THEN find_regions(S,[X|R],A)
ELSE find_regions(S,[X,Y|R],A)} map1([[1,2],[1,3],[1,4],[1,5],[2,3],[2,4],[3,4],[4,5]] ).

https://www.cpp.edu/~jrfisher/www/prolog_tutorial/2_9.html
4-Queens Problem
• [3, 1, 4, 2].

• Two queens are on the same / diagonal if and only if


– the sum of the row and column is the same for each
– e.g. 1 + 3, 2 + 1, 3 + 4, 4 + 2
• They are on the same \ diagonal if and only if
– the difference of their row and column is the same number.
– e.g. 1 – 3, 2 – 1, 3 – 4, 4 – 2
https://www.cpp.edu/~jrfisher/www/prolog_tutorial/2_11.html
4-Queens Problem
perm([X|Y],Z) :- combine([X1|X],[Y1|Y],[S1|S],[D1|D]) :-
perm(Y,W), S1 is X1 +Y1,
takeout(X,Z,W). D1 is X1 - Y1,
perm([],[]). combine(X,Y,S,D).
combine([],[],[],[]).
takeout(X,[X|R],R).
takeout(X,[F|R],[F|S]) :- all_diff([X|Y]) :-
takeout(X,R,S). \+member(X,Y), all_diff(Y).
all_diff([X]).
solve(P) :-
perm([1,2,3,4],P),
combine([1,2,3,4],P,S,D),
all_diff(S),
all_diff(D).
MOE AI 課程問卷
• https://forms.gle/caDyYSbLksbEvnjp9
Challenges for Prolog and ML/DL
• Build your own family tree for over 20 people and 4 generations.
– Either yours or some famous people.
– Define some new relationships other than the basic ones.
– Try to come up with some “missions” that you could do with your knowledge.
– Explain your achievement.
– Due: November 16 (posting on ecourse2)
• Try some tools mentioned by MOST
– https://fgc.stpi.narl.org.tw/activity/video/techai
– TensorFlow https://www.tensorflow.org/ https://www.tensorflow.org/tutorials
– Keras https://keras.io/
– PyTorch https://pytorch.org/
– Kaggle https://www.kaggle.com/
– Google colab https://colab.research.google.com/notebooks
– Due: November 4 to decide which tool to study
– Due: December 10 to demo an example
大家都可以參與
雲端科技
國立中正大學 University
AWSome Day
跟我有關嗎?
有點好奇?
太高科技?
甚麼是AWS?
• Amazon Web Services (AWS) 是 Amazon 全球最全面和廣泛採
納的雲端平台
• AWS 提供雲端與相關技術的力量,包含分析、機器學習和
人工智慧 (AI)、物聯網 (IoT) 協助大型企業進行商業轉型及
幫助新創產業往獨角獸發展
University AWSome Day (UAD) 跟我有什麼
關係?
• 本次講座將帶你深入了解現在科技趨勢當中最夯的雲端發
展,透過實際企業案例分享AWS的技術發展與商業策略等。
• AWS 還提供線上免費學習資源 --- AWS Educate 幫助你瞭解
這股科技趨勢,同時學習雲端知識,並拓展科技業的職涯
機會。
為什麼一定要來參加UAD呢? 免費!!
• 無論你的背景為何,AWS專業技術講師將帶你深入了解
AWS與雲端科技趨勢。
• 報名參加UAD,註冊AWS Educate帳號並填寫會後問卷,以
上三點皆完成的師生即可獲得小禮物與UAD參加證書。

• 中正11/23活動報名連結:
https://www.surveycake.com/s/pdoO7
• 帳號註冊
https://aws.amazon.com/tw/education/awseducate/

You might also like