koncal prob eval, ampak je nek bug...
parent
0159f5b184
commit
88cb1f5bbe
59
test.py
59
test.py
|
@ -19,15 +19,6 @@ def generate_clltn (n_of_cards):
|
|||
clltn.append(generate_card(clltn=clltn))
|
||||
return clltn
|
||||
|
||||
# USER
|
||||
## config
|
||||
max_due = 15
|
||||
max_new = 5
|
||||
max_deck_size = max_new + max_due
|
||||
# setup
|
||||
user_clltn = generate_clltn(100)
|
||||
|
||||
# generate deck
|
||||
##1 SR - super-memo style
|
||||
|
||||
def get_new(user_clltn, n_of_cards):
|
||||
|
@ -78,7 +69,9 @@ def generate_deck_prob(user_clltn, max_new, max_due):
|
|||
max_new = new_cards
|
||||
if due_cards<max_due:
|
||||
max_due = due_cards
|
||||
|
||||
|
||||
print("weigts new: ", w_new, "due: ", w_due)
|
||||
|
||||
if due_cards:
|
||||
dck_due = choices(user_clltn, cum_weights=w_due, k=max_due)
|
||||
if new_cards:
|
||||
|
@ -88,9 +81,7 @@ def generate_deck_prob(user_clltn, max_new, max_due):
|
|||
|
||||
return deck
|
||||
|
||||
print(generate_deck_prob(user_clltn, max_new, max_due))
|
||||
#TODO?
|
||||
def prob_eval(card):
|
||||
def prob_eval_card(card):
|
||||
id, title, due, interval, owned_by, shared = card #due je tukaj interest rate
|
||||
|
||||
print("intrest rate je: ", due)
|
||||
|
@ -107,30 +98,30 @@ def prob_eval(card):
|
|||
card_mod = id, title, due, interval, owned_by, shared
|
||||
return card_mod
|
||||
|
||||
#TODO
|
||||
def run_prob(deck, user_clltn):
|
||||
#tu more dejansko spremenit collection...
|
||||
deck_mod = []
|
||||
def prob_eval_deck(deck, user_clltn):
|
||||
for c in deck:
|
||||
c = prob_eval(c)
|
||||
deck_mod.append(c)
|
||||
return deck_mod
|
||||
id, _, _, _, _, _ = c
|
||||
# tu dobimo karico, kjer se je nekaj spremenilo
|
||||
card_mod = prob_eval_card(c)
|
||||
# tu jo poiščemo v clltn in updejatmo
|
||||
for index, card in enumerate(user_clltn):
|
||||
if card[0] == id:
|
||||
user_clltn[index] = card_mod
|
||||
return user_clltn
|
||||
|
||||
# engine
|
||||
def run(user_clltn, n_of_days, max_new, max_due):
|
||||
for day in range(n_of_days):
|
||||
deck = generate_deck_prob(user_clltn, max_new, max_due) #to more bit global, da se ne generira skoz nov
|
||||
user_clltn = prob_eval_deck(deck, user_clltn)
|
||||
|
||||
|
||||
# random python stuff
|
||||
"""
|
||||
Output = [item for item in Input
|
||||
if item[0] == 3 or item[1] == 3]
|
||||
## kako najt tuple v listu in ga spremeniti?
|
||||
recordlist = [('sku1','item1','bro1'),('sku2','item2','bro2')]
|
||||
for index, item in enumerate(recordlist):
|
||||
itemlist = list(item)
|
||||
if itemlist[0] == 'sku1':
|
||||
itemlist[1] = itemlist[1]+','+'item'
|
||||
item = tuple(itemlist)
|
||||
# config
|
||||
n_of_days = 10
|
||||
max_due = 15
|
||||
max_new = 5
|
||||
max_deck_size = max_new + max_due
|
||||
|
||||
recordlist[index] = item
|
||||
print(recordlist)
|
||||
"""
|
||||
user_clltn = generate_clltn(20)
|
||||
|
||||
run(user_clltn, n_of_days, max_new, max_due)
|
Loading…
Reference in New Issue