-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmix.exs
186 lines (176 loc) · 6.38 KB
/
mix.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
defmodule EXGBoost.MixProject do
use Mix.Project
@version "0.5.1"
def project do
[
app: :exgboost,
version: @version,
make_precompiler: {:nif, CCPrecompiler},
make_precompiler_url:
"https://github.com/acalejos/exgboost/releases/download/v#{@version}/@{artefact_filename}",
make_precompiler_priv_paths: ["libexgboost.*", "lib"],
# NIF Versions correspond to OTP Releases
# https://github.com/erlang/otp/blob/d3aa6c044c3927f011fb76ac087d5ce0e814954c/erts/emulator/beam/erl_nif.h#L57
make_precompiler_nif_versions: [
versions: ["2.15", "2.16", "2.17"]
],
elixir: "~> 1.14",
start_permanent: Mix.env() == :prod,
compilers: [:elixir_make] ++ Mix.compilers(),
deps: deps(),
name: "EXGBoost",
source_url: "https://github.com/acalejos/exgboost",
homepage_url: "https://github.com/acalejos/exgboost",
docs: docs(),
package: package(),
preferred_cli_env: [
docs: :docs,
"hex.publish": :docs
],
before_closing_body_tag: &before_closing_body_tag/1,
name: "EXGBoost",
description:
"Elixir bindings for the XGBoost library. `EXGBoost` provides an implementation of XGBoost that works with
[Nx](https://hexdocs.pm/nx/Nx.html) tensors."
]
end
def application do
[
extra_applications: [:logger],
mod: {EXGBoost.Application, []}
]
end
defp deps do
[
{:elixir_make, "~> 0.4", runtime: false},
{:nimble_options, "~> 1.0"},
{:nx, "~> 0.7"},
{:jason, "~> 1.3"},
{:ex_doc, "~> 0.31.0", only: :docs},
{:cc_precompiler, "~> 0.1.0", runtime: false},
{:exterval, "0.1.0"},
{:ex_json_schema, "~> 0.10.2"},
{:httpoison, "~> 2.0", runtime: false},
{:vega_lite, "~> 0.1"},
{:kino, "~> 0.11"},
{:scidata, "~> 0.1", only: :dev},
{:kino_vega_lite, "~> 0.1.9", only: :dev}
]
end
defp package do
[
maintainers: ["Andres Alejos"],
licenses: ["Apache-2.0"],
links: %{"GitHub" => "https://github.com/acalejos/exgboost"},
files: [
"lib",
"mix.exs",
"c",
"Makefile",
"README.md",
"LICENSE",
".formatter.exs",
"checksum.exs"
]
]
end
defp docs do
[
main: "EXGBoost",
extras: [
"notebooks/compiled_benchmarks.livemd",
"notebooks/iris_classification.livemd",
"notebooks/quantile_prediction_interval.livemd",
"notebooks/plotting.livemd"
],
groups_for_extras: [
Notebooks: Path.wildcard("notebooks/*.livemd")
],
groups_for_functions: [
"System / Native Config": &(&1[:type] == :system),
"Training & Prediction": &(&1[:type] == :train_pred),
Serialization: &(&1[:type] == :serialization),
Plotting: &(&1[:type] == :plotting)
],
groups_for_modules: [
Plotting: [EXGBoost.Plotting, EXGBoost.Plotting.Styles],
Training: [
EXGBoost.Training,
EXGBoost.Training.Callback,
EXGBoost.Booster,
EXGBoost.Parameters
]
],
before_closing_body_tag: &before_closing_body_tag/1
]
end
defp before_closing_body_tag(:html) do
"""
<!-- Render math with KaTeX -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-t5CR+zwDAROtph0PXGte6ia8heboACF9R5l/DiY+WZ3P2lxNgvJkQk5n7GPvLMYw" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-FaFLTlohFghEIZkw6VGwmf9ISTubWAVYW8tG8+w2LAIftJEULZABrF9PPFv+tVkH" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" integrity="sha384-bHBqxz8fokvgoJ/sc17HODNxa42TlaEhB+w8ZJXTc2nZf1VgEaFZeZvT4Mznfz0v" crossorigin="anonymous"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
renderMathInElement(document.body, {
delimiters: [
{ left: "$$", right: "$$", display: true },
{ left: "$", right: "$", display: false },
]
});
});
</script>
<!-- Render diagrams with Mermaid -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.min.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function () {
mermaid.initialize({ startOnLoad: false });
let id = 0;
for (const codeEl of document.querySelectorAll("pre code.mermaid")) {
const preEl = codeEl.parentElement;
const graphDefinition = codeEl.textContent;
const graphEl = document.createElement("div");
const graphId = "mermaid-graph-" + id++;
mermaid.render(graphId, graphDefinition, function (svgSource, bindListeners) {
graphEl.innerHTML = svgSource;
bindListeners && bindListeners(graphEl);
preEl.insertAdjacentElement("afterend", graphEl);
preEl.remove();
});
}
});
</script>
<!-- Render Vega-Lite charts -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<style>
.vega-container {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); /* Create as many columns as can fit items of at least 200px */
column-gap: 200px; /* Add a gap between the grid items */
}
.vega-item {
width: 100%; /* Make the items take up the full width of the grid cell */
}
</style>
<script>
document.addEventListener("DOMContentLoaded", function () {
for (const codeEl of document.querySelectorAll("pre code.vega-lite")) {
try {
const preEl = codeEl.parentElement;
const spec = JSON.parse(codeEl.textContent);
const plotEl = document.createElement("div");
preEl.insertAdjacentElement("afterend", plotEl);
vegaEmbed(plotEl, spec);
preEl.remove();
} catch (error) {
console.log("Failed to render Vega-Lite plot: " + error)
}
}
});
</script>
"""
end
defp before_closing_body_tag(_), do: ""
end