This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymc3 as pm | |
da_points_solved = [47,55,39,36,27,37,31,33,39,38,20,52,36,40,10,41,42,11,20,15,26,30,11,22,25,19,51,29,17,29,39,30,54,35] | |
da_points = [82,68,64,45,27,48,43,46,52,46,39,59,55,59,35,65,61,18,27,37,38,42,34,27,30,37,51,36,30,42,47,47,62,57] | |
sw_points_solved = [8,11,6,6,12,12,7,15,13,6,17,12,3,11,6,7,6,9,10,0,0,6,17,16,19,9,15,10,14,8,24,17] | |
sw_points = [11,17,12,12,12,12,16,16,13,16,22,20,3,11,6,17,13,15,10,10,10,6,17,16,24,14,15,15,24,15,24,17] | |
with pm.Model() as model: | |
p_sw = pm.Beta('completion_rate_sw', alpha=1, beta=1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymc3 as pm | |
with pm.Model() as coinflip: | |
which_coin = pm.Bernoulli('which_coin', 0.5) | |
theta_biased = pm.Uniform('theta_biased', 0, 1) | |
p = pm.math.switch(which_coin > 0.5, 0.5, theta_biased) | |
heads = pm.Binomial('heads', n=2, p=p, observed=2) | |
coin_trace = pm.sample(5000, tune=2500) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from spacy.lang.id import Indonesian | |
nlp = Indonesian() | |
# additional "stop words" | |
# bisa diganti dengan yang lain | |
nlp.Defaults.stop_words.update(['nya', 'yg', 'aja', 'deh', 'ny', 'dr', 'sy', 'ya','klo','sdh', | |
'udah','sampe','dah','tp','ga','gk','sih','gak','tdk','e','dgn','sm']) | |
def tokenizer(text): | |
# hanya mengambil lemma saja, bisa diganti yang lain jika dibutuhkan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
from sklearn.datasets.samples_generator import make_blobs | |
from sklearn.cluster import KMeans | |
# Anda dapat mengganti nilai X dan y sesuai dengan kebutuhan Anda | |
X, y = make_blobs(n_samples=300, centers=4, | |
cluster_std=1.2, random_state=3) | |
inertia = [] | |
for k in range(1,11): |