本文整理汇总了Python中solver.Solver.predict方法的典型用法代码示例。如果您正苦于以下问题:Python Solver.predict方法的具体用法?Python Solver.predict怎么用?Python Solver.predict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类solver.Solver
的用法示例。
在下文中一共展示了Solver.predict方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: train
# 需要导入模块: from solver import Solver [as 别名]
# 或者: from solver.Solver import predict [as 别名]
def train(param=PARAMS, sv=SOLVE, small=False):
sv['name'] = __file__.rstrip('.py')
input_var = raw_input('Are you testing now? ')
if 'no' in input_var:
sv.pop('name')
else:
sv['name'] += input_var
out = get(1)
from my_layer import LSTM
sym = LSTM(e_net.l3_4, 64*64, 1, 64, 64)
sym = list(sym)
sym[0] = mx.sym.LogisticRegressionOutput(data=sym[0], name='softmax')
sym = mx.symbol.Group(list(sym))
param['eval_data'] = out['val']
param['marks'] = param['e_marks'] = out['marks']
param['ctx'] = mu.gpu(1)
print out['train'].label[0][1].shape
s = Solver(sym, out['train'], sv, **param)
s.train()
s.predict()
示例2: train
# 需要导入模块: from solver import Solver [as 别名]
# 或者: from solver.Solver import predict [as 别名]
def train(param=PARAMS, sv=SOLVE, small=False):
sv['name'] = 'TEST'
input_var = raw_input('Are you testing now? ')
if 'no' in input_var:
sv.pop('name')
else:
sv['name'] += input_var
#out = u.get(6,small=True, aug=True)
imgs, ll = load_rnn_pk(files)
imgs = imgs.reshape((-1,1,256,256))
ll = ll.reshape((-1,1,256,256))
datas = u.prepare_set(imgs, ll)
out = u.create_iter(*datas, batch_size=5)
net = cnn_net(
use_logis=True
)
param['eval_data'] = out[1]
s = Solver(net, out[0], sv, **param)
s.train()
s.predict()
s.all_to_png()
s.save_best_model()
s.plot_process()
示例3: train
# 需要导入模块: from solver import Solver [as 别名]
# 或者: from solver.Solver import predict [as 别名]
def train(param=PARAMS, sv=SOLVE, small=False):
net = make_net()
out = R.get(2, rate=0.05)
train, param['eval_data'] = out['train'], out['val']
param['marks'] = param['e_marks'] = out['marks']
s = Solver(net, train, sv, **param)
s.train()
s.predict()
示例4: train
# 需要导入模块: from solver import Solver [as 别名]
# 或者: from solver.Solver import predict [as 别名]
def train(param=PARAMS, sv=SOLVE, small=False):
sv['name'] = __file__.rstrip('.py')
input_var = raw_input('Are you testing now? ')
if 'no' in input_var:
sv.pop('name')
else:
sv['name'] += input_var
out = get(6, aug=True)
sym = net()
param['eval_data'] = out['val']
s = Solver(sym, out['train'], sv, **param)
s.train()
s.predict()
示例5: train
# 需要导入模块: from solver import Solver [as 别名]
# 或者: from solver.Solver import predict [as 别名]
def train(param=PARAMS, sv=SOLVE, small=False):
# prepare net
net = unroll_lstm(10, 64*64, 1, 64, 64)
# prepare data
from Evol.load_e import reshape_label
from RNN.rnn_load import load_rnn_pk
img, ll = load_rnn_pk(['../DATA/PK/NEW/[T10,N10]<8-11:42:11>.pk'])
ll = reshape_label(ll)
lt, lv = ll[:8], ll[8:]
train = UnrollIter(lt, label=lt, batch_size=2, num_hidden=64*64)
val = UnrollIter(lv, label=lv, batch_size=2, num_hidden=64*64)
# train
s = Solver(net, train, sv, **param)
print 'Start Training...'
s.train()
s.predict()
示例6: train
# 需要导入模块: from solver import Solver [as 别名]
# 或者: from solver.Solver import predict [as 别名]
def train(param=PARAMS, sv=SOLVE, small=False):
sv['name'] = 'TEST'
input_var = raw_input('Are you testing now? ')
if 'no' in input_var:
sv.pop('name')
else:
sv['name'] += input_var
out = get(6, small=True, aug=True)
net = net()
param['eval_data'] = out['eval']
s = Solver(net, out['train'], sv, **param)
s.train()
s.predict()
s.all_to_png()
s.save_best_model()
s.plot_process()
示例7: train
# 需要导入模块: from solver import Solver [as 别名]
# 或者: from solver.Solver import predict [as 别名]
def train(base_model, param=PARAMS, sv=SOLVE, small=False):
# prepare data
if small:
files = rnn_load.f10
param['ctx'] = mu.gpu(1)
else:
files = rnn_load.files
imgs, labels = rnn_load.load_rnn_pk(files)
it, lt, iv, lv = mu.prepare_set(imgs, labels)
N, T = it.shape[:2]
# cnn process
model = mx.model.FeedForward.load(*base_model, ctx=mu.gpu(1))
rnn_input = np.zeros_like(it)
for n in range(1):
rnn_input[n], imgs, labels = mu.predict_draw(model, it[n])
# prepare params
#datas = [rnn_input, lt, iv, lv]
datas = [ lt, lt, lv, lv]
for i, d in enumerate(datas):
#datas[i] = np.transpose(d,axes=(1,0,2,3,4))
# make T become one
datas[i] = d.reshape((-1,1)+d.shape[2:])
iters = rnn_load.create_rnn_iter(*datas, batch_size=1, num_hidden=1000)
param['eval_data'] = iters[1]
mark = param['marks'] = param['e_marks'] = [1]*T
rnet = rnn_net(begin=mx.sym.Variable('data'), num_hidden=1000)
s = Solver(rnet, iters[0], sv, **param)
# train
print 'Start Training...'
s.train()
s.predict()
示例8: R_LSTM_Iter
# 需要导入模块: from solver import Solver [as 别名]
# 或者: from solver.Solver import predict [as 别名]
tll = np.concatenate(labels[:-split], axis=1)
print timg.shape, tll.shape
vimg = np.concatenate(images[-split:], axis=1)
vll = np.concatenate(labels[-split:], axis=1)
from r_lstm import R_LSTM_Iter
train = R_LSTM_Iter(timg, label=tll, num_hidden=3, batch_size=1)
val = R_LSTM_Iter(vimg, label=vll, num_hidden=3, batch_size=1)
from solver import Solver
from train import make_net
from settings import PARAMS, SOLVE
SOLVE['is_rnn'] = True
SOLVE['load'] = True
SOLVE['load_perfix'] = '/home/zijia/HeartDeepLearning/R_LSTM/Result/<26-12:43:22>[E5]/[ACC-0.97747 E4]'
SOLVE['load_epoch'] = 4
PARAMS['eval_data'] = val
PARAMS['marks'] = marks[:-split]
PARAMS['e_marks'] = marks[-split:]
PARAMS['ctx'] = mu.gpu(1)
PARAMS['learning_rate'] = 1
s = Solver(make_net(), train, SOLVE, **PARAMS)
s.train()
s.predict()