8000 Make exgboost compile with exterval 0.2 and clang > 3.5 by mrmarbury · Pull Request #45 · acalejos/exgboost · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Make exgboost compile with exterval 0.2 and clang > 3.5 #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ $(XGBOOST_LIB_DIR_FLAG):
git checkout FETCH_HEAD && \
git submodule update --init --recursive && \
sed 's|learner_parameters\["generic_param"\] = ToJson(ctx_);|&\nlearner_parameters\["default_metric"\] = String(obj_->DefaultEvalMetric());|' src/learner.cc > src/learner.cc.tmp && mv src/learner.cc.tmp src/learner.cc && \
cmake -DCMAKE_INSTALL_PREFIX=$(XGBOOST_LIB_DIR) -B build . $(CMAKE_FLAGS) && \
cmake -DCMAKE_INSTALL_PREFIX=$(XGBOOST_LIB_DIR) -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -B build . $(CMAKE_FLAGS) && \
make -C build -j1 install
touch $(XGBOOST_LIB_DIR_FLAG)

Expand All @@ -74,4 +74,4 @@ clean:
rm -rf $(EXGBOOST_SO)
rm -rf $(EXGBOOST_LIB_DIR)
rm -rf $(XGBOOST_DIR)
rm -rf $(XGBOOST_LIB_DIR_FLAG)
rm -rf $(XGBOOST_LIB_DIR_FLAG)
4 changes: 2 additions & 2 deletions c/exgboost/src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ ERL_NIF_TERM exg_get_binary_from_address(ErlNifEnv *env, int argc,
ret = exg_error(env, "Failed to allocate binary");
goto END;
}
memcpy(out_bin.data, address, size);
memcpy(out_bin.data, (const void *)(uintptr_t)address, size);
ret = exg_ok(env, enif_make_binary(env, &out_bin));
END:
return ret;
Expand All @@ -177,4 +177,4 @@ ERL_NIF_TERM exg_get_int_size(ErlNifEnv *env, int argc,
ret = exg_ok(env, enif_make_int(env, size));
END:
return ret;
}
}
28 changes: 14 additions & 14 deletions lib/exgboost/parameters.ex
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ defmodule EXGBoost.Parameters do

@tree_booster_params [
eta: [
type: {:in, ~I<[0,1]>},
type: {:in, ~i<[0,1]>},
default: 0.3,
doc: """
Step size shrinkage used in update to prevents overfitting. After each
Expand All @@ -107,7 +107,7 @@ defmodule EXGBoost.Parameters do
"""
],
gamma: [
type: {:in, ~I<[0,:infinity]>},
type: {:in, ~i<[0,:infinity]>},
default: 0.0,
doc: ~S"""
Minimum loss reduction required to make a further partition on a leaf node
Expand All @@ -126,7 +126,7 @@ defmodule EXGBoost.Parameters do
"""
],
min_child_weight: [
type: {:in, ~I<[0,:infinity]>},
type: {:in, ~i<[0,:infinity]>},
default: 1,
doc: ~S"""
Minimum sum of instance weight (hessian) needed in a child. If the tree partition
Expand All @@ -138,7 +138,7 @@ defmodule EXGBoost.Parameters do
"""
],
max_delta_step: [
type: {:in, ~I<[0,:infinity]>},
type: {:in, ~i<[0,:infinity]>},
default: 0,
doc: ~S"""
Maximum delta step we allow each tree's weight estimation to be. If the value is set
Expand All @@ -149,7 +149,7 @@ defmodule EXGBoost.Parameters do
"""
],
subsample: [
type: {:in, ~I<(0,1]>},
type: {:in, ~i<(0,1]>},
default: 1.0,
doc: """
Subsample ratio of the training instance. Setting it to `0.5` means that XGBoost
Expand Down Expand Up @@ -179,15 +179,15 @@ defmodule EXGBoost.Parameters do
"""
],
lambda: [
type: {:in, ~I<[0,:infinity]>},
type: {:in, ~i<[0,:infinity]>},
default: 1,
doc: ~S"""
L2 regularization term on weights. Increasing this value will make model more conservative.
Valid range is [0, $\infty$].
"""
],
alpha: [
type: {:in, ~I<[0,:infinity]>},
type: {:in, ~i<[0,:infinity]>},
default: 0,
doc: ~S"""
L1 regularization term on weights. Increasing this value will make model more conservative.
Expand Down Expand Up @@ -358,7 +358,7 @@ defmodule EXGBoost.Parameters do
"""
],
rate_drop: [
type: {:in, ~I<[0,1]>},
type: {:in, ~i<[0,1]>},
default: 0.0,
doc: """
Dropout rate (a fraction of previous trees to drop during the dropout). Valid range is [0, 1].
Expand All @@ -372,7 +372,7 @@ defmodule EXGBoost.Parameters do
"""
],
skip_drop: [
type: {:in, ~I<[0,1]>},
type: {:in, ~i<[0,1]>},
default: 0.0,
doc: """
Probability of skipping the dropout procedure during a boosting iteration. Valid range is [0, 1].
Expand Down Expand Up @@ -517,7 +517,7 @@ defmodule EXGBoost.Parameters do

@tweedie_params [
tweedie_variance_power: [
type: {:in, ~I<(1,2)>},
type: {:in, ~i<(1,2)>},
default: 1.5,
doc: """
Parameter that controls the variance of the Tweedie distribution `var(y) ~ E(y)^tweedie_variance_power`.
Expand All @@ -530,7 +530,7 @@ defmodule EXGBoost.Parameters do

@pseudohubererror_params [
huber_slope: [
type: {:in, ~I<[0,:infinity]>},
type: {:in, ~i<[0,:infinity]>},
default: 1.0,
doc: """
A parameter used for Pseudo-Huber loss.
Expand All @@ -549,7 +549,7 @@ defmodule EXGBoost.Parameters do

@quantileerror_params [
quantile_alpha: [
type: {:in, ~I<(0,1)>},
type: {:in, ~i<(0,1)>},
default: 0.5,
doc: """
Targeted Quantile.
Expand Down Expand Up @@ -578,7 +578,7 @@ defmodule EXGBoost.Parameters do
"""
],
lambdarank_num_pair_per_sample: [
type: {:in, ~I<[1,:infinity]>},
type: {:in, ~i<[1,:infinity]>},
doc: ~S"""
It specifies the number of pairs sampled for each document when pair method is `:mean`, or the truncation level for queries when the pair method is `:topk`. For example, to train with `{:ndcg,6}`, set `:lambdarank_num_pair_per_sample` to `6` and `:lambdarank_pair_method` to `topk`. Valid range is [1, $\infty$].
"""
Expand Down Expand Up @@ -653,7 +653,7 @@ defmodule EXGBoost.Parameters do
Enum.reduce_while(x, {:ok, []}, fn x, {_status, acc} ->
case x do
{key, value} when key in [:tree, :level, :node] and is_number(value) ->
if value in ~I<(0,1]> do
if value in ~i<(0,1]> do
{:cont, {:ok, [{String.to_atom("colsample_by#{key}"), value} | acc]}}
else
{:halt, {:error, "Parameter `colsample` must be in (0,1], got #{inspect(x)}"}}
Expand Down
4 changes: 2 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule EXGBoost.MixProject do
use Mix.Project
@version "0.5.1"
@version "0.5.2"

def project do
[
Expand Down Expand Up @@ -51,7 +51,7 @@ defmodule EXGBoost.MixProject do
{:jason, "~> 1.3"},
{:ex_doc, "~> 0.31.0", only: :docs},
{:cc_precompiler, "~> 0.1.0", runtime: false},
{:exterval, "0.1.0"},
{:exterval, "0.2.0"},
{:ex_json_schema, "~> 0.10.2"},
{:httpoison, "~> 2.0", runtime: false},
{:vega_lite, "~> 0.1"},
Expand Down
Loading
0