julia> A=Factor(["a", "b"],[3, 2],[0.5, 0.1, 0.3, 0.8, 0, 0.9]);

julia> B=Factor(["b", "c"],[2, 2],[0.5, 0.1, 0.7, 0.2]);

julia> C = FactorProduct(A, B)
Factor(["a", "b", "c"],[3, 2, 2],[0.25, 0.05, 0.15, 0.08, 0.0, 0.09, 0.35,
0.07, 0.21, 0.16, 0.0, 0.18])

julia> FactorDropMargin(C, ["c"]) # Yichao, this is what I want to do
Factor(["a", "b"],[3, 2],[0.6, 0.12, 0.36, 0.24, 0.0, 0.27]) # Yichao, this
is what I want to do

julia> FactorKeepMargin(C, ["b", "a"])
Factor(["b", "a"],[2, 3],[0.6, 0.24, 0.12, 0.0, 0.36, 0.27])

julia> FactorPermute(ans, [2, 1])
Factor(["a", "b"],[3, 2],[0.6, 0.12, 0.36, 0.24, 0.0, 0.27])

julia> FactorKeepMargin(C, ["a", "b"])
Factor(["a", "b"],[3, 2],[0.6, 0.12, 0.36, 0.24, 0.0, 0.27])

On Tue, Nov 22, 2016 at 6:27 PM, Yichao Yu <yyc1...@gmail.com> wrote:

> > Yichao and DPSanders, I have already used instances of Factor on
> runtests.jl, instances A, B, and C
>
> AFAICT you are still accessing a non existing field of a type[1] and
> it's unclear what you actually want to do.
>
> [1] https://github.com/hpoit/MLN.jl/blob/1c13725666f34587e57c4a1757e622
> 2cacaeab73/BN/src/FactorOperations.jl#L87
>
> >
> > A=Factor(["a", "b"],[3, 2],[0.5, 0.1, 0.3, 0.8, 0, 0.9])
> > B=Factor(["b", "c"],[2, 2],[0.5, 0.1, 0.7, 0.2])
> > C = FactorProduct(A, B)
> > FactorDropMargin(C, ["c"])
> >
> > Do you recommend I make any of the functions in FactorOperations.jl into
> inner constructors of `type Factor` in Factor.jl?
>

Reply via email to