Closed RaSi96 closed 1 year ago
This is likely because Impute.jl is careful not to change your element type for two reasons:
My guess is that Turing.jl is converting your ints to floats for you. With Impute.jl you just need to be explicit about what you want.
julia> Impute.svd(Matrix{Union{Float64, Missing}}(df))
4×2 Matrix{Union{Missing, Float64}}:
2.0 9.43342
3.0 9.0
3.44377 16.0
5.0 25.0
Hi @rofinn, thanks for responding! Apologies for the late reply, I somehow completely missed being notified about this. Your explanation makes a lot of sense; I tried it again using floats only and it worked:
julia> a = DataFrame(:a => [2.0, 3.0, missing, 5.0], :b => [missing, 9.0, 16, 25.0])
4×2 DataFrame
Row │ a b
│ Float64? Float64?
────┼──────────────────────
1 │ 2.0 missing
2 │ 3.0 9.0
3 │ missing 16.0
4 │ 5.0 25.0
julia> Impute.svd(Matrix(a))
4×2 Matrix{Union{Missing, Float64}}:
2.0 9.43342
3.0 9.0
3.44377 16.0
5.0 25.0
I also tried using it on a different amount of data that I originally intended to use this for, and it worked on that without a problem - drawing on what you've said, it might be because all of that information was by default read as floats. Thanks for your help, I'll close this issue.
Hi all,
Apologies for the bother but I was quite curious about the SVD method provided by this package and decided to try it out on a seemingly harmless dataframe:
Where
:b
is intended to be:a.^2
(the square of:a
). After getting a couple of errors trying to use the raw dataframe, I came across #128 and tried using a matrix-converted dataframe, but interestingly ended up with this error:From what I gleaned from a quick Google-Fu (2 separate links), somewhere in the chain of function calls there maybe isn't a round-off check? I think it might be due to the small size of my test dataframe, but I can't be sure because I also tried using it with
Turing.jl
's Bayesian Linear Regression for imputation purposes and it worked (to some degree of accuracy). Is there anything wrong here or have I overlooked something?Thanks for your time!