Skip to content

Commit 9dc9a6f

Browse files
committed
Fix warnings
1 parent e285ad6 commit 9dc9a6f

File tree

19 files changed

+6
-28
lines changed

19 files changed

+6
-28
lines changed

lib/scholar/cluster/gmm.ex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ defmodule Scholar.Cluster.GaussianMixture do
2222

2323
import Nx.Defn
2424
import Scholar.Shared
25-
require Nx
2625

2726
@derive {Nx.Container, containers: [:weights, :means, :covariances, :precisions_cholesky]}
2827
defstruct [:weights, :means, :covariances, :precisions_cholesky]

lib/scholar/cluster/k_means.ex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ defmodule Scholar.Cluster.KMeans do
2222
"""
2323
import Nx.Defn
2424
import Scholar.Shared
25-
require Nx
2625

2726
@derive {Nx.Container, containers: [:num_iterations, :clusters, :inertia, :labels]}
2827
defstruct [:num_iterations, :clusters, :inertia, :labels]

lib/scholar/cluster/optics.ex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ defmodule Scholar.Cluster.OPTICS do
99
method.
1010
"""
1111
import Nx.Defn
12-
require Nx
1312

1413
@derive {Nx.Container, containers: [:labels, :min_samples, :max_eps, :eps, :algorithm]}
1514
defstruct [:labels, :min_samples, :max_eps, :eps, :algorithm]

lib/scholar/covariance/utils.ex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
defmodule Scholar.Covariance.Utils do
22
@moduledoc false
33
import Nx.Defn
4-
require Nx
54

65
defn center(x, assume_centered? \\ false) do
76
x =

lib/scholar/decomposition/utils.ex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
defmodule Scholar.Decomposition.Utils do
22
@moduledoc false
33
import Nx.Defn
4-
require Nx
54

65
defn flip_svd(u, v, u_based \\ true) do
76
base =

lib/scholar/linear/bayesian_ridge_regression.ex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ defmodule Scholar.Linear.BayesianRidgeRegression do
5959
Pedregosa et al., Scikit-learn: Machine Learning in Python,
6060
JMLR 12, pp. 2825-2830, 2011.
6161
"""
62-
require Nx
6362
import Nx.Defn
6463
import Scholar.Shared
6564
alias Scholar.Linear.LinearHelpers

lib/scholar/linear/isotonic_regression.ex

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ defmodule Scholar.Linear.IsotonicRegression do
274274
}
275275
}
276276
"""
277-
def preprocess(model, trim_duplicates \\ true) do
277+
def preprocess(%__MODULE__{} = model, trim_duplicates \\ true) do
278278
cutoff = Nx.to_number(model.cutoff_index)
279279
x = model.x_thresholds[0..cutoff]
280280
y = model.y_thresholds[0..cutoff]
@@ -303,16 +303,11 @@ defmodule Scholar.Linear.IsotonicRegression do
303303
{x, y}
304304
end
305305

306-
model = %__MODULE__{model | x_thresholds: x}
307-
model = %__MODULE__{model | y_thresholds: y}
308-
309306
%__MODULE__{
310307
model
311-
| preprocess:
312-
Scholar.Interpolation.Linear.fit(
313-
model.x_thresholds,
314-
model.y_thresholds
315-
)
308+
| x_thresholds: x,
309+
y_thresholds: y,
310+
preprocess: Scholar.Interpolation.Linear.fit(x, y)
316311
}
317312
end
318313

lib/scholar/linear/linear_regression.ex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ defmodule Scholar.Linear.LinearRegression do
55
Time complexity of linear regression is $O((K^2) * (K+N))$ where $N$ is the number of samples
66
and $K$ is the number of features.
77
"""
8-
require Nx
98
import Nx.Defn
109
import Scholar.Shared
1110
alias Scholar.Linear.LinearHelpers

lib/scholar/linear/ridge_regression.ex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ defmodule Scholar.Linear.RidgeRegression do
1919
Time complexity is $O(N^2)$ for `:cholesky` solver and $O((N^2) * (K + N))$ for `:svd` solver,
2020
where $N$ is the number of observations and $K$ is the number of features.
2121
"""
22-
require Nx
2322
import Nx.Defn
2423
import Scholar.Shared
2524
alias Scholar.Linear.LinearHelpers

lib/scholar/manifold/mds.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,8 @@ defmodule Scholar.Manifold.MDS do
395395
%__MODULE__{embedding: best, stress: best_stress, n_iter: best_iter}
396396
end
397397

398-
defnp special_preprocess(model) do
399-
%Scholar.Linear.IsotonicRegression{
398+
defnp special_preprocess(%Scholar.Linear.IsotonicRegression{} = model) do
399+
%{
400400
model
401401
| preprocess:
402402
Scholar.Interpolation.Linear.fit(

0 commit comments

Comments
 (0)