diff --git a/lib/scholar/covariance/ledoit_wolf.ex b/lib/scholar/covariance/ledoit_wolf.ex index a80c50e4..a9debc24 100644 --- a/lib/scholar/covariance/ledoit_wolf.ex +++ b/lib/scholar/covariance/ledoit_wolf.ex @@ -13,7 +13,7 @@ defmodule Scholar.Covariance.LedoitWolf do defstruct [:covariance, :shrinkage, :location] opts_schema = [ - assume_centered: [ + assume_centered?: [ default: false, type: :boolean, doc: """ @@ -93,7 +93,7 @@ defmodule Scholar.Covariance.LedoitWolf do iex> key = Nx.Random.key(0) iex> {x, _new_key} = Nx.Random.multivariate_normal(key, Nx.tensor([0.0, 0.0, 0.0]), Nx.tensor([[3.0, 2.0, 1.0], [1.0, 2.0, 3.0], [1.3, 1.0, 2.2]]), shape: {10}, type: :f32) - iex> cov = Scholar.Covariance.LedoitWolf.fit(x, assume_centered: true) + iex> cov = Scholar.Covariance.LedoitWolf.fit(x, assume_centered?: true) iex> cov.covariance #Nx.Tensor< f32[3][3] @@ -110,7 +110,7 @@ defmodule Scholar.Covariance.LedoitWolf do end defnp fit_n(x, opts) do - {x, location} = Scholar.Covariance.Utils.center(x, opts[:assume_centered]) + {x, location} = Scholar.Covariance.Utils.center(x, opts[:assume_centered?]) {covariance, shrinkage} = ledoit_wolf(x) diff --git a/lib/scholar/covariance/shrunk_covariance.ex b/lib/scholar/covariance/shrunk_covariance.ex index f17ac8cc..770c1ca7 100644 --- a/lib/scholar/covariance/shrunk_covariance.ex +++ b/lib/scholar/covariance/shrunk_covariance.ex @@ -8,7 +8,7 @@ defmodule Scholar.Covariance.ShrunkCovariance do defstruct [:covariance, :location] opts_schema = [ - assume_centered: [ + assume_centered?: [ default: false, type: :boolean, doc: """ @@ -94,7 +94,7 @@ defmodule Scholar.Covariance.ShrunkCovariance do """ end - {x, location} = Scholar.Covariance.Utils.center(x, opts[:assume_centered]) + {x, location} = Scholar.Covariance.Utils.center(x, opts[:assume_centered?]) covariance = Scholar.Covariance.Utils.empirical_covariance(x) diff --git a/test/scholar/covariance/ledoit_wolf_test.exs b/test/scholar/covariance/ledoit_wolf_test.exs index 27e1893c..d7906b07 100644 --- a/test/scholar/covariance/ledoit_wolf_test.exs +++ b/test/scholar/covariance/ledoit_wolf_test.exs @@ -40,7 +40,7 @@ defmodule Scholar.Covariance.LedoitWolfTest do ) end - test "fit test - :assume_centered is true" do + test "fit test - :assume_centered? is true" do key = key() {x, _new_key} = @@ -52,7 +52,7 @@ defmodule Scholar.Covariance.LedoitWolfTest do type: :f32 ) - model = LedoitWolf.fit(x, assume_centered: true) + model = LedoitWolf.fit(x, assume_centered?: true) assert_all_close( model.covariance, diff --git a/test/scholar/covariance/shrunk_covariance_test.exs b/test/scholar/covariance/shrunk_covariance_test.exs index b8792efe..e11bc676 100644 --- a/test/scholar/covariance/shrunk_covariance_test.exs +++ b/test/scholar/covariance/shrunk_covariance_test.exs @@ -38,7 +38,7 @@ defmodule Scholar.Covariance.ShrunkCovarianceTest do ) end - test "fit test - :assume_centered is true" do + test "fit test - :assume_centered? is true" do key = key() {x, _new_key} = @@ -50,7 +50,7 @@ defmodule Scholar.Covariance.ShrunkCovarianceTest do type: :f32 ) - model = ShrunkCovariance.fit(x, assume_centered: true) + model = ShrunkCovariance.fit(x, assume_centered?: true) assert_all_close( model.covariance,