Skip to content

Commit df8e539

Browse files
committed
Added reset method
1 parent fabf8d8 commit df8e539

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

lib/xgboost.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def train(
9191
evals_result.merge!(cb_container.history)
9292
end
9393

94-
bst
94+
bst.reset
9595
end
9696

9797
def cv(

lib/xgboost/booster.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ def save_config
4747
json_string.read_pointer.read_string(length.read_uint64).force_encoding(Encoding::UTF_8)
4848
end
4949

50+
def reset
51+
check_call FFI.XGBoosterReset(handle)
52+
self
53+
end
54+
5055
def attr(key)
5156
ret = ::FFI::MemoryPointer.new(:pointer)
5257
success = ::FFI::MemoryPointer.new(:int)

lib/xgboost/ffi.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ module FFI
3939
attach_function :XGBoosterUpdateOneIter, %i[pointer int pointer], :int
4040
attach_function :XGBoosterEvalOneIter, %i[pointer int pointer pointer uint64 pointer], :int
4141
attach_function :XGBoosterFree, %i[pointer], :int
42+
attach_function :XGBoosterReset, %i[pointer], :int
4243
attach_function :XGBoosterBoostedRounds, %i[pointer pointer], :int
4344
attach_function :XGBoosterSetParam, %i[pointer string string], :int
4445
attach_function :XGBoosterGetNumFeature, %i[pointer pointer], :int

0 commit comments

Comments
 (0)