Skip to content

Commit

Permalink
Merge branch 'msluszniak-mds' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
msluszniak committed Nov 7, 2023
2 parents cf8bbe4 + 8c559ff commit 496b1c5
Show file tree
Hide file tree
Showing 4 changed files with 634 additions and 179 deletions.
179 changes: 0 additions & 179 deletions lib/scholar/covariance.ex

This file was deleted.

21 changes: 21 additions & 0 deletions lib/scholar/linear/isotonic_regression.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ defmodule Scholar.Linear.IsotonicRegression do
observations by solving a convex optimization problem. It is a form of
regression analysis that can be used as an alternative to polynomial
regression to fit nonlinear data.
Time complexity of isotonic regression is $O(N^2)$ where $N$ is the
number of points.
"""
require Nx
import Nx.Defn, except: [transform: 2]
Expand Down Expand Up @@ -306,6 +309,24 @@ defmodule Scholar.Linear.IsotonicRegression do
}
end

@doc """
Preprocesses the `model` for prediction.
Returns an updated `model`. This is a special version of `preprocess/1` that
does not trim duplicates so it can be used in defns. It is not recommended
to use this function directly.
"""
defn special_preprocess(model) do
%__MODULE__{
model
| preprocess:
Scholar.Interpolation.Linear.fit(
model.x_thresholds,
model.y_thresholds
)
}
end

deftransform check_preprocess(model) do
if model.preprocess == {} do
raise ArgumentError,
Expand Down
Loading

0 comments on commit 496b1c5

Please sign in to comment.