Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-deterministic? #97

Open
aaowens opened this issue Jul 30, 2019 · 0 comments
Open

Non-deterministic? #97

aaowens opened this issue Jul 30, 2019 · 0 comments

Comments

@aaowens
Copy link

aaowens commented Jul 30, 2019

using LowRankModels, DataFrames, Random

import RDatasets

# pick a data set
df = RDatasets.dataset("psych", "msq")

# we'll just fit four of the columns, to try out all four datatypes
dd = DataFrame([df[:,s] for s in [:TOD, :Vigorous, :Wakeful, :Alert, :Aroused, :Active]])
dd[!,end] = (dd[:,end].==1)

# help out by telling GLRM the correct data types
datatypes = [:real, :ord, :ord, :ord, :ord, :bool]

First run:

Random.seed!(1)
glrm = GLRM(dd, 3, datatypes)
init_svd!(glrm)
julia> X,Y = fit!(glrm)
Fitting GLRM
Iteration 10: objective value = 616391.8041060292

Second run:

Random.seed!(1)
glrm = GLRM(dd, 3, datatypes)
init_svd!(glrm)
julia> X,Y = fit!(glrm)
Iteration 10: objective value = 616391.8040991233

The objective value listed is different, even though I used the same random seed. What explains this?

In this particular example it is fairly stable regardless, but I tried fitting a model on some of my actual data, and I can't get reproducible results.

I'm using Julia 1.1.1. Perhaps this is a multi-threading issue? I have nthreads = 1, yet when I used ctrl-C on the fit I saw an error Error thrown in threaded loop on thread 0:.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant