Skip to content

Commit

Permalink
+preprocess_input_data
Browse files Browse the repository at this point in the history
  • Loading branch information
edo-007 committed Jun 10, 2024
1 parent c765481 commit 599f3a5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,20 @@ end
############################################################################################
############ Utils #########################################################################
############################################################################################

function preprocess_inputdata(
X::AbstractDataFrame,
y;
remove_duplicate_rows = false
)
if remove_duplicate_rows
allunique(X) && return (X, y)
nonunique_ind = nonunique(X)
Xy = hcat( X[findall((!).(nonunique_ind)), :],
y[findall((!).(nonunique_ind))]
) |> dropmissing
else
Xy = hcat(X[:, :], y[:]) |> dropmissing
end
return Xy[:, 1:(end-1)], Xy[:, end]
end

0 comments on commit 599f3a5

Please sign in to comment.