lib/lightgbm/utils.rb in lightgbm-0.1.1 vs lib/lightgbm/utils.rb in lightgbm-0.1.2
- old
+ new
@@ -6,14 +6,22 @@
raise LightGBM::Error, FFI.LGBM_GetLastError if err != 0
end
# remove spaces in keys and values to prevent injection
def params_str(params)
- (params || {}).map { |k, v| [check_param(k.to_s), check_param(v.to_s)].join("=") }.join(" ")
+ params.map { |k, v| [check_param(k.to_s), check_param(Array(v).join(",").to_s)].join("=") }.join(" ")
end
def check_param(v)
raise ArgumentError, "Invalid parameter" if /[[:space:]]/.match(v)
v
+ end
+
+ # change default verbosity
+ def set_verbosity(params)
+ params_keys = params.keys.map(&:to_s)
+ unless params_keys.include?("verbosity")
+ params["verbosity"] = -1
+ end
end
end
end