Esempio n. 1
0
def get_mcnn2_X(xtype='train'):
    if xtype == 'train':
        f_text, f_stat, f_times, fp = f_train
        x_cnn = f_w2v
    else:
        f_text, f_stat, f_times, fp = f_test
        x_cnn = f_w2v_test

    f_norm_hour = f_times[:, 38:62]
    f_hour = f_times[:, 14:38]
    f_norm_week = f_times[:, 7:14]
    f_week = f_times[:, 0:7]
    fs = [
        f_text[12], f_text[3], f_stat[:, [4, 5, 10, 11, 12, 13, 16]],
        f_norm_hour
    ]
    #fs=[f_text[12]]

    if xtype == 'train':
        fs += [em_xgb.get_next_input()[:3200]]
    else:
        fs += [em_xgb.get_next_input()[3200:]]

    x_ext = get_xs(fs).toarray()
    return [x_cnn, x_ext]
Esempio n. 2
0
def get_knn_x(xtype):
    if xtype == 'train':
        f_text, f_stat, f_times, fp = f_train
        ft_norm_hour = f_times[:, 38:62]
        ft_norm_cnt = f_times[:, 230:398]
        fs = (
            fp[0],
            fp[1],
            fp[3],
            fp[2],
            fp[4],
            ft_norm_hour,
            ft_norm_cnt,
        )

    else:
        f_text, f_stat, f_times, fp = f_test
        ft_norm_hour = f_times[:, 38:62]
        ft_norm_cnt = f_times[:, 230:398]
        fs = (
            fp[0],
            fp[1],
            fp[3],
            fp[2],
            fp[4],
            ft_norm_hour,
            ft_norm_cnt,
        )

    return get_xs(fs)
Esempio n. 3
0
def get_xgb_X(f_train):
    f_text, f_stat, f_times, fp = f_train
    fs = (
        f_text[1],
        f_stat[:, [4, 5, 10, 11, 12, 13, 16]],
    )
    X = get_xs(fs)
    return X
Esempio n. 4
0
def get_nn_x(ftype):
    if ftype=='train':
        f_text,f_stat,f_times,fp=f_train
        ft_norm_hour=f_times[:,38:62]
        ft_norm_cnt=f_times[:,230:398]
        fs=(fp[0],fp[1],fp[2],fp[3],fp[4],ft_norm_hour,ft_norm_cnt,)
    else:
        f_text,f_stat,f_times,fp=f_test
        ft_norm_hour=f_times[:,38:62]
        ft_norm_cnt=f_times[:,230:398]
        fs=(fp[0],fp[1],fp[2],fp[3],fp[4],ft_norm_hour,ft_norm_cnt,)
    return get_xs(fs)
Esempio n. 5
0
def get_nn_x2(ftype):
    if ftype == 'train':
        f_text, f_stat, f_times, fp = f_train
        ft_norm_hour = f_times[:, 38:62]
        ft_norm_cnt = f_times[:, 230:398]
        fs = (fp[0], fp[1], fp[2], fp[3], fp[4], ft_norm_hour, ft_norm_cnt,
              fp_sloca[:3200], fp_sprov[:3200], fp_sexist[:3200],
              em_age.get_next_input()[:3200], em_gen.get_next_input()[:3200])
    else:
        f_text, f_stat, f_times, fp = f_test
        ft_norm_hour = f_times[:, 38:62]
        ft_norm_cnt = f_times[:, 230:398]
        fs = (fp[0], fp[1], fp[2], fp[3], fp[4], ft_norm_hour, ft_norm_cnt,
              fp_sloca[3200:], fp_sprov[3200:], fp_sexist[3200:],
              em_age.get_next_input()[3200:], m_gen.get_next_input()[3200:])
    return get_xs(fs)
Esempio n. 6
0
def get_nn_x2(ftype):
    if ftype=='train':
        f_text,f_stat,f_times,fp=f_train
        ft_norm_hour=f_times[:,38:62]
        ft_norm_cnt=f_times[:,230:398]
        fs=(fp[0],fp[1],fp[2],fp[3],fp[4],ft_norm_hour,ft_norm_cnt,
            fp_sloca[:3200],fp_sprov[:3200],fp_sexist[:3200],
            em_age.get_next_input()[:3200],
           em_gen.get_next_input()[:3200])
    else:
        f_text,f_stat,f_times,fp=f_test
        ft_norm_hour=f_times[:,38:62]
        ft_norm_cnt=f_times[:,230:398]
        fs=(fp[0],fp[1],fp[2],fp[3],fp[4],ft_norm_hour,ft_norm_cnt,
            fp_sloca[3200:],fp_sprov[3200:],fp_sexist[3200:],
            em_age.get_next_input()[3200:],
           em_gen.get_next_input()[3200:])
    return get_xs(fs)
Esempio n. 7
0
def get_mcnn3_x(xtype='train'):
    if xtype == 'train':
        f_text, f_stat, f_times, fp = f_train
        x_cnn = f_w2v
    else:
        f_text, f_stat, f_times, fp = f_test
        x_cnn = f_w2v_test

    x_ext = f_text[2]

    ft_norm_hour = f_times[:, 38:62]
    ft_norm_cnt = f_times[:, 230:398]
    if xtype == 'train':
        fs = (fp[0], fp[1], fp[2], fp[3], fp[4], ft_norm_hour, ft_norm_cnt)
    else:
        fs = (fp[0], fp[1], fp[2], fp[3], fp[4], ft_norm_hour, ft_norm_cnt)
    x_ext1 = get_xs(fs).toarray()

    return [x_cnn, x_ext, x_ext1]
Esempio n. 8
0
def get_mcnn3_x(xtype='train'):
    if xtype=='train':
        f_text,f_stat,f_times,fp=f_train
        x_cnn=f_w2v
    else:
        f_text,f_stat,f_times,fp=f_test
        x_cnn=f_w2v_test
        
    x_ext=f_text[2]
    
    ft_norm_hour=f_times[:,38:62]
    ft_norm_cnt=f_times[:,230:398]
    if xtype=='train':
        fs=(fp[0],fp[1],fp[2],fp[3],fp[4],ft_norm_hour,ft_norm_cnt)
    else:
        fs=(fp[0],fp[1],fp[2],fp[3],fp[4],ft_norm_hour,ft_norm_cnt)
    x_ext1=get_xs(fs).toarray()
    
    return [x_cnn,x_ext,x_ext1]
Esempio n. 9
0
def get_mcnn2_X(xtype='train'):
    if xtype=='train':
        f_text,f_stat,f_times,fp=f_train
        x_cnn=f_w2v
    else:
        f_text,f_stat,f_times,fp=f_test
        x_cnn=f_w2v_test
        
    f_norm_hour=f_times[:,38:62]
    f_hour=f_times[:,14:38]
    f_norm_week=f_times[:,7:14]
    f_week=f_times[:,0:7]
    fs=[f_text[12],f_text[3],f_stat[:,[4,5,10,11,12,13,16]],f_norm_hour]
    #fs=[f_text[12]]
    
    if xtype=='train':
        fs+=[em_xgb.get_next_input()[:3200]]
    else:
        fs+=[em_xgb.get_next_input()[3200:]]
    
    x_ext=get_xs(fs).toarray()
    return [x_cnn,x_ext]
Esempio n. 10
0
def get_xgb_X(f_train):
    f_text,f_stat,f_times,fp=f_train
    fs=(f_text[1],f_stat[:,[4,5,10,11,12,13,16]],)
    X=get_xs(fs)
    return X