Skip to content

Commit

Permalink
Update lib/scholar/linear/bayesian_ridge_regression.ex
Browse files Browse the repository at this point in the history
Co-authored-by: Mateusz Sluszniak <56299341+msluszniak@users.noreply.github.com>
  • Loading branch information
JoaquinIglesiasTurina and msluszniak authored Apr 5, 2024
1 parent 3694a0d commit 199e1f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/scholar/linear/bayesian_ridge_regression.ex
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ defmodule Scholar.Linear.BayesianRidgeRegression do
# handle vector types
# handle default alpha value, add eps to avoid division by 0
eps = Nx.Constants.smallest_positive_normal(x_type)
default_alpha = Nx.divide(1, Nx.add(Nx.variance(x), eps))
default_alpha = 1 / (Nx.variance(x) + eps)
alpha = Keyword.get(opts, :alpha_init, default_alpha)
alpha = Nx.tensor(alpha, type: x_type)
opts = Keyword.put(opts, :alpha_init, alpha)
Expand Down

0 comments on commit 199e1f2

Please sign in to comment.