add in reg.conf for configuration demo
This commit is contained in:
parent
7821ef3a7c
commit
e1b5b99113
37
demo/regression/reg.conf
Normal file
37
demo/regression/reg.conf
Normal file
@ -0,0 +1,37 @@
|
||||
boost_iterations=10
|
||||
|
||||
save_period=0
|
||||
|
||||
train_path=
|
||||
|
||||
model_dir_path=
|
||||
|
||||
validation_paths=
|
||||
|
||||
validation_names=validation
|
||||
|
||||
test_paths=
|
||||
|
||||
test_names=test
|
||||
|
||||
booster_type=1
|
||||
|
||||
do_reboost=0
|
||||
|
||||
bst:num_roots=0
|
||||
|
||||
bst:num_feature=3
|
||||
|
||||
learning_rate=0.01
|
||||
|
||||
min_child_weight=1
|
||||
|
||||
min_split_loss=0.1
|
||||
|
||||
max_depth=3
|
||||
|
||||
reg_lambda=0.1
|
||||
|
||||
subsample=1
|
||||
|
||||
use_layerwise=0
|
||||
@ -8,7 +8,8 @@ int main(int argc, char *argv[]){
|
||||
char* config_path = "c:\\cygwin64\\home\\chen\\github\\xgboost\\demo\\regression\\reg.conf";
|
||||
bool silent = false;
|
||||
RegBoostTrain train;
|
||||
RegBoostTest test;
|
||||
train.train(config_path,false);
|
||||
|
||||
RegBoostTest test;
|
||||
test.test(config_path,false);
|
||||
}
|
||||
@ -45,7 +45,7 @@ namespace xgboost{
|
||||
for(int i = 0; i < test_param.test_paths.size(); i++){
|
||||
xgboost::regression::DMatrix test_data;
|
||||
test_data.LoadText(test_param.test_paths[i].c_str());
|
||||
sscanf(model_path,"%s/final.model",test_param.model_dir_path);
|
||||
sprintf(model_path,"%s/final.model",test_param.model_dir_path);
|
||||
FileStream fin(fopen(model_path,"r"));
|
||||
reg_boost_learner->LoadModel(fin);
|
||||
fin.Close();
|
||||
@ -62,10 +62,10 @@ namespace xgboost{
|
||||
int save_period;
|
||||
|
||||
/* \brief the path of directory containing the saved models */
|
||||
const char* model_dir_path;
|
||||
char model_dir_path[256];
|
||||
|
||||
/* \brief the path of directory containing the output prediction results */
|
||||
const char* pred_dir_path;
|
||||
char pred_dir_path[256];
|
||||
|
||||
/* \brief the paths of test data sets */
|
||||
std::vector<std::string> test_paths;
|
||||
@ -79,8 +79,8 @@ namespace xgboost{
|
||||
* \param val value of the parameter
|
||||
*/
|
||||
inline void SetParam(const char *name,const char *val ){
|
||||
if( !strcmp("model_dir_path", name ) ) model_dir_path = val;
|
||||
if( !strcmp("pred_dir_path", name ) ) model_dir_path = val;
|
||||
if( !strcmp("model_dir_path", name ) ) strcpy(model_dir_path,val);
|
||||
if( !strcmp("pred_dir_path", name ) ) strcpy(pred_dir_path,val);
|
||||
if( !strcmp("test_paths", name) ) {
|
||||
test_paths = StringProcessing::split(val,';');
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user