Exemple #1
0
def main(trainset, window, save_todir):
    XPL = save_todir+'file.xpl'
    #building xpl file
    ensemble.build_xpl(trainset,window,XPL)
    #reading the xpl file
    xpl_data = xplutil.read_xpl(XPL)
    decision = cl.make_decision(xpl_data.freq0,xpl_data.freq1)
    size = xpl_data.winshape[0]*xpl_data.winshape[1]
    xplutil.write_minterm_file(save_todir+'filename.mtm', np.array([range(size)]), xpl_data.winshape, xpl_data.data, decision)
Exemple #2
0
def main(trainset, window, save_todir):
    XPL = window+'.xpl'
    #building xpl file
    ensemble.build_xpl(trainset,window,XPL)
    #reading xpl file
    xpl_data = xplutil.read_xpl(XPL)
    indices = np.array([0,1,3,4,5,7,8])
    w0 = xpl_data.freq0.copy()
    w1 = xpl_data.freq1.copy()
    w0, w1 = cl.normalize_table(w0, w1)
    hash, unique_array = project(xpl_data.data, indices)
    sum0 = []
    sum1 = []
    for row in unique_array:
        arr = hash.get(tuple(row.reshape(1,-1)[0]))
        indexes =  tuple(arr[0].reshape(1,-1)[0])
        sum0.append(w0[[np.array(indexes)]].sum())
        sum1.append(w1[[np.array(indexes)]].sum())
    decision = cl.make_decision(sum0, sum1)
    xplutil.write_minterm_file(save_todir+"mtmFile.mtm",indices, xpl_data.winshape, unique_array,decision)
Exemple #3
0
def update_weights_setup():
    w0 = np.random.uniform(size=100000)
    w1 = np.random.uniform(size=100000)
    dec = cl.make_decision(w0, w1)
    return w0, w1, dec