Пример #1
0
def user_var_change(userid):
    global _walk_cache
    if userid not in _walk_cache:
        _walk_cache[userid] = userWalk(User.objects.filter(id=userid)[0])
    totDays,activeDays,adeadtotal,adeadgained = _walk_cache[userid]
    delta = [(new - dead) for new,dead in adeadgained]
    return ca.make_feature('var_change', variance(delta))
Пример #2
0
def user_mean_dead(userid):
    global _walk_cache
    if userid not in _walk_cache:
        _walk_cache[userid] = userWalk(User.objects.filter(id=userid)[0])
    totDays,activeDays,adeadtotal,adeadgained = _walk_cache[userid]
    #for alive,dead in adeadtotal: print alive,",",dead
    return ca.make_feature('mean_alive_notes',mean( [dead for alive,dead in adeadtotal ] ))
Пример #3
0
def user_var_change(userid):
    global _walk_cache
    if userid not in _walk_cache:
        _walk_cache[userid] = userWalk(User.objects.filter(id=userid)[0])
    totDays, activeDays, adeadtotal, adeadgained = _walk_cache[userid]
    delta = [(new - dead) for new, dead in adeadgained]
    return ca.make_feature('var_change', variance(delta))
Пример #4
0
def user_percent_active_days(userid):
    global _walk_cache
    if userid not in _walk_cache:
        _walk_cache[userid] = userWalk(User.objects.filter(id=userid)[0])
    totDays,activeDays,adeadtotal,adeadgained = _walk_cache[userid]
    if (totDays <= 1 or activeDays <= 1): print '!!!!!!!!!!!!!!! ',userid,' has only 1 active day'        
    return ca.make_feature('percent_days_active',activeDays / (1.0*totDays))
Пример #5
0
def user_mean_day_add(userid):
    global _walk_cache
    if userid not in _walk_cache:
        _walk_cache[userid] = userWalk(User.objects.filter(id=userid)[0])
    totDays, activeDays, adeadtotal, adeadgained = _walk_cache[userid]
    return ca.make_feature('mean_new_notes_per_day',
                           mean([alive for alive, dead in adeadgained]))
Пример #6
0
def user_var_day_del(userid):
    global _walk_cache
    if userid not in _walk_cache:
        _walk_cache[userid] = userWalk(User.objects.filter(id=userid)[0])
    totDays, activeDays, adeadtotal, adeadgained = _walk_cache[userid]
    return ca.make_feature('var_del_notes_per_day',
                           variance([dead for alive, dead in adeadgained]))
Пример #7
0
def user_mean_dead(userid):
    global _walk_cache
    if userid not in _walk_cache:
        _walk_cache[userid] = userWalk(User.objects.filter(id=userid)[0])
    totDays, activeDays, adeadtotal, adeadgained = _walk_cache[userid]
    #for alive,dead in adeadtotal: print alive,",",dead
    return ca.make_feature('mean_alive_notes',
                           mean([dead for alive, dead in adeadtotal]))
Пример #8
0
def user_percent_active_days(userid):
    global _walk_cache
    if userid not in _walk_cache:
        _walk_cache[userid] = userWalk(User.objects.filter(id=userid)[0])
    totDays, activeDays, adeadtotal, adeadgained = _walk_cache[userid]
    if (totDays <= 1 or activeDays <= 1):
        print '!!!!!!!!!!!!!!! ', userid, ' has only 1 active day'
    return ca.make_feature('percent_days_active', activeDays / (1.0 * totDays))
Пример #9
0
def user_var_alive_percent(userid):
    global _walk_cache
    if userid not in _walk_cache:
        _walk_cache[userid] = userWalk(User.objects.filter(id=userid)[0])
    totDays, activeDays, adeadtotal, adeadgained = _walk_cache[userid]
    return ca.make_feature(
        'variance_alive_notes',
        variance([(alive / (1.0 * (alive + dead + 0.00001)))
                  for alive, dead in adeadtotal]))
Пример #10
0
def user_var_day_del(userid):
    global _walk_cache
    if userid not in _walk_cache:
        _walk_cache[userid] = userWalk(User.objects.filter(id=userid)[0])
    totDays,activeDays,adeadtotal,adeadgained = _walk_cache[userid]
    return ca.make_feature('var_del_notes_per_day',variance([dead for alive,dead in adeadgained ] ))
Пример #11
0
def user_notes_owned(user):
    return ca.make_feature('user_notes_owned',Note.objects.filter(owner=user).count())
Пример #12
0
def user_mean_day_add(userid):
    global _walk_cache
    if userid not in _walk_cache:
        _walk_cache[userid] = userWalk(User.objects.filter(id=userid)[0])
    totDays,activeDays,adeadtotal,adeadgained = _walk_cache[userid]
    return ca.make_feature('mean_new_notes_per_day',mean([alive for alive,dead in adeadgained ] ))
Пример #13
0
def user_var_alive_percent(userid):
    global _walk_cache
    if userid not in _walk_cache:
        _walk_cache[userid] = userWalk(User.objects.filter(id=userid)[0])
    totDays,activeDays,adeadtotal,adeadgained = _walk_cache[userid]
    return ca.make_feature('variance_alive_notes',variance( [(alive/(1.0*(alive+dead+0.00001))) for alive,dead in adeadtotal ] ))
Пример #14
0
def user_searches_per_day(user):
    import jv3.study.ca_search 
    normed,adays = jv3.study.ca_search.searches_per_day(User.objects.filter(id=user))
    total = reduce(lambda x,y : x+y, normed.values(), 0)
    return ca.make_feature("user_searches_per_day", total)
Пример #15
0
def user_notes_owned(user):
    return ca.make_feature('user_notes_owned',
                           Note.objects.filter(owner=user).count())
Пример #16
0
def user_searches_per_day(user):
    import jv3.study.ca_search
    normed, adays = jv3.study.ca_search.searches_per_day(
        User.objects.filter(id=user))
    total = reduce(lambda x, y: x + y, normed.values(), 0)
    return ca.make_feature("user_searches_per_day", total)