wandb 0.1.9 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/wandb/version.rb +1 -1
- data/lib/wandb/xgboost_callback.rb +19 -9
- data/lib/wandb.rb +17 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed086eee277a0665a3281f93764c8042edf254c30bded00812f3f332085e0ece
|
4
|
+
data.tar.gz: 4c2e7443bbc914c38701eb3baa00f858f2e7a9d25afcef274c198404512681cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52c8315c8d711a06263cbd98d296b7fca5030ee1ed155e5603a607c04348a36115595cd2cfa9ea9b4a76547d3d31cce07f2835496bd26c78cbf6f3cb824253aa
|
7
|
+
data.tar.gz: caa96acc54494baf471d5b06dc74dfdde85fb7d54e35ebdfee485b3c02cbfca044c2c3793161b6eed2b0816b1e43a2568818d143e180a9af7697edfb7728b73c
|
data/lib/wandb/version.rb
CHANGED
@@ -20,7 +20,9 @@ module Wandb
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
attr_accessor :project_name, :api_key, :custom_loggers, :history, :sample
|
23
|
+
attr_accessor :project_name, :api_key, :custom_loggers, :history, :sample,
|
24
|
+
:log_model, :log_feature_importance, :importance_type, :define_metric,
|
25
|
+
:normalize_feature_importance
|
24
26
|
|
25
27
|
def initialize(options = {})
|
26
28
|
options = Opts.new(options)
|
@@ -35,6 +37,19 @@ module Wandb
|
|
35
37
|
@custom_loggers = options.default(:custom_loggers, [])
|
36
38
|
end
|
37
39
|
|
40
|
+
def as_json
|
41
|
+
{
|
42
|
+
log_model: @log_model,
|
43
|
+
log_feature_importance: @log_feature_importance,
|
44
|
+
importance_type: @importance_type,
|
45
|
+
define_metric: @define_metric,
|
46
|
+
normalize_feature_importance: @normalize_feature_importance,
|
47
|
+
sample: @sample,
|
48
|
+
project_name: @project_name,
|
49
|
+
callback_type: :wandb,
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
38
53
|
def before_training(model)
|
39
54
|
Wandb.login(api_key: api_key)
|
40
55
|
Wandb.init(project: project_name)
|
@@ -42,10 +57,8 @@ module Wandb
|
|
42
57
|
log_conf = {
|
43
58
|
learning_rate: config.dig("learner", "gradient_booster", "tree_train_param", "learning_rate").to_f,
|
44
59
|
max_depth: config.dig("learner", "gradient_booster", "tree_train_param", "max_depth").to_f,
|
45
|
-
n_estimators: model.num_boosted_rounds
|
60
|
+
n_estimators: model.num_boosted_rounds,
|
46
61
|
}
|
47
|
-
Wandb.current_run.config = log_conf
|
48
|
-
|
49
62
|
Wandb.log(log_conf)
|
50
63
|
model
|
51
64
|
end
|
@@ -65,7 +78,7 @@ module Wandb
|
|
65
78
|
|
66
79
|
Wandb.log(
|
67
80
|
"best_score" => model.best_score.to_f,
|
68
|
-
"best_iteration" => model.best_iteration.to_i
|
81
|
+
"best_iteration" => model.best_iteration.to_i,
|
69
82
|
)
|
70
83
|
finish
|
71
84
|
|
@@ -93,9 +106,6 @@ module Wandb
|
|
93
106
|
full_metric_name = "#{split}-#{metric}"
|
94
107
|
Wandb.log({ full_metric_name => epoch_value })
|
95
108
|
end
|
96
|
-
@custom_loggers.each do |logger|
|
97
|
-
logger.call(model, epoch, history)
|
98
|
-
end
|
99
109
|
Wandb.log("epoch" => epoch)
|
100
110
|
end
|
101
111
|
false
|
@@ -126,7 +136,7 @@ module Wandb
|
|
126
136
|
fi_data = fi.map { |k, v| [k, v] }
|
127
137
|
|
128
138
|
table = Wandb::Table.new(data: fi_data, columns: %w[Feature Importance])
|
129
|
-
bar_plot = Wandb::Plot.bar(table.table, "Feature", "Importance", title: "Feature Importance")
|
139
|
+
bar_plot = Wandb::Plot.bar(table.table, label: "Feature", value: "Importance", title: "Feature Importance")
|
130
140
|
Wandb.log({ "Feature Importance" => bar_plot.__pyptr__ })
|
131
141
|
end
|
132
142
|
|
data/lib/wandb.rb
CHANGED
@@ -48,6 +48,14 @@ module Wandb
|
|
48
48
|
@current_run = Run.new(run)
|
49
49
|
end
|
50
50
|
|
51
|
+
def latest_run=(run)
|
52
|
+
@latest_run = run
|
53
|
+
end
|
54
|
+
|
55
|
+
def latest_run
|
56
|
+
@latest_run
|
57
|
+
end
|
58
|
+
|
51
59
|
# Get the current run
|
52
60
|
attr_reader :current_run
|
53
61
|
|
@@ -74,7 +82,6 @@ module Wandb
|
|
74
82
|
Plot
|
75
83
|
end
|
76
84
|
|
77
|
-
# Add this new method
|
78
85
|
def run_url
|
79
86
|
raise "No active run. Call Wandb.init() first." unless @current_run
|
80
87
|
|
@@ -244,8 +251,14 @@ module Wandb
|
|
244
251
|
# Plot class
|
245
252
|
class Plot
|
246
253
|
class << self
|
247
|
-
def bar(table,
|
248
|
-
py_plot = Wandb.__pyptr__.plot.bar(
|
254
|
+
def bar(table, label:, value:, title: nil, split_table: false)
|
255
|
+
py_plot = Wandb.__pyptr__.plot.bar(
|
256
|
+
table: table.__pyptr__,
|
257
|
+
label: label,
|
258
|
+
value: value,
|
259
|
+
title: title,
|
260
|
+
split_table: split_table,
|
261
|
+
)
|
249
262
|
new(py_plot)
|
250
263
|
end
|
251
264
|
|
@@ -270,7 +283,7 @@ module Wandb
|
|
270
283
|
end
|
271
284
|
|
272
285
|
def __pyptr__
|
273
|
-
@plot
|
286
|
+
@plot.__pyptr__
|
274
287
|
end
|
275
288
|
end
|
276
289
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wandb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Shollenberger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pycall
|