본문 바로가기

전체 글195

negative sampling Word2Vec 모델에서 negative sampling 이란? 단어뭉치(corpus)의 개수가 100000 개 이고 hidden layer크기가 3000이라 하면, W와 , W`의 크기는 100000x3000 이다. Input vector는 one-hot 벡터로 1숫자만 1이고 나머진 모두 0이다. (중심단어, 주변단어)의 pair로 학습이 이뤄지게 되는데, W의 크기가 100000x3000이나 되지만. input vector가 one hot vector이기 때문에 W중 1줄의 parameter만 선택된다. 하지만 backpropagation과정중에 100000x3000(W`)의 parameter가 softmax함수를 취해야 되고, 계산량이 엄청나게 많아진다. 따라서 계산의 효율성을 위해서 negati.. 2019. 8. 12.
matplotlib, style.use 사용해서 테마바꾸기 print(plt.style.available) 하면 ['bmh', 'classic', 'dark_background', 'fast', 'fivethirtyeight', 'ggplot', 'grayscale', 'seaborn-bright', 'seaborn-colorblind', 'seaborn-dark-palette', 'seaborn-dark', 'seaborn-darkgrid', 'seaborn-deep', 'seaborn-muted', 'seaborn-notebook', 'seaborn-paper', 'seaborn-pastel', 'seaborn-poster', 'seaborn-talk', 'seaborn-ticks', 'seaborn-white', 'seaborn-whitegrid', 'se.. 2019. 7. 26.
matplotlib savefig에서 facecolor, 여백조정하기 fig = plt.figure(figsize=(10,5*len(id[0]/2)),facecolor='w') 이렇게 figure을 만들어써도, fig.savefig(out_fname) 을 하면 facecolor가 반영되지 않는다. 게다가 그림 외에 여백도 너무 크다. 그럴때 fig.savefig(out_fname,dpi=200,facecolor=fig.get_facecolor(),transparent=True,bbox_inches='tight') dpi, facecolor옵션, bbox-inches옵션을 줘서 해결가능. 2019. 7. 17.
matplotlib colormap plot(xy, color)¶ named color b: blue g: green r: red c: cyan m: magenta y: yellow k: black w: white http://matplotlib.org/examples/color/named_colors.html RGB '#aa44ff' {u'aliceblue': u'#F0F8FF', u'antiquewhite': u'#FAEBD7', u'aqua': u'#00FFFF', u'aquamarine': u'#7FFFD4', u'azure': u'#F0FFFF', u'beige': u'#F5F5DC', u'bisque': u'#FFE4C4', u'black': u'#000000', u'blanchedalmond': u'#FFEBCD', u'blu.. 2019. 7. 17.