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

MAR results in OutOfMemoryErrors #126

Closed
zevereir opened this issue Dec 1, 2022 · 1 comment
Closed

MAR results in OutOfMemoryErrors #126

zevereir opened this issue Dec 1, 2022 · 1 comment

Comments

@zevereir
Copy link

zevereir commented Dec 1, 2022

function net1()
    a,b,c,d = pos_literals(ProbCircuit, 4)

    full_c_b=0.3*c+0.7*(-c)
    full_c_neg_b=0.8*c+0.2*(-c)
    b_a_1=b*full_c_b
    b_a_2=(-b)*full_c_neg_b

    full_b_a=0.6*b_a_1+0.4*b_a_2


    full_b_neg_a=0.5*b_a_1+0.5*b_a_2
    a1=a*full_b_a
    a2=(-a)*full_b_neg_a
    full_a=0.25*a1+0.75*a2

    return full_a
end

catalog = DataFrame(CSV.File("test_data.csv"));
catalog=DataFrame(BitArray(Matrix(catalog)), :auto)

combinations=[]
for column in 1:size(catalog)[2]
    push!(combinations, [x for x in Set(catalog[:,column])])
end
all_models=DataFrame(BitArray(Matrix(DataFrame(collect(Iterators.product(combinations...))))), :auto)
print("All models loaded")
print(exp.(MAR(net1(),all_models)))

test_data.csv is an easy way to define the domains of the variables

a,c,b,d
True,True,True,True
False,False,False,False

When using MAR, this always results in the following error
image

Is there something wrong in my code?

Greetings
Sieben

@khosravipasha
Copy link
Contributor

Hi, the error suggests you are running out of memory. How big the all_models dataframe is? And how much free RAM did you have? Also what verison of libarary are you using?

The MAR function does not do any batching, i.e. it tries to allocate meomry in order of O(circuit_size * num_datapoints) which could be big. You can try calling MAR on a smaller subset of your data and see what happens. If the error persists might be other issues.

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

2 participants