Exemplo n.º 1
0
def START_est(filename):
    stop = 0.90
    thres = 40
    flag = True

    read = MAR()
    read = read.create(filename)
    read.restart()
    read = MAR()
    read = read.create(filename)
    target = int(read.get_allpos() * stop)
    while True:
        pos, neg, total = read.get_numbers()
        # print("%d, %d" %(pos,pos+neg))
        if pos >= target:
            break
        if pos == 0 or pos + neg < thres:
            for id in read.random():
                read.code(id, read.body["label"][id])
        else:
            a, b, ids, c = read.train(pne=True)

            if pos >= 60 and flag:
                read.cache_est()
                # read.xx=read.simcurve['x']
                # read.yy=read.simcurve['pos']
                flag = False

            for id in ids:
                read.code(id, read.body["label"][id])
    return read
Exemplo n.º 2
0
def Codes(filename, code):
    stop = 0.95
    thres = 0
    if "P" in code:
        starting = 5
    else:
        starting = 1

    weighting = "W" in code or "M" in code
    uncertain = "U" in code
    stopping = "S" in code

    read = MAR()
    read = read.create(filename)
    read.restart()
    read = MAR()
    read = read.create(filename)
    if not ("A" in code or "M" in code):
        read.enough = 100000
    target = int(read.get_allpos() * stop)
    while True:
        pos, neg, total = read.get_numbers()
        # print("%d, %d" %(pos,pos+neg))
        if pos >= target:
            break
        if pos < starting or pos + neg < thres:
            for id in read.random():
                read.code(id, read.body["label"][id])
        else:
            a, b, c, d, e = read.train(weighting=weighting)
            if pos < 30 and uncertain:
                for id in a:
                    read.code(id, read.body["label"][id])
            else:
                if stopping:
                    now = 0
                    while pos < target:
                        for id in e[now:now + read.step]:
                            read.code(id, read.body["label"][id])
                        pos, neg, total = read.get_numbers()
                        now = now + read.step
                else:
                    for id in c:
                        read.code(id, read.body["label"][id])
    return read
Exemplo n.º 3
0
def START_DOC2VEC(filename):
    stop = 0.95
    thres = 40

    read = MAR()
    read = read.create(filename)
    read.restart()
    read = MAR()
    read = read.create(filename)
    target = int(read.get_allpos() * stop)
    while True:
        pos, neg, total = read.get_numbers()
        print("%d, %d" % (pos, pos + neg))
        if pos >= target:
            break
        if pos == 0 or pos + neg < thres:
            for id in read.random():
                read.code(id, read.body["label"][id])
        else:
            a, b, c, d, e = read.train(weighting=True)
            for id in c:
                read.code(id, read.body["label"][id])
    return read