# Math4AI_인공지능을 위한 기초수학_part0인공지능개론(책28-27) -- Sage

## 192 days 전, kwunodong@gmail.com 작성

#책29-거듭제곱법(Power Method) A = matrix(3, 3, [1,2,0, 2,1,2, 1,2,3]) #행렬 A입력 X = vector([1,1,1])# 벡터 X 입력 K10 = (A^10)*X #K10 : A의 10 거듭제곱에 열벡터를 곱한 벡터. K11 = (A^11)*X #K11 : A의 11 거듭제곱에 열벡터를 곱한 벡터. print("A^10X = ", K10) print("A^11X = ", K11) dom_ev = K11[0]/K10[0] print("dominant eigenvalue = ", dom_ev.n()) print("corres. eigenvertor = ", n((1/K10[0])*K10)) print(A.eigenvalues())
 ('A^10X = ', (3498205, 6681695, 9264127)) ('A^11X = ', (16861595, 32206359, 44653976)) ('dominant eigenvalue = ', 4.82007057905412) ('corres. eigenvertor = ', (1.00000000000000, 1.91003528952706, 2.64825160332228)) [-1.279452315768607?, 1.459362941393819?, 4.820089374374788?] ('A^10X = ', (3498205, 6681695, 9264127)) ('A^11X = ', (16861595, 32206359, 44653976)) ('dominant eigenvalue = ', 4.82007057905412) ('corres. eigenvertor = ', (1.00000000000000, 1.91003528952706, 2.64825160332228)) [-1.279452315768607?, 1.459362941393819?, 4.820089374374788?]
#책29-거듭제곱법(Power Method) A = matrix(3, 3, [1,2,0, 2,1,2, 1,2,3]) #행렬 A입력 X = vector([1,1,1])# 벡터 X 입력 K10 = (A^10)*X #K10 : A의 10 거듭제곱에 열벡터를 곱한 벡터. K11 = (A^11)*X #K11 : A의 11 거듭제곱에 열벡터를 곱한 벡터. print("A^10X = ", K10) print("A^11X = ", K11) dom_ev = K11[0]/K10[0] print("dominant eigenvalue = ", dom_ev.n()) print("corres. eigenvertor = ", n((1/K10[0])*K10)) print(A.eigenvalues())
 ('A^10X = ', (3498205, 6681695, 9264127)) ('A^11X = ', (16861595, 32206359, 44653976)) ('dominant eigenvalue = ', 4.82007057905412) ('corres. eigenvertor = ', (1.00000000000000, 1.91003528952706, 2.64825160332228)) [-1.279452315768607?, 1.459362941393819?, 4.820089374374788?] ('A^10X = ', (3498205, 6681695, 9264127)) ('A^11X = ', (16861595, 32206359, 44653976)) ('dominant eigenvalue = ', 4.82007057905412) ('corres. eigenvertor = ', (1.00000000000000, 1.91003528952706, 2.64825160332228)) [-1.279452315768607?, 1.459362941393819?, 4.820089374374788?]
#책31~39 MNIST 데이터셋을 활용한 손 글씨 숫자인식(패턴인식) """ 내용이 많은 관계로 아래와 같이 3단계로 나눠서 실행한다. #책31~32/패턴인식 1단계:MNIST 학습 데이터csv파일을 불러오기 """

#책31~39 MNIST 데이터셋을 활용한 손 글씨 숫자인식(패턴인식) #책31~32/패턴인식 1단계:MNIST 학습 데이터csv파일을 불러오기 import numpy #행렬을 시각화하기 위한 라이브러리 import matplotlib.pyplot import csv import urllib.request import codecs url 'https://media.githubusercontent.com/media/freebz/Make-Your-Own-Neural-Network/master/mnist_dataset/mnist_dataset/mnist_test_10.csv' response = urllib.request.urlopen(url) training_data_file = csv.reader(codecs.oterdecode(response, 'uft-8')) training_data_list = list(training_data_file) all_values = training_data_list[0] image_array = numpy.asfarray(all_values[1:]).reshape((28,28)) matplotlib.pyplot.imshow(image_array,cmap ='Greys', interpolation='None') matplotlib.pyplot.savefig('foo.png') responese.close()
 Traceback (click to the left of this block for traceback) ... ImportError: No module named request Traceback (most recent call last): import matplotlib.pyplot File "", line 1, in File "/tmp/tmpbqtecs/___code___.py", line 10, in import urllib.request ImportError: No module named request
'https://media.githubusercontent.com/media/freebz/Make-Your-Own-Neural-Network/tree/master/mnist_dataset/mnist_test_10.csv'