본문 바로가기

전체 글131

[C++] 익명 네임스페이스, anonymous(unnamed) namespace namespace A { int a; } 이 namespace의 이름은 A 이다. 그렇다면 이건 어떤가? namespace { int a; } 이 namespace는 이름이 없다. 이런 네임스페이스를 익명 네임스페이스 ( anonymous namespace ) 다. 그렇다면 이건 어떻게 동작할까? 익명 네임스페이스는 자신이 위치한 파일 내에서만 존재한다. some_header.h 에 namespace { int a; } 가 있다면 some_header.h 에서는 int a 에 접근 가능하지만 other_header.h 에서는 이 익명 네임스페이스에 접근이 불가능하다. static 과 동일한 역할을 한다고보면된다. static int a 가 전역변수로 있다면 이 변수는 다른 파일에서는 접근 불가능 하지 않.. 2019. 12. 8.
[Python] BeautifulSoup 으로 크롤링하기 table = soup.a # a태그 하나 찾음. table = soup.find('div',{'id' : 'perfect'}) text = table.a.get_text() # table에서 a태그인걸 찾고, 그걸 string으로 변환시킴. 일단 BeautifulSoup를 import하고.. from urllib.request import urlopen from bs4 import BeautifulSoup as bs BeautifulSoup 객체를 만들자. url = "주소" # http://www.naver.com 같은거 html = urlopen(url) source = html.read() html.close() soup = bs(source, "html5lib") # BeautifulSoup 객.. 2019. 11. 10.
[Tensorflow] 선형회귀분석 하면서 함수들 tf.placeholder(자료형, 텐서모양, 이름) tf.placeholder(tf.float32, [None, 2], name='x') 이런식으로 씀. 학습시 데이터를 줄때 placeholder를 쓴다. 데이터의 별명 이라고 보면됨. 나중에 feed_dict로 데이터 줌. tf.Variable(data, 이름) 텐서플로우식 변수선언. tf.constant(data, 자료형) 텐서플로우식 상수선언 h = tf.matmul(X,W) + b 가설함수 선언. 이러면 하나의 operator로 텐서가 생성되나보다 cost = tf.reduce_mean(tf.square(tf.subtract(h, holder_y)) 제곱오차 train = tf.train.GradientDescentOptimizer(learnin.. 2019. 11. 6.
[Tensorflow] 카테고리 이론은 아는데 Tensorflow 사용법을 몰라서 인터넷 보면서 한걸 기록하려고 만듬 2019. 11. 6.