Thanks! This works,
using ScikitLearn, PyCall
const LogisticRegression = PyNULL()
function __init__()
@eval @sk_import linear_model: LogisticRegression
end
function logistic_skl(points::AbstractMatrix{<:Real}, labels::AbstractVector{Bool})
log_reg = fit!(LogisticRegression(penalty="l2"), points', labels)
w = vec(log_reg.coef_)
b = only(log_reg.intercept_)
return w, b
end
However, I do get a warning from modifying the const
:
WARNING: redefinition of constant LogisticRegression. This may fail, cause incorrect answers, or produce other errors.
So I suppose there should still be a better way.