0% found this document useful (0 votes)
4 views21 pages

Untitled Notebook

Uploaded by

lengoctrung299
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)
4 views21 pages

Untitled Notebook

Uploaded by

lengoctrung299
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/ 21

Po =

(x y , ,
z)
26(10/2024 find tintrong thong gran 64 Po &P (x+ )
(xy, (ey
Translation dichuyer
s
+ sy = z+
= + = + = +
: ,
R= b
+ Sp
; = P+ &Pi---iPn Pn
=
+ AP
Mesh Transformation
0 -8
- Rotation
:
You
⑦ Rigid Transform :

② Norregid Transform : 0-0-0- scaling

Mesh Deformation 0 -1 - >


:

i -] point
O

O
do,
yedy
Meshe Mesha
Mech1, 2

Transform Method
=>

(0 ,
0 2 .

, %)


hep thuger Inhas Al

in harm thana
-

Ldi lien)
maria
May maphing
vithient
-

= li har

Health

I
care

label

- -phan

i
east
thats

I where b) y)
- saran tran

1-
uni
s dung

-
b. Thu data . ⑭t
( output)
↑hlik-beatspin
bed
for - bui
is
·
Classification

I
-
-

phan loai Supervised learning


-
=

-
supervised learning -

>
-
Davao 1
tap dilieu
,

I
b
at
·
(
y xy +
am + + c.
=
kn + -
x ....

-
Find tran
distance -
tholm
distance = Square
-y
100
sample
distance

In = (ais dis Ensu ,


n) I?

· i
Learning
supervised
O
el

In- ① -

10-d-de-In

Il
A Z = t

C 1 z2-111 + Ide-deal +·
Ina-mod

=
S la + dy +
us /

· = + doo + 1000

= oo
.

he
↓ nearest neighbor


↑ noo-healin

⑭2
k = 3
-
J

-5a
I * (3,4)
·
is 28.D


(3-5) YB + -

2)
↓, L I
loss function Cost function
,
-

=
Vi- z

·
I
-

141
:
-12 + (4-5) 13-1 H-1 + +

zas
k ze1

ass
= A
.

2 - 2 I
3
2 -> T

7 - 4 =

t-

> 5 =

image (pixel
• Write the answers CLEAN and TIDY directly in the exam paper.
• Show all of your works, the grades will be based on your progress.
• This exam has 3 pages of questions.

[The questions from here…]


QUESTIONS
RNN
Classici
PART I
Q1. (20 marks) , s

a. What is artificial intelligence (AI)? Please give an example of how an AI works to solve a problem.
b. Assume that you utilize an AI model to predict whether using heavy social media linked to poor sleep
pattern and mental health issues. Identify in details what is the information needed to address this
problem (What are the input variables and output(s) that you identify to address this problem?). In order
to collect those information, how can you do it? Please describe the scenario(s) that you can think of.


-

Q2. (20 marks)


In this problem, you need to predict the severity of Alzheimer’s disease (AD) with 3 levels: healthy, MCI (Mild
Cognitive Impairment), and AD from the input variables MMSE (mini mental state examination) score , CDR
(clinical dementia rating) score , hippocampus volume , ventricle volume , and neurofibrillary tangle (NFT)
severity using KNN (K=1). Given that you have 100 samples of training set of input , , …, , and corresponding
output , ,…, .
a. Write the formula to calculate distance of testing sample and the first training sample .
b. Write the code of the loop to calculate distance of the testing sample to all 100 training samples, find the
minimal distance, and predict the value of .
Given the L1 distance formula in general: (each sample has variables)

Q3. (20 marks)


Assume you have ais
dataset of 20.000 samples of the personal medical insurance costs, the input information
In 12 here 25
includes age, sex, BMI, children (the number of children that person has, i.e., 0, 1, 2, 3, 4), smoker (the
26 y
smoking status of that person, which is yes/no), region (the city/province where that person lives), and the
output is the cost charged of the medical insurance of each sample.

& Classification or regression?) -


a. Which algorithm(s) that you can use to predict the medical insurance cost (KNN or linear regression?

Explain how do you apply the algorithm to predict the medical insurance cost in details (why do you
apply this algorithm, what is the principle of the algorithm, how do you apply the algorithm to predict
the cost, how do you optimize the algorithm, which loss function do you use to optimize the algorithm,
etc.).
c. Assume that you use linear regression to predict the medical insurance cost, write the loss function (you
define the variables, for examples, define age as ) and the solution of the weights of the linear
regression.

Q4. (20 marks)


Assume you have a dataset of 20.000 samples related to diabetes, which has below input variables:
- Pregnancies: Number of times pregnant, in range of
- Glucose: Plasma glucose concentration a 2 hours in an oral glucose tolerance test, in range of
- BloodPressure: Diastolic blood pressure (mm Hg) , in range of
(
A

ach Train

Test >
-
- day

Kara

medical I cast
predicted :

y
kNN ,
Classification
,
Linear
20 .
000

-Buil from scratch train


>
-

goi hai 19. 000


. 000
1
feet

- Define function kNN (training data testing


,
data ,
1)
Mi

Computethe dance
100 ra

i
-

-
Sort distance base on compute distance

- Select K : h = 3

-
predict the a medical insurance cost

print (predict)

I
Train
number
Define of training sample
-
: : 100

-
1fidecvesm) :
arrays
define of training sample
the
array
-

(Chodn She Minn) , ... (200 , Goo , hos Moos new


-Define output : =
yes-- ( y200) (y-train) -

Test
-

Define input : (201 > does Geor ho not

output :
Y 101

I Emmadea-de
1
2 chon-2 + doon-dz
compute distance : i + (1 +
000) 3/120-chy g
for On
-
from 1 to 100 :
100 /
!
non-soo

:
-
distance =
(x101-Xi) +
1de01-dil + 1001- Oil /monil +

: distance = 1
Ieop-di) Caron-ri Creon-ni)
+ + +

i = 1 >
-
i = 2

Sort distance min-distance = 0 Vyz


distance [1]
#distance] is
distance
distances
-
-
-

⑰ 1 >
-

min-distance
distance
=
5
=
5
i 3
⑫ Ye
= >
-

Ye
⑰- >
distance =
4
227 13
min

new imn-distance <A distanc (574)


min-distance =
4
i = 3
>
-
distance =
3 .
5

ne mindistance > distance (4 > 3 5) .

mir .
distance = 3 . 5

>
-
Select R = 1
> Yeo YEmin distance)
=
-

print (ymindistance

I
k= 1 >
-

y
=

ymindistance >
-

R122

I &
>
-

H Y =
mindistance -
1 2

D >
Yhmin distan A -
3
Y
= -
= -

oint ("your in class 1)


-
Tian hos Diem X
Y

i aI I I
.

to
5 25 4906 350
8649
No 1761 93
74 5476 222

7744704
s 4762345
6241632
80 6400 400


I
1 55 3025 55
36 68 4624 408

8 IXy =
4391

Step 1 : Ex =
56* = 5 .

6 Ext = 374EX) : 3136

= y= 745) = = 14 5 . = y2 =
56581(77722555025

Steps
:

SS u

555025
Ssyy 56581- 55 502 5
- =
>
- >
.

,
10

I
1078, 5

SSXX = 374 -

316 = 313 , 6

- 60 ,
4
Tonig Tick ches
SSxy = IXY
- 4391-55
= 1391 -

7172 = 219
how hiing than so'
g

*
# doe how be (a)
guy

S-1936
a =
!

b =
y
-

by =
y
-
ai = 74 . 5 -
3, 636 56
.

= 54, 14

Arring hot quy

Y = 3 , 626c + 54 , 14

Finh Oh :
>
- Aim ?

y =
3
, 626x8 + 54 , 14 = 83 ,
148(d)
1
.

Lj thuyes,
eai
tap

3 .. Code - Spendocode

T)
Sum

?
-maj
1 AL lagi
\mophong
.

connquai
-

Choc ,
whin
,
translate
-

Learning
Machine : ↑Phar
Mash <
E
, 4)

i
classification
-

Test

Test
T
=

&
f
>
#

= &
&Absolute
:
tance

Square Roots

B
Im
=
+( -o + (4 3)
-

+ 13 1)
-

+. -
.
+
(1 1) =
-

zu2
+
-
(4-5 - ( -

4 =

W
Linear
Regression
yd X
ax +

Y
- Tian X2 Dien
8 4908

i wi s ton
-
e
5 25

I
·
-

8bya
,

106

54
⑬3
47
S
5 25

8 64

5 6400
55
68

(x) 3136
⑧ O
=

[x =
56 - = 5 . 6 Ex 374 =

Ey = 745 +
* = 74 .

5242 = 56581
# IXy =
4391

Step 1 : Ex =
5* = 5 .

6 zx" = 374EX)" -
3136

= y= 745) y = 14 5. = y2 =
56581(777225552

&
EXy_
i) >b = y a

&
=
-

at 11
6

b = 74 . 5 -
3 32 .
- 56 .
=
54 228 .
hi

-2302 = 3 62x
. + 5423 = 3 32 8 + 51
, .
.

LY-Ypredict
disc

function : di livese

ah
In this problem, you need to predict the severity of Alzheimer’s
& A -

disease (AD) with -


- 3 levels: healthy,
> - MCI
- (Mild Cognitive Impairment),
and AD from the input variables - MMSE (mini mental state
2

examination) score , CDR (clinical dementia rating) score ,


-

hippocampus volume , ventricle volume , and neurofibrillary tangle


-
-

(NFT) severity using KNN


= (K=1). Given that you have -
100 samples of
training set of input , , ..., , and corresponding output , ,..., .
a. Write the formula to calculate distance of testing sample and the
first training sample .
b. Write the code of the loop to calculate distance of the testing
sample to all 100 training samples, find the
minimal distance, and predict the value of .
E
Given the L1 distance formula in general: (each sample has variables)
,

⑭The, ⑭ not
#Define
d : variables
100 samples
!
training set

t odnos ---

not
: Predict
#code

Li
.

distance B
Compute :
=

-
-
distanci
min-distance Dindistance) distance [i]

Select K = 1
-

class[toD) =
class [i)

>
-
print
-

You might also like