Package biz.k11i.xgboost.gbm
Class GBLinear
- java.lang.Object
-
- biz.k11i.xgboost.gbm.GBBase
-
- biz.k11i.xgboost.gbm.GBLinear
-
- All Implemented Interfaces:
GradBooster
,java.io.Serializable
public class GBLinear extends GBBase
Linear booster implementation- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
GBLinear.ModelParam
-
Nested classes/interfaces inherited from interface biz.k11i.xgboost.gbm.GradBooster
GradBooster.Factory
-
-
Field Summary
Fields Modifier and Type Field Description private GBLinear.ModelParam
mparam
private float[]
weights
-
Constructor Summary
Constructors Constructor Description GBLinear()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) float
bias(int gid)
void
loadModel(ModelReader reader, boolean ignored_with_pbuffer)
Loads model from stream.(package private) float
pred(FVec feat, int gid)
float[]
predict(FVec feat, int ntree_limit)
Generates predictions for given feature vector.int[]
predictLeaf(FVec feat, int ntree_limit)
Predicts the leaf index of each tree.float
predictSingle(FVec feat, int ntree_limit)
Generates a prediction for given feature vector.(package private) float
weight(int fid, int gid)
-
Methods inherited from class biz.k11i.xgboost.gbm.GBBase
setNumClass
-
-
-
-
Field Detail
-
mparam
private GBLinear.ModelParam mparam
-
weights
private float[] weights
-
-
Method Detail
-
loadModel
public void loadModel(ModelReader reader, boolean ignored_with_pbuffer) throws java.io.IOException
Description copied from interface:GradBooster
Loads model from stream.- Parameters:
reader
- input streamignored_with_pbuffer
- whether the incoming data contains pbuffer- Throws:
java.io.IOException
- If an I/O error occurs
-
predict
public float[] predict(FVec feat, int ntree_limit)
Description copied from interface:GradBooster
Generates predictions for given feature vector.- Parameters:
feat
- feature vectorntree_limit
- limit the number of trees used in prediction- Returns:
- prediction result
-
predictSingle
public float predictSingle(FVec feat, int ntree_limit)
Description copied from interface:GradBooster
Generates a prediction for given feature vector.This method only works when the model outputs single value.
- Parameters:
feat
- feature vectorntree_limit
- limit the number of trees used in prediction- Returns:
- prediction result
-
pred
float pred(FVec feat, int gid)
-
predictLeaf
public int[] predictLeaf(FVec feat, int ntree_limit)
Description copied from interface:GradBooster
Predicts the leaf index of each tree. This is only valid in gbtree predictor.- Parameters:
feat
- feature vectorntree_limit
- limit the number of trees used in prediction- Returns:
- predicted leaf indexes
-
weight
float weight(int fid, int gid)
-
bias
float bias(int gid)
-
-