本文整理汇总了C++中AzParam::vStr方法的典型用法代码示例。如果您正苦于以下问题:C++ AzParam::vStr方法的具体用法?C++ AzParam::vStr怎么用?C++ AzParam::vStr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AzParam
的用法示例。
在下文中一共展示了AzParam::vStr方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resetParam
virtual void resetParam(AzParam &azp, const char *pfx, bool is_warmstart) {
azp.reset_prefix(pfx);
if (!is_warmstart) {
azp.vStr(kw_activ_typ, &s_activ_typ);
if (s_activ_typ.length() > 0) typ = *s_activ_typ.point();
azp.vFloat(kw_trunc, &trunc);
}
azp.swOn(&do_stat, kw_do_stat);
azp.reset_prefix();
}
示例2: resetParam
/*-------------------------------------------------------------------------*/
void resetParam(AzParam &azp) {
const char *eyec = "AzPrepText2_gen_regions_parsup_Param::resetParam";
azp.vInt(kw_top_num_each, &top_num_each);
azp.vInt(kw_top_num_total, &top_num_total);
azp.vStr(kw_feat_fn, &s_feat_fn);
azp.vStr(kw_xtyp, &s_xtyp);
azp.vStr(kw_xdic_fn, &s_xdic_fn);
azp.vStr(kw_inp_fn, &s_inp_fn);
azp.vStr(kw_rnm, &s_rnm);
azp.vStr(kw_txt_ext, &s_txt_ext);
azp.vInt(kw_pch_sz, &pch_sz);
azp.vInt(kw_pch_step, &pch_step);
azp.vInt(kw_padding, &padding);
f_pch_sz = pch_sz;
f_pch_step = 1;
f_padding = f_pch_sz - 1;
azp.vInt(kw_f_pch_sz, &f_pch_sz);
azp.vInt(kw_f_pch_step, &f_pch_step);
azp.vInt(kw_f_padding, &f_padding);
azp.vInt(kw_min_x, &min_x);
azp.vInt(kw_min_y, &min_y);
azp.vInt(kw_dist, &dist);
azp.swOn(&do_lower, kw_do_lower);
azp.swOn(&do_utf8dashes, kw_do_utf8dashes);
azp.swOn(&do_nolr, kw_do_nolr);
azp.vStr(kw_batch_id, &s_batch_id);
azp.vStr(kw_x_ext, &s_x_ext);
azp.vStr(kw_y_ext, &s_y_ext);
azp.swOn(&do_binarize, kw_do_binarize);
if (!do_binarize) {
azp.vFloat(kw_scale_y, &scale_y);
}
azp.vFloat(kw_min_yval, &min_yval);
AzXi::throw_if_empty(s_feat_fn, eyec, kw_feat_fn);
AzXi::throw_if_empty(s_xtyp, eyec, kw_xtyp);
AzXi::throw_if_empty(s_xdic_fn, eyec, kw_xdic_fn);
AzXi::throw_if_empty(s_inp_fn, eyec, kw_inp_fn);
AzXi::throw_if_empty(s_rnm, eyec, kw_rnm);
AzXi::throw_if_nonpositive(pch_sz, eyec, kw_pch_sz);
AzXi::throw_if_nonpositive(pch_step, eyec, kw_pch_step);
AzXi::throw_if_negative(padding, eyec, kw_padding);
AzXi::throw_if_nonpositive(f_pch_sz, eyec, kw_f_pch_sz);
AzXi::throw_if_nonpositive(f_pch_step, eyec, kw_f_pch_step);
AzXi::throw_if_negative(f_padding, eyec, kw_f_padding);
AzXi::throw_if_nonpositive(dist, eyec, kw_dist);
if (f_pch_sz > dist) {
AzBytArr s(kw_f_pch_sz); s << " must be no greater than " << kw_dist << ".";
AzX::throw_if(true, AzInputError, eyec, s.c_str());
}
}
示例3: resetParam
/*--------------------------------------------------------*/
void AzsSvrg::resetParam(AzParam &azp)
{
AzBytArr s_loss;
azp.vStr(kw_loss, &s_loss);
if (s_loss.length() > 0) loss_type = lossType(s_loss.c_str());
azp.vInt(kw_svrg_interval, &svrg_interval);
azp.vInt(kw_sgd_ite, &sgd_ite);
azp.vInt(kw_test_interval, &test_interval);
azp.vInt(kw_ite_num, &ite_num);
azp.vInt(kw_rseed, &rseed);
azp.vFloat(kw_eta, &eta);
azp.vFloat(kw_momentum, &momentum);
azp.vFloat(kw_lam, &lam);
azp.swOn(&do_compact, kw_do_compact);
azp.swOn(&do_show_loss, kw_do_show_loss);
azp.swOn(&do_show_timing, kw_do_show_timing);
azp.swOn(&with_replacement, kw_with_replacement);
azp.vStr(kw_pred_fn, &s_pred_fn);
}
示例4: resetParam
/*--- for parameters ---*/
virtual void resetParam(AzParam &p) {
p.vStr(kw_dataproc, &s_dataproc);
dataproc = dataproc_Auto;
if (s_dataproc.length() <= 0 ||
s_dataproc.compare("Auto") == 0);
else if (s_dataproc.compare("Sparse") == 0) dataproc = dataproc_Sparse;
else if (s_dataproc.compare("Dense") == 0) dataproc = dataproc_Dense;
else {
throw new AzException(AzInputNotValid, kw_dataproc,
"must be either \"Auto\", \"Sparse\", or \"Dense\".");
}
}
示例5: resetParam
void resetParam(AzParam &azp, const char *pfx, bool is_warmstart) {
azp.reset_prefix(pfx);
if (!is_warmstart) {
azp.vStr(kw_pl_type, &s_pl_type);
if (s_pl_type.length() > 0) ptyp = *s_pl_type.point();
else ptyp = AzpPoolingDflt_None;
azp.vInt(kw_pl_num, &pl_num);
azp.vInt(kw_pl_sz, &pl_sz);
azp.vInt(kw_pl_step, &pl_step);
azp.swOff(&do_pl_simple_grid, kw_no_pl_simple_grid);
}
azp.reset_prefix();
}
示例6: s_kw
/* output: sp_conn */
void AzpCNet3_multi::resetParam_conn(AzParam &azp, AzIIarr &iia_conn)
{
const char *eyec = "AzpCNet3_multi::resetParam_conn";
iia_conn.reset();
sp_conn.size();
int top = hid_num;
int ix;
for (ix = 0; ; ++ix) {
AzBytArr s_conn;
AzBytArr s_kw(kw_conn); s_kw << ix << "=";
azp.vStr(s_kw.c_str(), &s_conn);
if (s_conn.length() <= 0) break;
AzStrPool sp(32,32);
AzTools::getStrings(s_conn.point(), s_conn.length(), conn_dlm, &sp);
AzX::throw_if((sp.size() != 2), AzInputError, "Expected the format like n-m for", kw_conn);
int below = parse_layerno(sp.c_str(0), hid_num);
int above = parse_layerno(sp.c_str(1), hid_num);
AzX::throw_if((below == top), AzInputError, eyec, "No edge is allowed to go out of the top layer");
iia_conn.put(below, above);
sp_conn.put(&s_conn);
}
/*--- default ---*/
if (iia_conn.size() == 0) {
for (int lx = 0; lx < hid_num; ++lx) {
int below = lx, above = lx + 1;
iia_conn.put(below, above);
AzBytArr s_conn; s_conn << below << conn_dlm << above;
sp_conn.put(s_conn.c_str());
}
}
}
示例7: resetParam
/*--------------------------------------------------------*/
int AzRgforest::resetParam(AzParam &p)
{
const char *eyec = "AzRgforest::resetParam";
/*--- for storing data indexes in the trees to disk ---*/
/*--- this must be called before adjustTestInterval. ---*/
p.vStr(kw_temp_for_trees, &s_temp_for_trees);
/*--- loss function ---*/
p.vLoss(kw_loss, &loss_type);
/*--- weight optimization interval ---*/
int lnum_inc_opt = lnum_inc_opt_dflt;
p.vInt(kw_lnum_inc_opt, &lnum_inc_opt);
if (lnum_inc_opt <= 0) {
throw new AzException(AzInputNotValid, eyec, kw_lnum_inc_opt,
"must be positive");
}
opt_timer.reset(lnum_inc_opt);
/*--- # of trees to search ---*/
p.vInt(kw_s_tree_num, &s_tree_num);
if (s_tree_num <= 0) {
throw new AzException(AzInputNotValid, eyec, kw_s_tree_num,
"must be positive");
}
/*--- when to stop: max #leaf, max #tree ---*/
int max_tree_num = -1, max_lnum = max_lnum_dflt;
p.vInt(kw_max_tree_num, &max_tree_num);
p.vInt(kw_max_lnum, &max_lnum);
if (max_tree_num <= 0) {
if (max_lnum > 0) max_tree_num = MAX(1, max_lnum / 2);
else {
AzBytArr s("Specify ");
s.c(kw_max_lnum);
s.c(" and/or ");
s.c(kw_max_tree_num);
throw new AzException(AzInputMissing, eyec, s.c_str());
}
}
lmax_timer.reset(max_lnum);
/*--- when to test: test interval ---*/
int lnum_inc_test = lnum_inc_test_dflt;
p.vInt(kw_lnum_inc_test, &lnum_inc_test);
if (lnum_inc_test <= 0) {
throw new AzException(AzInputNotValid, eyec, kw_lnum_inc_test,
"must be positive");
}
lnum_inc_test = adjustTestInterval(lnum_inc_test, lnum_inc_opt);
test_timer.reset(lnum_inc_test);
/*--- memory handling ---*/
p.vStr(kw_mem_policy, &s_mem_policy);
if (s_mem_policy.length() <= 0) beTight = false;
else if (s_mem_policy.compare(mp_beTight) == 0) beTight = true;
else if (s_mem_policy.compare(mp_not_beTight) == 0) beTight = false;
else {
AzBytArr s(kw_mem_policy);
s.c(" should be either ");
s.c(mp_beTight);
s.c(" or ");
s.c(mp_not_beTight);
throw new AzException(AzInputNotValid, eyec, s.c_str());
}
p.vFloat(kw_f_ratio, &f_ratio);
if (f_ratio > 1) {
throw new AzException(AzInputNotValid, kw_f_ratio, "must be between 0 and 1.");
}
int random_seed = -1;
if (f_ratio > 0 && f_ratio < 1) {
p.vInt(kw_random_seed, &random_seed);
if (srand > 0) {
srand(random_seed);
}
}
p.swOn(&doPassiveRoot, kw_doPassiveRoot);
/*--- for maintenance purposes ---*/
p.swOn(&doForceToRefreshAll, kw_doForceToRefreshAll);
p.swOn(&beVerbose, kw_forest_beVerbose); /* for compatibility */
p.swOn(&beVerbose, kw_beVerbose);
p.swOn(&doTime, kw_doTime);
/*--- display parameters ---*/
if (!out.isNull()) {
AzPrint o(out);
o.ppBegin("AzRgforest", "Forest-level");
o.printLoss(kw_loss, loss_type);
o.printV(kw_max_lnum, max_lnum);
o.printV(kw_max_tree_num, max_tree_num);
o.printV(kw_lnum_inc_opt, lnum_inc_opt);
o.printV(kw_lnum_inc_test, lnum_inc_test);
o.printV(kw_s_tree_num, s_tree_num);
o.printSw(kw_doForceToRefreshAll, doForceToRefreshAll);
//.........这里部分代码省略.........