예제 #1
0
def get_confs1():
    score = 5
    return [
        MyConfStableLTa(classifier=cnn(nb_epoch=5), score=score),
        MyConfStableLTa(classifier=cnn(),score=score),
        MyConfStableLTa(classifier=cnn(num_filt_2=4), score=score),
        MyConfStableLTa(classifier=cnn(num_filt_1=6, num_filt_2=4), score=score),
        MyConfStableLTa(classifier=cnn(batch_size=1000), score=score),
    ]
예제 #2
0
파일: run3.py 프로젝트: zzmjohn/pytrade
def get_confs():
    score = 5
    return [
        #MyConfStableLTa(classifier=ccl2(batch_size=32, nb_epoch=20), score=score),
        #MyConfStableLTa(classifier=cnn(batch_size=32, nb_epoch=20), score=score),
        MyConfStableLTa(classifier=Logit2(), score=score),
    ]
예제 #3
0
import os
import pandas as pd


local_path = os.path.dirname(__file__)
root = os.path.join(local_path, '..', "..")
sys.path.append(root)

from main.work.conf import MyConfStableLTa
def work(confer):
    if not os.path.exists(confer.get_sel_file()) or  confer.force:
        df = confer.selector.work()
        print(df.shape)
        df.to_pickle(confer.get_sel_file())
if  __name__ == "__main__":
    from main.classifier.tree import MySGDClassifier

    confer = MyConfStableLTa(classifier=MySGDClassifier(),score=5)
    ta_file = pd.read_pickle(confer.get_bitlize_file())

    ta_file1 = confer.selector._select(ta_file,
            confer.model_split.train_start,
            confer.model_split.train_end,
            confer.scores[0].get_name())
    ta_file2 = confer.selector._select(ta_file,
            "2013-01-01",
            "2014-01-01",
            confer.scores[0].get_name())
    ta = ta_file2.merge(ta_file1, left_index=True, right_index=True)
    print(ta.head())
예제 #4
0
 #"adj": MyConfStableLTa(classifier=Logit2(30), is_adj= True),
 #"score5_30": MyConfStableLTa(classifier=Logit2(dim=30), is_adj = False),
 #"score5_64": MyConfStableLTa(classifier=Logit2(dim=64), is_adj = False),
 #"score5_8": MyConfStableLTa(classifier=Logit2(dim=8), is_adj = False),
 #"score5_16": MyConfStableLTa(classifier=Logit2(dim=16), is_adj = False),
 #"score5_24": MyConfStableLTa(classifier=Logit2(dim=24), is_adj = False),
 #"score5_32": MyConfStableLTa(classifier=Logit2(dim=32), is_adj = False),
 #"score5_40": MyConfStableLTa(classifier=Logit2(dim=40), is_adj = False),
 #"score5_40_2": MyConfStableLTa(classifier=Logit2(dim=40, dropout=0.2), is_adj = False),
 #"score5_40_4": MyConfStableLTa(classifier=Logit2(dim=40, dropout=0.4), is_adj = False),
 #"score5_40_6": MyConfStableLTa(classifier=Logit2(dim=40, dropout=0.6), is_adj = False),
 #"score5_40_6_1": MyConfStableLTa(classifier=Logit2(hs=1, dim=40, dropout=0.6), is_adj = False),
 #"score5_40_6_2": MyConfStableLTa(classifier=Logit2(hs=2, dim=40, dropout=0.6), is_adj = False),
 #"score5_40_6_3": MyConfStableLTa(classifier=Logit2(hs=3, dim=40, dropout=0.6), is_adj = False), # best
 "score5_40_6_3_adam1":
 MyConfStableLTa(classifier=Logit3(hs=3, dim=40, dropout=0.6, lr=4e-5),
                 is_adj=False),  # best
 "score5_40_6_3_adam2":
 MyConfStableLTa(classifier=Logit3(hs=3, dim=40, dropout=0.6, lr=8e-5),
                 is_adj=False),  # best
 #"score5_40_6_3_adam3": MyConfStableLTa(classifier=Logit3(hs=3, dim=40, dropout=0.6, lr=2e-5), is_adj = False), # best
 #"score5_40_6_3_adam4": MyConfStableLTa(classifier=Logit3(hs=3, dim=40, dropout=0.6, lr=1e-6), is_adj = False), # best
 #"score5_40_6_4": MyConfStableLTa(classifier=Logit2(hs=4, dim=40, dropout=0.6), is_adj = False),
 #"score5_40_6_5": MyConfStableLTa(classifier=Logit2(hs=5, dim=40, dropout=0.6), is_adj = False),
 #"score5_40_6_6": MyConfStableLTa(classifier=Logit2(hs=6, dim=40, dropout=0.6), is_adj = False),
 #"score5_40_8": MyConfStableLTa(classifier=Logit2(dim=40, dropout=0.8), is_adj = False),
 #"score5_40_10": MyConfStableLTa(classifier=Logit2(dim=40, dropout=1.0), is_adj = False),
 #"score5_48": MyConfStableLTa(classifier=Logit2(dim=48), is_adj = False),
 #"ccl2": MyConfStableLTa(classifier=Logit2(), is_adj = False),
 #"ccl3": MyConfStableLTa(classifier=Logit2(dim=10, hs=6), is_adj = False),
 #"delta": MyConfStableLTa(classifier=Logit(nb_epoch=10), is_adj = False),
 #"delta2": MyConfStableLTa(classifier=Logit(nb_epoch=20), is_adj = False),
예제 #5
0
import pickle
import pandas as pd
import numpy as np

local_path = os.path.dirname(__file__)
root = os.path.join(local_path, '..',"..")
sys.path.append(root)

from main import base
from main.base.score2 import ScoreLabel
from main.work import model
from main.work import build
from main.work.conf import MyConfStableLTa
from main.model import ana

confer = MyConfStableLTa()

#build.work(confer)
#model.work(confer)



df = pd.read_pickle(os.path.join(root, 'output', "result_20170205.pkl"))
print(ana.roc_auc(df, confer))

clazz_file_name = confer.get_classifier_file()
with open(clazz_file_name, 'rb') as fin:
    clazz = pickle.load(fin)

feat_names = base.get_feat_names(df)
ipts = sorted(clazz.get_feature_importances(feat_names).items(), key=lambda a:a[1], reverse=True)
예제 #6
0
파일: run3.py 프로젝트: zzmjohn/pytrade
def get_confs2():
    score = 5
    return [
        MyConfStableLTa(classifier=ccl2(batch_size=32, nb_epoch=10),
                        score=score),
    ]
예제 #7
0
파일: run3.py 프로젝트: zzmjohn/pytrade
def get_confs2():
    score = 5
    return [
        MyConfStableLTa(classifier=Ts(max_iterations=20000), score=score),
    ]
예제 #8
0
파일: faketrue.py 프로젝트: zzmjohn/pytrade
import pickle
import pandas as pd
import numpy as np

local_path = os.path.dirname(__file__)
root = os.path.join(local_path, '..', "..")
sys.path.append(root)

from main import base
from main.base.score2 import ScoreLabel
from main.work import model
from main.work import build
from main.work.conf import MyConfStableLTa
from main.model import ana

confer = MyConfStableLTa()

#build.work(confer)
#model.work(confer)

df = pd.read_pickle(os.path.join(root, 'output', "result_20170205.pkl"))
print(ana.roc_auc(df, confer))

clazz_file_name = confer.get_classifier_file()
with open(clazz_file_name, 'rb') as fin:
    clazz = pickle.load(fin)

feat_names = base.get_feat_names(df)
ipts = sorted(clazz.get_feature_importances(feat_names).items(),
              key=lambda a: a[1],
              reverse=True)
예제 #9
0
    iter_num = 2
    abtest_models = {
        #"Logit10":Logit2(nb_epoch=10),
        "Logit20":Logit2(nb_epoch=20),
        "Logit30":Logit2(nb_epoch=30),
        #"Logit30-10":Logit2(nb_epoch=30, hs=10),
        #"Logit40":Logit2(nb_epoch=40),
        "Logit50":Logit2(nb_epoch=50),
        #"Logit80":Logit2(nb_epoch=80),
        #"MDN" : MyMdnClassifier(),
    }

    abtest_confs = {
        #"adj": MyConfStableLTa(classifier=Logit2(30), is_adj= True),
        #"score5": MyConfStableLTa(classifier=Logit2(30), is_adj = False),
        "score4": MyConfStableLTa(classifier=Logit2(30), is_adj = False, score=4),
        "score6": MyConfStableLTa(classifier=Logit2(30), is_adj = False, score=6),
        #"score2": MyConfStableLTa(classifier=Logit2(30), is_adj = False, score=2),
        #"score8": MyConfStableLTa(classifier=Logit2(30), is_adj = False, score=8),
        #"score32": MyConfStableLTa(classifier=Logit2(30), is_adj = False, score=32),
    }
    result_dict = {}

    from optparse import OptionParser
    parser = OptionParser()
    parser.add_option('-f', '--force', action='store_true',default = False, dest='force', help = 'do not use any tmp file')
    (options, args)  = parser.parse_args()

    report_file = os.path.join(root, 'data', 'report', 'abtest.txt')
    fd = open(report_file, "w")
    for model_name in abtest_confs.keys():