chg all settings to obj
This commit is contained in:
@@ -25,7 +25,7 @@ namespace xgboost{
|
||||
RegRankBoostLearner(void){
|
||||
silent = 0;
|
||||
obj_ = NULL;
|
||||
name_obj_ = "reg";
|
||||
name_obj_ = "reg:linear";
|
||||
}
|
||||
/*!
|
||||
* \brief a regression booter associated with training and evaluating data
|
||||
|
||||
@@ -129,7 +129,9 @@ namespace xgboost{
|
||||
if( fs.Read(&nwt, sizeof(unsigned) ) != 0 ){
|
||||
utils::Assert( nwt == 0 || nwt == data.NumRow(), "invalid weight" );
|
||||
info.weights.resize( nwt );
|
||||
utils::Assert( fs.Read(&info.weights[0], sizeof(unsigned) * nwt) != 0, "Load weight file");
|
||||
if( nwt != 0 ){
|
||||
utils::Assert( fs.Read(&info.weights[0], sizeof(unsigned) * nwt) != 0, "Load weight file");
|
||||
}
|
||||
}
|
||||
}
|
||||
fs.Close();
|
||||
|
||||
@@ -109,15 +109,16 @@ namespace xgboost{
|
||||
namespace xgboost{
|
||||
namespace regrank{
|
||||
inline IObjFunction* CreateObjFunction( const char *name ){
|
||||
if( !strcmp("reg", name ) ) return new RegressionObj();
|
||||
if( !strcmp("rank:pairwise", name ) ) return new PairwiseRankObj();
|
||||
if( !strcmp("rank:softmax", name ) ) return new SoftmaxRankObj();
|
||||
if( !strcmp("softmax", name ) ) return new SoftmaxMultiClassObj();
|
||||
// if (!strcmp("lambdarank:map", name)) return new LambdaRankObj_MAP();
|
||||
// if (!strcmp("lambdarank:ndcg", name)) return new LambdaRankObj_NDCG();
|
||||
utils::Error("unknown objective function type");
|
||||
return NULL;
|
||||
}
|
||||
if( !strcmp("reg:linear", name ) ) return new RegressionObj( LossType::kLinearSquare );
|
||||
if( !strcmp("reg:logistic", name ) ) return new RegressionObj( LossType::kLogisticNeglik );
|
||||
if( !strcmp("binary:logistic", name ) ) return new RegressionObj( LossType::kLogisticClassify );
|
||||
if( !strcmp("binary:logitraw", name ) ) return new RegressionObj( LossType::kLogisticRaw );
|
||||
if( !strcmp("multi:softmax", name ) ) return new SoftmaxMultiClassObj();
|
||||
if( !strcmp("rank:pairwise", name ) ) return new PairwiseRankObj();
|
||||
if( !strcmp("rank:softmax", name ) ) return new SoftmaxRankObj();
|
||||
utils::Error("unknown objective function type");
|
||||
return NULL;
|
||||
}
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -14,8 +14,8 @@ namespace xgboost{
|
||||
namespace regrank{
|
||||
class RegressionObj : public IObjFunction{
|
||||
public:
|
||||
RegressionObj(void){
|
||||
loss.loss_type = LossType::kLinearSquare;
|
||||
RegressionObj( int loss_type ){
|
||||
loss.loss_type = loss_type;
|
||||
}
|
||||
virtual ~RegressionObj(){}
|
||||
virtual void SetParam(const char *name, const char *val){
|
||||
|
||||
Reference in New Issue
Block a user