We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 211264f commit 49ded97Copy full SHA for 49ded97
src/optimizers/gradient.jl
@@ -31,8 +31,10 @@ function train_with_gradient!(
31
batch_size = get(params, :batch_size, -1)
32
verbose = get(params, :verbose, true)
33
compute_cost_every = get(params, :compute_cost_every, 1)
34
+ time_limit = get(params, :time_limit, Inf)
35
36
# init parameters
37
+ start_time = time()
38
T = size(X)[1]
39
best_C = Inf
40
best_θ = extract_params(model.forecast)
@@ -69,6 +71,11 @@ function train_with_gradient!(
69
71
best_C = C
70
72
73
end
74
+
75
+ # check time limit reach
76
+ if time() - start_time > time_limit
77
+ break
78
+ end
79
80
81
# take gradient step
0 commit comments