ratsgo / embedding

한국어 임베딩 (Sentence Embeddings Using Korean Corpora)
https://ratsgo.github.io/embedding
MIT License
452 stars 129 forks source link

버그 수정에 따른 시각화 재반영 #54

Closed ratsgo closed 4 years ago

ratsgo commented 4 years ago

개요

attention 버그 수정에 따른 시각화 재반영

ratsgo commented 4 years ago

code

import pandas as pd
import numpy as np
from bokeh.palettes import Spectral11
from bokeh.plotting import figure, show

row_data = np.array([[0.7716, 0.8040, 0.8203, 0.8288, 0.8341, 0.8407, 0.8389, 0.8456, 0.8487, 0.8487, 0.8515],
                     [0.8204, 0.8380, 0.8465, 0.8518, 0.8553, 0.8588, 0.8622, 0.8636, 0.8648, 0.8653, 0.8678]]).T
col_data = np.array([el + 1 for el in range(11)])

df = pd.DataFrame(data=row_data, columns = ('Random', 'FastText'), index = col_data)

numlines=len(df.columns)
mypalette=Spectral11[0:numlines]

p = figure(width=600, height=400, title="1000 스텝별 테스트 정확도")
p.line(x=df.index.values,
       y=df['Random'].values,
       line_color=Spectral11[0],
       line_width=5,
       legend="Random")
p.line(x=df.index.values,
       y=df['FastText'].values,
       line_color=Spectral11[1],
       line_width=5,
       legend="FastText")
p.legend.location = "bottom_right"
p.legend.label_text_font_size = '15pt'
show(p)

그림

bokeh_plot

ratsgo commented 4 years ago

code

import pandas as pd
import numpy as np
from bokeh.palettes import Spectral11
from bokeh.plotting import figure, show

row_data = np.array([[0.5673, 0.4490, 0.4064, 0.3831, 0.3639, 0.3483, 0.3381, 0.3250, 0.3164, 0.3059, 0.2977],
                     [0.4878, 0.3837, 0.3516, 0.3353, 0.3203, 0.3058, 0.2969, 0.2856, 0.2776, 0.2691, 0.2615]]).T
col_data = np.array([el + 1 for el in range(11)])

df = pd.DataFrame(data=row_data, columns = ('Random', 'FastText'), index = col_data)

numlines=len(df.columns)
mypalette=Spectral11[0:numlines]

p = figure(width=600, height=400, title="1000 스텝별 학습 손실")
p.line(x=df.index.values,
       y=df['Random'].values,
       line_color=Spectral11[2],
       line_width=5,
       legend="Random")
p.line(x=df.index.values,
       y=df['FastText'].values,
       line_color=Spectral11[3],
       line_width=5,
       legend="FastText")
p.legend.location = "top_right"
p.legend.label_text_font_size = '15pt'
show(p)

그림

bokeh_plot (1)

ratsgo commented 4 years ago

code

import pandas as pd
import numpy as np
from bokeh.palettes import Spectral11
from bokeh.plotting import figure, show

row_data = np.array([[0.3953, 0.3270, 0.2923, 0.2627, 0.2326, 0.2021, 0.1716, 0.1449, 0.1199],
                     [0.8452, 0.8589, 0.8702, 0.8729, 0.8730, 0.8733, 0.8744, 0.8732, 0.8704]]).T
col_data = np.array([el + 1 for el in range(9)])

df = pd.DataFrame(data=row_data, columns = ('loss', 'acc'), index = col_data)

numlines=len(df.columns)
mypalette=Spectral11[0:numlines]

p = figure(width=600, height=400, title="ELMo")
p.line(x=df.index.values,
       y=df['loss'].values,
       line_color=Spectral11[0],
       line_width=5,
       legend="loss")
p.line(x=df.index.values,
       y=df['acc'].values,
       line_color=Spectral11[1],
       line_width=5,
       legend="acc")
p.legend.location = "center_right"
p.legend.label_text_font_size = '15pt'
show(p)

bokeh_plot (2)