本文整理汇总了C++中AzObjPtrArray::alloc方法的典型用法代码示例。如果您正苦于以下问题:C++ AzObjPtrArray::alloc方法的具体用法?C++ AzObjPtrArray::alloc怎么用?C++ AzObjPtrArray::alloc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AzObjPtrArray
的用法示例。
在下文中一共展示了AzObjPtrArray::alloc方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: warm_start
void warm_start(const AzTreeEnsemble *inp_ens,
const AzDataForTrTree *data,
AzParam ¶m,
const AzBytArr *s_temp_prefix,
const AzOut &out,
int max_t_num,
int search_t_num,
AzDvect *v_p, /* inout */
const AzIntArr *inp_ia_tr_dx=NULL)
{
const char *eyec = "AzTrTreeEnsemble::warmup";
if (max_t_num < inp_ens->size()) {
throw new AzException(eyec, "maximum #tree is less than the #tree we already have");
}
reset();
a_tree.alloc(&t, max_t_num, "AzTrTreeEnsemble::warmup");
t_num = inp_ens->size();
const_val = inp_ens->constant();
org_dim = inp_ens->orgdim();
if (org_dim > 0 && org_dim != data->featNum()) {
throw new AzException(AzInputError, eyec, "feature dimensionality mismatch");
}
const AzIntArr *ia_tr_dx = inp_ia_tr_dx;
AzIntArr ia_temp;
if (ia_tr_dx == NULL) {
ia_temp.range(0, data->dataNum());
ia_tr_dx = &ia_temp;
}
v_p->reform(data->dataNum());
v_p->add(const_val, ia_tr_dx);
T dummy_tree(param);
if (dummy_tree.usingInternalNodes()) {
throw new AzException(AzInputError, eyec,
"warm start is not allowed with use of internal nodes");
}
dummy_tree.printParam(out);
temp_files.reset(&dummy_tree, data->dataNum(), s_temp_prefix);
s_param.reset(param.c_str());
dt_param = s_param.c_str();
AzParam p(dt_param, false);
int tx;
for (tx = 0; tx < t_num; ++tx) {
t[tx] = new T(p);
t[tx]->forStoringDataIndexes(temp_files.point_file());
if (search_t_num > 0 && tx < t_num-search_t_num) {
t[tx]->quick_warmup(inp_ens->tree(tx), data, v_p, ia_tr_dx);
}
else {
t[tx]->warmup(inp_ens->tree(tx), data, v_p, ia_tr_dx);
}
}
}
示例2: copy_nodes_from
//! copy nodes only; not split
void copy_nodes_from(const AzTrTreeEnsemble_ReadOnly *inp) {
reset();
const_val = inp->constant();
org_dim = inp->orgdim();
t_num = inp->size();
s_param.reset(inp->param_c_str());
dt_param = s_param.c_str();
AzParam p(dt_param, false);
a_tree.alloc(&t, t_num, "AzTrTreeEnsemble::copy_nodes_from");
for (int tx = 0; tx < t_num; ++tx) {
t[tx] = new T(p);
t[tx]->copy_nodes_from(inp->tree(tx));
}
}
示例3: alloc
/** @ alloc the Tree pointer array*/
inline void alloc(int num, const char *msg="") {
a_tree.alloc(&t, num, "AzTrTreeEnsemble::alloc", msg);
}