Professional Documents
Culture Documents
Artificial Intelligence in Advance 2019 Lecturer: September 2019
Artificial Intelligence in Advance 2019 Lecturer: September 2019
Artificial Intelligence in Advance 2019 Lecturer: September 2019
net/publication/335684104
CITATIONS READS
0 166
1 author:
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by nguyen dinh Cuong on 08 September 2019.
Import java.util.Scanner;
Import java.math.Bignumber;
Class Main {
public static void main (String[] args) {
BigInteger fac = BigInteger.ONE;
for (int i=2 ; I <=25 ; i++)
fac =fac.multiply (BigInteger.ValueOf(i));
System.out.println(fac);
}
}
Nếu mỗi viên gạch là 1mx1mx1m 264 − 1 𝑣𝑖ê𝑛 𝑔ạ𝑐ℎ 𝑐ó 𝑙ấ𝑝 đượ𝑐 𝑏𝑖ể𝑛 𝑘ℎô𝑛𝑔
BIG NUMBER
#include <cstdio>
using namespace std;
int N;
char x[100];
int main() {
scanf(“%d\n”, &N);
while (N--) {
scanf(“0..%[0..9]...\n”, &x);
}
printf(“the digits number are 0.%s\n”,x);
}
Parallel OpenMP
#include <omp.h>
#include <stdio.h>
int main (int argc, char *argv[]) #pragma omp parallel for
{
/* sequencetial code */ for ( i = 0; i < N ; i ++ ) {
#pragma omp parallel c[i] = a [i] + b [i];
{ }
printf(“ I am a parallel region.”);
}
/* sequence code */
return 0;
}
#include <pthread.h>
#include <stdio.h>
Non-runnable
Runable
Block
Terminated
Method Meaning
getname Obtain thread’s name
getPriority Obtain thread’s priority
isAlive Determine if a thread is still running
join Wait for a thread to terminate
run Entry point for the thread
sleep Suspend a thread for a period of time
RunnableDemo(String name) {
threadName name;
System.out.println(“Creating” + threadName);
}
System.out.println(“Running “ + threadName);
try {
for (int i=4; i>0; i--) {
System.out.println(“Thread:” + threadName + “, “ + i);
// Let the thread sleeo for a while
Thread.sleep(50);
}
}
} catch (InterruptedException e) { public class TestThread{
System.out.println(“thread” + threadName + “ interrupted.”); public static void main (String args[]) {
}
RunnableDemo R1 = new RunnableDemo(“Thread -1 “);
System.out.println(“Thread “ + threadName + “exiting.”);
R1.start();
}
𝑥𝑛 + 𝑦𝑛 = 𝑧𝑛, 𝑛 > 2
<%
// New instance of prolog engine
JIPEngine jip = new JIPEngine();
JIPTerm queryTerm = null;
// collector for solution
Vector vect = new Vector();
// parse query
try
{
// consult file
// files are searched in the search path
jip.consultFile("bible.pl");
queryTerm = jip.getTermParser().parseTerm("father(X, Y).");
}
catch(JIPSyntaxErrorException ex)
{
ex.printStackTrace();
}
catch(IOException ex)
{
ex.printStackTrace();
}
// open Query
JIPQuery jipQuery = jip.openSynchronousQuery(queryTerm);
JIPTerm solution;
try
{
// Collect solutions
// Loop while there is another solution
while ((solution = jipQuery.nextSolution()) != null)
{
vect.addElement(solution);
}
}
catch(JIPRuntimeException ex)
{
System.out.println(ex.getMessage());
}
%>
<BODY BGCOLOR="white">
<B> Solutions: </B>
<ul>
<%
// print solutions
for(int i = 0; i < vect.size(); i++)
{
%>
<li> <%= vect.elementAt(i) %>
<%
}
%>
</ul>
</BODY>
</HTML>
SPARQL – Web Semantic
SPARQL
package jena.examples.rdf ;
import org.apache.jena.rdf.model.*;
import org.apache.jena.vocabulary.*;
SELECT ?craigEmail
WHERE { ab:craig ab:email ?craigEmail . }
# filename: ex002.ttl
MFCCs features
s(n)
windows DFT | |2 Filterbank Log
𝑁−1
2𝜋𝑗
𝑥 𝑘 = 𝑥 𝑚 exp − 𝑘𝑚
N Discrete
𝑚=0 Cosine
DFT Transform
𝑘
𝑧 = exp 2𝛱𝑗
𝑁
Energy
X 𝑧 = σ𝑁−1
𝑚=0 𝑥 𝑚 𝑧
−𝑚
Mel
Filterbank d/dt
spectrum - cepstrum
Log
d2/dt2
𝜑1 1 = 1
𝜑𝑖 1 = 𝑎1𝑗 𝑏𝑗 𝑜1
2. D[i, j] = D[i-1, j] +1 cho trường hợp chèn một kí tự vào chuỗi S tại vị trí i.
3. D[i, j] = D[i, j-1] +1 cho trường hợp xóa kí tự ở chuỗi P tại vị trí j.
from gtts import gTTS
tts = gTTS(text='Xin chào các bạn em hát bài diễm xưa', lang='vi')
tts.save("chao.mp3")
#include "stdafx.h"
#include <iostream>
#include <io.h>
#include <fcntl.h>
#include <string>
#include <windows.h>
#include <fstream>
int main()
{
_setmode(_fileno(stdin), _O_U16TEXT);
_setmode(_fileno(stdout), _O_U16TEXT);
SetConsoleTitleW(L"Việt Nam Vô Địch!");
HANDLE hdlConsole = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_FONT_INFOEX consoleFont;
consoleFont.cbSize = sizeof(consoleFont);
GetCurrentConsoleFontEx(hdlConsole, FALSE, &consoleFont);
memcpy(consoleFont.FaceName, L"Consolas", sizeof(consoleFont.FaceName));
SetCurrentConsoleFontEx(hdlConsole, FALSE, &consoleFont);
fclose(f);
//std::wofstream f(L"ketqua.txt");
𝐶 𝑤𝑖−𝑛+1 … , 𝑤𝑖 //f << test.c_str() << std::endl;
𝑃 𝑤𝑖 ȁ𝑤1 , ⋯ , 𝑤i−1 = //f.close();
𝐶 𝑤𝑖−𝑛+1 , ⋯ , 𝑤𝑖−1 system("pause");
return 0;
}
Speech synthesis
Multimedia
Bảng tần số
Nốt nhạc Bát độ 3 Bát độ 4 Bát độ 5 Bát độ 6
C 131 262 523 1047
C# 139 277 554 1109
D 147 294 587 1175
D# 156 311 622 1245
E 165 330 659 1319
F 175 349 698 1397
F# 185 370 740 1480
G 196 392 784 1568
G# 208 415 831 1661
A 220 440 880 1760
A# 233 466 932 1865
B 247 494 988 1976
Harmonica Effects
C (Đồ) D (Rê) E (Mi) F (Fa) G (Sol) A (La) B (si) C (Đô)
Why using cosin distance for this
Tranlation Machine
Using dictionary and Grammer
ĐỀ CÁT
JAVA and OpenCV
1. javac -classpath .;opencv-400.jar EqualizeHistDemo.java
2. java -classpath .;opencv-400.jar EqualizeHistDemo lena.jpg Using java for opencv
NetBean IDE
Combine model
Speech model
BÀI TOÁN CÁI TÚI
Mỗi con vật được vẽ bởi một tiến trình
S = {𝑦𝑚 ∈ 𝑅, 𝜇 𝑦𝑛 = 𝑆𝑈𝑃𝑦𝜖𝑅 (𝜇 𝑦 )}
Turn over
𝑦 𝑆. 𝜇 𝑢 d𝑦
defuzzy =
𝑢 𝜇 𝑆d𝑦
Rule 1: IF e=ZE AND delta =ZE THEN output =ZE
mu(1) = MIN (0.7, 0.3)=0.3
output(1)=0
DeFuzzier
Fuzzy question
0.3⋅0+0.7.(−0.5)+0.1+0.3.(−1)
= =-0.5
0.3+0.7+0+0.3
Robotics wireless communication
MIMO
Correlation caculate
d
SIMO
Những người con trai của đất nam kì lục tỉnh
Viterbi algorithm
𝜙𝑗 𝑡 = 𝑚𝑎𝑥𝑖 𝜙𝑖 𝑡 − 1 𝑎𝑖𝑗 𝑏𝑗 𝑜𝑡
𝜑1 1 = 1
𝜑𝑖 1 = 𝑎1𝑗 𝑏𝑗 𝑜1
𝑟
σ𝑅𝑟=1 σ𝑇𝑟 𝑟
𝑡=1 𝜓𝑗𝑠𝑚 (𝑡)𝑜𝑠𝑡
𝜇Ƹ 𝑖𝑗 = R 𝑇𝑟 𝑟
𝛴𝛤=1 𝛴𝑡=1 𝜓𝑗𝑠𝑚 𝑡
𝑅 𝑇 𝑟 𝑟 𝑟
𝛴𝑟=1 𝑟
𝛴𝑡=1 𝜓𝑗𝑠𝑚 𝑡 (𝑂𝑠𝑡 − 𝜇Ƹ 𝑗𝑠𝑚 )(𝑂𝑠𝑡 − 𝜇Ƹ 𝑗𝑠𝑚 )𝑇
𝛴𝑗𝑠𝑚 =
σ𝑅𝑟=1 σ𝑇𝑡=1
𝑟 𝑟
𝜓𝑗𝑠𝑚 (𝑡)
𝑟
σ𝑅𝑟=1 σ𝑇𝑟
𝑡=1 𝜓𝑗𝑠𝑚 (𝑡)
𝑐𝑗𝑠𝑚 = R 𝑇𝑟 𝑀 𝑠 𝑟
𝛴𝛤=1 𝛴𝑡=1 𝛴𝑡=1 𝜓𝑗𝑠𝑚 𝑡
Markov Chains
𝑁−1
𝛼𝑗 𝑡 = 𝛼𝑖 𝑡 − 1 𝑎𝑖𝑗 𝑏𝑗 𝑜𝑡
𝑖=2
𝛼1 1 = 1
𝛼𝑗 1 = 𝑎1𝑗 𝑏𝑗 𝑜1
1≤𝑗≤𝑁 1≤t≤T
𝑁−1
𝛼𝑁 𝑇 = 𝛼𝑖 𝑇 𝑎𝑖𝑁
𝑖=2
Forward algorithm
Terminal: 𝑃 0ȁ𝜆 = σ𝑁
𝑖=1 𝛼 𝑇 𝑖
Markov Chains
Backward algorithm
Forward algorithm
𝛽𝑡 i = 𝑃(𝑂𝑡+1 , 𝑂𝑡+2 , … , 𝑂𝑇 ȁ𝑞𝑡 = 𝑖, 𝜆)
1. Initialization
1. Initialization
𝑣1 𝑗 = 𝜋𝑗 𝑏𝑗 (𝑂1 ) 1≤𝑗≤𝑁
1≤𝑗≤𝑁 𝛽𝑇 i = 1 1≤i ≤𝑁
𝑏𝑡1 𝑗 = 0
2. Recursion 2. Recursion 𝑁
𝑁
𝑣𝑡 𝑗 = 𝑚𝑎𝑥𝑖=1 𝑣𝑡−1 (𝑖)𝑎𝑖𝑗 𝑏𝑗 (𝑂𝑡 ) 1 ≤ 𝑗 ≤ 𝑁, 1<t ≤ 𝑁 𝛽𝑡 i = 𝑎𝑖𝑗 𝑏𝑗 𝑜𝑡+1 𝛽𝑡+1 j 1 ≤ 𝑗 ≤ 𝑁, 1<t ≤ T
𝑗=1
𝑁
𝑏𝑡1 𝑗 = 𝑎𝑟𝑔𝑚𝑎𝑥𝑖=1 𝑣𝑡−1 (𝑖)𝑎𝑖𝑗 𝑏𝑗 (𝑂𝑡 ) 1 ≤ 𝑗 ≤ 𝑁, 1<t ≤ 𝑁 3. Termination
3. Termination 𝑁
𝑁 P Oȁ𝜆 = 𝜋𝑗 𝑏𝑗 𝑜1 𝛽1 j
The best score 𝑃 ∗ = 𝑚𝑎𝑥𝑖=1 𝑣𝑇 (𝑖) 𝑗=1
𝑁
The start of backtrace 𝑞 𝑇 ∗ = 𝑎𝑟𝑔𝑚𝑎𝑥𝑖=1 𝑣𝑇 (𝑖)
E - step
𝛼𝑡 𝑗 𝛽𝑡 𝑗
𝛾𝑡 𝑗 = ∀𝑡 and 𝑗
𝛼 𝑇 𝑞𝐹
𝑁
M - step
𝑃 0ȁ𝜆 = 𝛼 𝑇 𝑖
σ𝑇−1
𝑡=1 𝜉𝑡 𝑖, 𝑗 𝑖=1
𝑎ො𝑖𝑗 = 𝑇−1 𝑁
σ𝑡=1 σ𝑡=1 𝜉𝑡 𝑖, 𝑗 Chuỗi trạng thái tối ưu
σ𝑇𝑡=1,𝑠,𝑡,𝑂𝑡=𝑣𝑘 𝛾𝑡 𝑗
𝑏𝑗 (𝑣𝑘 ) =
σ𝑇𝑡=1 𝛾𝑡 𝑗
Implementation Hmm Model
Có ông vua trẻ xuất quân qua rừng dẹp quân xâm lấn
Quân vương giữa hoa rừng lòng bàng hoàng nhớ người thương
THANK YOU