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

Support evaluate for one instance #29

Closed
khosravipasha opened this issue Jul 19, 2020 · 1 comment
Closed

Support evaluate for one instance #29

khosravipasha opened this issue Jul 19, 2020 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@khosravipasha
Copy link
Collaborator

Currently evalute throws error if used on on instance for example:

circuit(data[1,:])

throw error that num_examples not defined.

One way to circument this is to do:

circuit(data[1:1,:])

But would be nice for end user to not have to deal with this.


or similarly we get similar errors for:

circuit(BitArray(undef, num_variables(circuit)))
circuit(Array{Bool}(undef, num_variables(circuit)))

More details:

MethodError: no method matching num_examples(::DataFrames.DataFrameRow{DataFrames.DataFrame,DataFrames.Index})
Closest candidates are:
  num_examples(!Matched::DataFrames.DataFrame) at /home/pasha/.julia/packages/LogicCircuits/CjRCP/src/Utils/data.jl:21
  num_examples(!Matched::AbstractArray{T,2} where T) at /home/pasha/.julia/packages/LogicCircuits/CjRCP/src/Utils/data.jl:22

Stacktrace:
 [1] evaluate(::Plain⋁Node, ::DataFrames.DataFrameRow{DataFrames.DataFrame,DataFrames.Index}) at /home/pasha/.julia/packages/LogicCircuits/CjRCP/src/queries.jl:177
 [2] (::Plain⋁Node)(::DataFrames.DataFrameRow{DataFrames.DataFrame,DataFrames.Index}) at /home/pasha/.julia/packages/LogicCircuits/CjRCP/src/queries.jl:171
 [3] top-level scope at In[138]:1
@khosravipasha khosravipasha added enhancement New feature or request good first issue Good for newcomers labels Jul 25, 2020
@guyvdbroeck
Copy link
Member

You can now do circuit(true, false, true) as well as circuit([true, false, true]) to evaluate the circuit on a single instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants