๐Ÿ’ฟ Data/์ด๋ชจ์ €๋ชจ

    ๋ฒ ์ด์ง€์•ˆ ์˜ˆ์‹œ ํ’€์ด(Bayesian Problem example)

    1๋ฒˆ At a certain stage of a criminal investigation, the inspector in charge is 60% convinced of the guilty of a certain suspect. Suppose now that a new piece of evidence that shows that the criminal has a left-handedness is uncovered. If 20% of population possesses this characteristic, how certain of the guilt of the suspect should the inspector now be if it turns out that the suspect is among th..

    ํฐ ์ˆ˜์˜ ๋ฒ•์น™, ์ค‘์‹ฌ๊ทนํ•œ์ •๋ฆฌ ์ฝ”๋“œ๋กœ ๊ตฌํ˜„

    1. ํฐ ์ˆ˜์˜ ๋ฒ•์น™ df3.describe() # ๋Œ€๋žต์ ์ธ ๋ฐ์ดํ„ฐ์˜ ๋ชจ์ˆ˜๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. ๋Œ€๋žต 5000๊ฐœ๋งŒ ๊ฐ€๋„ ๊ฐ’์ด ๋น„์Šทํ•ด์ง€๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. dat = [] np.random.seed(42) for i in np.arange(start = 0, stop = 18000, step = 100) : s = np.random.choice(df3, i) dat.append(s.var()) dat (pd .DataFrame(dat) .plot .line(color = '#4000c7') .axhline(y = 192, color = '#00da75') ); ํ‘œ๋ณธ์˜ ์ˆ˜๊ฐ€ ๋งŽ์•„์งˆ์ˆ˜๋ก ์ ์ฐจ ๋ถ„์‚ฐ๊ฐ’์ด ์ˆ˜๋ ดํ•˜๋Š” ๋ชจ์Šต์„ ํ™•์ธํ•˜์˜€์Šต๋‹ˆ๋‹ค. 2. ์ค‘์‹ฌ๊ทนํ•œ์ •๋ฆฌ sample_means = []..

    ANOVA ์˜ˆ์‹œ, ์—ฌ๋Ÿฌ ์ƒ˜ํ”Œ๋ง

    1. ANOVA ๋ฐ์ดํ„ฐ ์ „์ฒ˜๋ฆฌ๋Š” ์ƒ๋žตํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. df_tree.head() df_tree_mel = df_tree.reset_index().melt(id_vars='index', value_vars=['์€ํ–‰๋‚˜๋ฌด','์–‘๋ฒ„์ฆ˜๋‚˜๋ฌด','๋Šํ‹ฐ๋‚˜๋ฌด']) # ์ด์ƒ์น˜ ๋ฐ ์‹œ๊ฐํ™”๋ฅผ ์œ„ํ•œ melting from scipy import stats stats.f_oneway(df_tree['์€ํ–‰๋‚˜๋ฌด'], df_tree['์–‘๋ฒ„์ฆ˜๋‚˜๋ฌด'], df_tree['๋Šํ‹ฐ๋‚˜๋ฌด']) F_onewayResult(statistic=17.006289557888046, pvalue=8.935183167883698e-07) ๊ท€๋ฌด๊ฐ€์„ค(H0) : ์„œ์šธ์‹œ์˜ ..

    Python ๋ฏธ๋ถ„

    ์‹œ๊ทธ๋ชจ์ด๋“œ ํ•จ์ˆ˜ ๋„ํ•จ์ˆ˜ ๊ตฌํ•ด์„œ ๊ฐ’ ๊ตฌํ•ด๋ณด๊ธฐ from math import exp def sig(x): return 1 / (1 + exp(-x)) # ์›ํ•จ์ˆ˜ ์ •์˜ from scipy.misc import derivative def sig_prime(x): return derivative(sig, x, dx=1e-5) sig_prime(3) # x=3 ์ผ ๋•Œ์˜ ๊ฐ’ ๊ตฌํ•ด๋ณด๊ธฐ 0.04517665972980644

    ๋ฐ์ดํ„ฐ ์ •๋ฆฌ ๋ฐ ์‹œ๊ฐํ™” ์˜ˆ์‹œ ๊ธฐ๋ก

    from google.colab import files uploaded = files.upload() import pandas as pd # ์—…๋กœ๋“œํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ์ง„ํ–‰ํ•˜์˜€์Šต๋‹ˆ๋‹ค. file1 = pd.read_csv('n113_๋งˆ๋ฆฌํ™”๋‚˜.txt', sep='\t') file2 = pd.read_csv('n113_ํ•ด์šด.txt', sep='\t') # txt ๋ฐ์ดํ„ฐ๋ผ ๊ตฌ๋ถ„์ž๋ฅผ ์ •ํ•ด์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค. ๋ฐ์ดํ„ฐ ์ „์ฒ˜๋ฆฌ ๊ณผ์ • ์ฝ”๋“œ๋Š” ์ƒ๋žตํ•˜๊ณ˜์Šต๋‹ˆ๋‹ค. ์œ„์™€ ๊ฐ™์ด ๋ฐ์ดํ„ฐ๋ฅผ ์ •๋ฆฌํ•œ ํ›„ 'ํ…Œ๋งˆ'๋กœ ๊ฐ ์ปฌ๋Ÿผ์˜ ํ‰๊ท  ํ…Œ์ด๋ธ”์„ ๋งŒ๋“ค์—ˆ์Šต๋‹ˆ๋‹ค. df1 = df.groupby('ํ…Œ๋งˆ').mean() !sudo apt-get install -y fonts-nanu..