Пример #1
0
def process_galaxies(galaxies):
    pdfs = clf.predict_proba(galaxies[parameters].values) / 0.01
    cos_t_samples = []
    index = 0

    for i, galaxy in galaxies.iterrows():
        xz_kde = get_xz_kde(PDF(pdfs[index], q_grid), False, 10, 0, 1)
        cos_t = sample_cos_t(galaxy["ba"], xz_kde, 10)
        cos_t_samples.append(cos_t)
        
        index += 1

    return cos_t_samples
def guess_char():
    global prev
    controller = Leap.Controller()
    controller.set_policy(Leap.Controller.POLICY_BACKGROUND_FRAMES)
    classes = clf.classes_
    probs = zip(
        classes,
        clf.predict_proba([
            v for k, v in get_hand_position(controller, True).iteritems()
        ])[0])
    alpha = max([score for sym, score in probs])
    most_probable = sorted([(sym, alpha * score + (1 - alpha))
                            for sym, score in probs],
                           key=lambda t: t[1],
                           reverse=True)
    print most_probable[:3]
    prev = most_probable[0][0]
    print prev
Пример #3
0
def guess_char():
    global prev

    controller = Leap.Controller()
    controller.set_policy(Leap.Controller.POLICY_BACKGROUND_FRAMES)

    classes = clf.classes_

    probs = zip(classes, clf.predict_proba([v for k, v in
        get_hand_position(controller, True).iteritems()])[0])

    alpha = max([score for sym, score in probs])

    most_probable = sorted([(sym, alpha * score + (1 - alpha))
                            for sym, score in probs], key=lambda t: t[1],
                            reverse=True)
    print most_probable[:3]
    prev = most_probable[0][0]
    print prev