Closed ablaom closed 4 years ago
It seems to be sample_weight
, without s
. See https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html
Let me know if it works, I've never tried it. ScikitLearn is a thin wrapper around sklearn. Their docs are much more complete and useful than I could ever achieve.
Thanks, this appears to work:
using ScikitLearn, Random
@sk_import linear_model: SGDRegressor
model = SGDRegressor()
model.random_state = 1
X = randn(100, 4)
y = X[:,1] - 2X[:,2] + 0.05*randn(100)
w = rand(100)
fit!(model, X, y)
p1 = predict(model, X)
fit!(model, X, y)
p2 = predict(model, X)
p1 ≈ p2 # true
fit!(model, X, y, sample_weight=w)
p3 = predict(model, X)
!(p1 ≈ p3) # true
Sorry for the spam, but I've had no reply at this Discourse thread: https://discourse.julialang.org/t/does-scikitlearn-support-sample-weights-for-scikit-learn-models-that-do/30815