add in grad and hess rescale in lambdarank
This commit is contained in:
parent
671c34be63
commit
121348c0d7
@ -1,5 +0,0 @@
|
|||||||
1 0:2 1:3 2:2
|
|
||||||
0 0:2 1:3 2:2
|
|
||||||
0 0:2 1:3 2:2
|
|
||||||
0 0:2 1:3 2:2
|
|
||||||
1 0:2 1:3 2:2
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
2
|
|
||||||
3
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
1 0:2 1:3 2:2
|
|
||||||
0 0:2 1:3 2:2
|
|
||||||
0 0:2 1:3 2:2
|
|
||||||
0 0:2 1:3 2:2
|
|
||||||
1 0:2 1:3 2:2
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
2
|
|
||||||
3
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
1 0:1.2 1:3 2:5.6
|
|
||||||
0 0:2.0 1:2.3 2:5.1
|
|
||||||
0 0:3.9 1:3 2:3.1
|
|
||||||
0 0:2 1:3.2 2:3.4
|
|
||||||
1 0:2.1 1:4.5 2:4.2
|
|
||||||
0 0:1.9 1:2.8 2:3.1
|
|
||||||
1 0:3.0 1:2.0 2:1.1
|
|
||||||
0 0:1.9 1:1.8 2:2.1
|
|
||||||
0 0:1.1 1:2.2 2:1.4
|
|
||||||
1 0:2.1 1:4.1 2:4.0
|
|
||||||
0 0:1.9 1:2.2 2:1.1
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
6
|
|
||||||
5
|
|
||||||
@ -281,10 +281,12 @@ namespace xgboost{
|
|||||||
|
|
||||||
virtual void SetParam(const char *name, const char *val){
|
virtual void SetParam(const char *name, const char *val){
|
||||||
if( !strcmp( "loss_type", name ) ) loss_.loss_type = atoi( val );
|
if( !strcmp( "loss_type", name ) ) loss_.loss_type = atoi( val );
|
||||||
|
if( !strcmp( "fix_list_weight", name ) ) fix_list_weight_ = (float)atof( val );
|
||||||
|
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
LossType loss_;
|
LossType loss_;
|
||||||
|
float fix_list_weight_;
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
class Triple{
|
class Triple{
|
||||||
@ -372,6 +374,15 @@ namespace xgboost{
|
|||||||
grad[pairs[i].first] += first_order_gradient;
|
grad[pairs[i].first] += first_order_gradient;
|
||||||
hess[pairs[i].second] += second_order_gradient;
|
hess[pairs[i].second] += second_order_gradient;
|
||||||
grad[pairs[i].second] -= first_order_gradient;
|
grad[pairs[i].second] -= first_order_gradient;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if( fix_list_weight_ != 0.0f ){
|
||||||
|
float scale = fix_list_weight_ / (group_index[group+1] - group_index[group]);
|
||||||
|
for(unsigned j = group_index[group]; j < group_index[group+1]; ++j ){
|
||||||
|
grad[j] *= scale;
|
||||||
|
hess[j] *= scale;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user