Re: [julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-23 Thread Kevin Liu
Hey Yichao, it's late here, I will continue tomorrow. Thanks for your help!

> On Nov 23, 2016, at 22:59, Yichao Yu  wrote:
> 
>> On Wed, Nov 23, 2016 at 7:31 PM, Kevin Liu  wrote:
>> In `permute_dims = [Remain_dims,Remove_dims]`, both Remain and Remove_dims
> 
> Which is why it is wrong.
> 
>> are vectors. Even if I `permute_dims = [Remain_dims]`, I still get the same
>> error.
> 
> 
> julia> [[1]]
> 1-element Array{Array{Int64,1},1}:
> [1]
> 
> julia> [[1];]
> 1-element Array{Int64,1}:
> 1
> 
> 
>> 
>>> On Wed, Nov 23, 2016 at 9:54 PM, Yichao Yu  wrote:
>>> 
 On Wed, Nov 23, 2016 at 6:50 PM, Kevin Liu  wrote:
 Attached!
>>> 
>>> ```
>>> help?> permutedims
>>> search: permutedims permutedims! ipermutedims
>>> 
>>>  permutedims(A, perm)
>>> 
>>>  Permute the dimensions of array A. perm is a vector specifying a
>>> permutation
>>>  of length ndims(A). This is a generalization of transpose for
>>>  multi-dimensional arrays. Transpose is equivalent to permutedims(A,
>>> [2,1]).
>>> 
>>>  julia> A = reshape(collect(1:8), (2,2,2))
>>>  2×2×2 Array{Int64,3}:
>>>  [:, :, 1] =
>>>   1  3
>>>   2  4
>>>  
>>>  [:, :, 2] =
>>>   5  7
>>>   6  8
>>> 
>>>  julia> permutedims(A, [3, 2, 1])
>>>  2×2×2 Array{Int64,3}:
>>>  [:, :, 1] =
>>>   1  3
>>>   5  7
>>>  
>>>  [:, :, 2] =
>>>   2  4
>>>   6  8
>>> ```
>>> 
>>> You are not giving `permutedims` the correct second parameters
>>> 
>>> (https://github.com/hpoit/MLN.jl/blob/1c13725666f34587e57c4a1757e6222cacaeab73/BN/src/FactorOperations.jl#L66).
>>> 
>>> 
 
> On Wed, Nov 23, 2016 at 9:44 PM, Yichao Yu  wrote:
> 
>> On Wed, Nov 23, 2016 at 4:02 PM, Kevin Liu  wrote:
>> Yichao, would you give me some direction? I am a bit lost.
> 
> Post and/or identify the error after you've fixed the `Factor.` problem
> 
>> 
>>> On Tue, Nov 22, 2016 at 7:58 PM, Kevin Liu  wrote:
>>> 
>>> Do you want a cut in the profits for helping me get it to work? It's
>>> a
>>> marathon. I still have Markov Random Field and Markov Logic Network
>>> in
>>> line... and two of the largest private Brazilian banks on standby.
>>> 
> On Nov 22, 2016, at 19:39, Yichao Yu  wrote:
> 
> On Tue, Nov 22, 2016 at 4:23 PM, Kevin Liu 
> wrote:
> I would like to remove variable "c" from factor C. I tried
> removing
> `Factor.` but it didn't work.
 
 There might be (almost certainly) multiple mistakes in the code so
 fixing one won't fix all of them.
 
> 
>> On Tue, Nov 22, 2016 at 6:54 PM, Yichao Yu 
>> wrote:
>> 
>>> On Tue, Nov 22, 2016 at 3:45 PM, Kevin Liu 
>>> wrote:
>>> Yichao, I used a hashtag in the last message to show you what I
>>> want
>>> to
>>> do. Is it clear?
>> 
>> No
>> 
>> I'm just talking about the `Factor.` in the line I linked. I
>> don't
>> know what you want to access. Do you just want `FactorMargin`?
>> What's
>> the extra `Factor.` for?
>> 
>>> 
>>> On Nov 22, 2016, at 18:27, Yichao Yu  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/1c13725666f34587e57c4a1757e6222cacaeab73/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?
> 
> 
>> 
>> 
 
 
>> 
>> 


Re: [julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-23 Thread Yichao Yu
On Wed, Nov 23, 2016 at 7:31 PM, Kevin Liu  wrote:
> In `permute_dims = [Remain_dims,Remove_dims]`, both Remain and Remove_dims

Which is why it is wrong.

> are vectors. Even if I `permute_dims = [Remain_dims]`, I still get the same
> error.


julia> [[1]]
1-element Array{Array{Int64,1},1}:
 [1]

julia> [[1];]
1-element Array{Int64,1}:
 1


>
> On Wed, Nov 23, 2016 at 9:54 PM, Yichao Yu  wrote:
>>
>> On Wed, Nov 23, 2016 at 6:50 PM, Kevin Liu  wrote:
>> > Attached!
>>
>> ```
>> help?> permutedims
>> search: permutedims permutedims! ipermutedims
>>
>>   permutedims(A, perm)
>>
>>   Permute the dimensions of array A. perm is a vector specifying a
>> permutation
>>   of length ndims(A). This is a generalization of transpose for
>>   multi-dimensional arrays. Transpose is equivalent to permutedims(A,
>> [2,1]).
>>
>>   julia> A = reshape(collect(1:8), (2,2,2))
>>   2×2×2 Array{Int64,3}:
>>   [:, :, 1] =
>>1  3
>>2  4
>>   
>>   [:, :, 2] =
>>5  7
>>6  8
>>
>>   julia> permutedims(A, [3, 2, 1])
>>   2×2×2 Array{Int64,3}:
>>   [:, :, 1] =
>>1  3
>>5  7
>>   
>>   [:, :, 2] =
>>2  4
>>6  8
>> ```
>>
>> You are not giving `permutedims` the correct second parameters
>>
>> (https://github.com/hpoit/MLN.jl/blob/1c13725666f34587e57c4a1757e6222cacaeab73/BN/src/FactorOperations.jl#L66).
>>
>>
>> >
>> > On Wed, Nov 23, 2016 at 9:44 PM, Yichao Yu  wrote:
>> >>
>> >> On Wed, Nov 23, 2016 at 4:02 PM, Kevin Liu  wrote:
>> >> > Yichao, would you give me some direction? I am a bit lost.
>> >>
>> >> Post and/or identify the error after you've fixed the `Factor.` problem
>> >>
>> >> >
>> >> > On Tue, Nov 22, 2016 at 7:58 PM, Kevin Liu  wrote:
>> >> >>
>> >> >> Do you want a cut in the profits for helping me get it to work? It's
>> >> >> a
>> >> >> marathon. I still have Markov Random Field and Markov Logic Network
>> >> >> in
>> >> >> line... and two of the largest private Brazilian banks on standby.
>> >> >>
>> >> >> > On Nov 22, 2016, at 19:39, Yichao Yu  wrote:
>> >> >> >
>> >> >> >> On Tue, Nov 22, 2016 at 4:23 PM, Kevin Liu 
>> >> >> >> wrote:
>> >> >> >> I would like to remove variable "c" from factor C. I tried
>> >> >> >> removing
>> >> >> >> `Factor.` but it didn't work.
>> >> >> >
>> >> >> > There might be (almost certainly) multiple mistakes in the code so
>> >> >> > fixing one won't fix all of them.
>> >> >> >
>> >> >> >>
>> >> >> >>> On Tue, Nov 22, 2016 at 6:54 PM, Yichao Yu 
>> >> >> >>> wrote:
>> >> >> >>>
>> >> >>  On Tue, Nov 22, 2016 at 3:45 PM, Kevin Liu 
>> >> >>  wrote:
>> >> >>  Yichao, I used a hashtag in the last message to show you what I
>> >> >>  want
>> >> >>  to
>> >> >>  do. Is it clear?
>> >> >> >>>
>> >> >> >>> No
>> >> >> >>>
>> >> >> >>> I'm just talking about the `Factor.` in the line I linked. I
>> >> >> >>> don't
>> >> >> >>> know what you want to access. Do you just want `FactorMargin`?
>> >> >> >>> What's
>> >> >> >>> the extra `Factor.` for?
>> >> >> >>>
>> >> >> 
>> >> >>  On Nov 22, 2016, at 18:27, Yichao Yu  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/1c13725666f34587e57c4a1757e6222cacaeab73/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?
>> >> >> >>
>> >> >> >>
>> >> >
>> >> >
>> >
>> >
>
>


Re: [julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-23 Thread Kevin Liu
In `permute_dims = [Remain_dims,Remove_dims]`, both Remain and Remove_dims
are vectors. Even if I `permute_dims = [Remain_dims]`, I still get the same
error.

On Wed, Nov 23, 2016 at 9:54 PM, Yichao Yu  wrote:

> On Wed, Nov 23, 2016 at 6:50 PM, Kevin Liu  wrote:
> > Attached!
>
> ```
> help?> permutedims
> search: permutedims permutedims! ipermutedims
>
>   permutedims(A, perm)
>
>   Permute the dimensions of array A. perm is a vector specifying a
> permutation
>   of length ndims(A). This is a generalization of transpose for
>   multi-dimensional arrays. Transpose is equivalent to permutedims(A,
> [2,1]).
>
>   julia> A = reshape(collect(1:8), (2,2,2))
>   2×2×2 Array{Int64,3}:
>   [:, :, 1] =
>1  3
>2  4
>   
>   [:, :, 2] =
>5  7
>6  8
>
>   julia> permutedims(A, [3, 2, 1])
>   2×2×2 Array{Int64,3}:
>   [:, :, 1] =
>1  3
>5  7
>   
>   [:, :, 2] =
>2  4
>6  8
> ```
>
> You are not giving `permutedims` the correct second parameters
> (https://github.com/hpoit/MLN.jl/blob/1c13725666f34587e57c4a1757e622
> 2cacaeab73/BN/src/FactorOperations.jl#L66).
>
>
> >
> > On Wed, Nov 23, 2016 at 9:44 PM, Yichao Yu  wrote:
> >>
> >> On Wed, Nov 23, 2016 at 4:02 PM, Kevin Liu  wrote:
> >> > Yichao, would you give me some direction? I am a bit lost.
> >>
> >> Post and/or identify the error after you've fixed the `Factor.` problem
> >>
> >> >
> >> > On Tue, Nov 22, 2016 at 7:58 PM, Kevin Liu  wrote:
> >> >>
> >> >> Do you want a cut in the profits for helping me get it to work? It's
> a
> >> >> marathon. I still have Markov Random Field and Markov Logic Network
> in
> >> >> line... and two of the largest private Brazilian banks on standby.
> >> >>
> >> >> > On Nov 22, 2016, at 19:39, Yichao Yu  wrote:
> >> >> >
> >> >> >> On Tue, Nov 22, 2016 at 4:23 PM, Kevin Liu 
> wrote:
> >> >> >> I would like to remove variable "c" from factor C. I tried
> removing
> >> >> >> `Factor.` but it didn't work.
> >> >> >
> >> >> > There might be (almost certainly) multiple mistakes in the code so
> >> >> > fixing one won't fix all of them.
> >> >> >
> >> >> >>
> >> >> >>> On Tue, Nov 22, 2016 at 6:54 PM, Yichao Yu 
> >> >> >>> wrote:
> >> >> >>>
> >> >>  On Tue, Nov 22, 2016 at 3:45 PM, Kevin Liu 
> >> >>  wrote:
> >> >>  Yichao, I used a hashtag in the last message to show you what I
> >> >>  want
> >> >>  to
> >> >>  do. Is it clear?
> >> >> >>>
> >> >> >>> No
> >> >> >>>
> >> >> >>> I'm just talking about the `Factor.` in the line I linked. I
> don't
> >> >> >>> know what you want to access. Do you just want `FactorMargin`?
> >> >> >>> What's
> >> >> >>> the extra `Factor.` for?
> >> >> >>>
> >> >> 
> >> >>  On Nov 22, 2016, at 18:27, Yichao Yu  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/
> 1c13725666f34587e57c4a1757e6222cacaeab73/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?
> >> >> >>
> >> >> >>
> >> >
> >> >
> >
> >
>


Re: [julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-23 Thread Yichao Yu
On Wed, Nov 23, 2016 at 6:50 PM, Kevin Liu  wrote:
> Attached!

```
help?> permutedims
search: permutedims permutedims! ipermutedims

  permutedims(A, perm)

  Permute the dimensions of array A. perm is a vector specifying a permutation
  of length ndims(A). This is a generalization of transpose for
  multi-dimensional arrays. Transpose is equivalent to permutedims(A, [2,1]).

  julia> A = reshape(collect(1:8), (2,2,2))
  2×2×2 Array{Int64,3}:
  [:, :, 1] =
   1  3
   2  4
  
  [:, :, 2] =
   5  7
   6  8

  julia> permutedims(A, [3, 2, 1])
  2×2×2 Array{Int64,3}:
  [:, :, 1] =
   1  3
   5  7
  
  [:, :, 2] =
   2  4
   6  8
```

You are not giving `permutedims` the correct second parameters
(https://github.com/hpoit/MLN.jl/blob/1c13725666f34587e57c4a1757e6222cacaeab73/BN/src/FactorOperations.jl#L66).


>
> On Wed, Nov 23, 2016 at 9:44 PM, Yichao Yu  wrote:
>>
>> On Wed, Nov 23, 2016 at 4:02 PM, Kevin Liu  wrote:
>> > Yichao, would you give me some direction? I am a bit lost.
>>
>> Post and/or identify the error after you've fixed the `Factor.` problem
>>
>> >
>> > On Tue, Nov 22, 2016 at 7:58 PM, Kevin Liu  wrote:
>> >>
>> >> Do you want a cut in the profits for helping me get it to work? It's a
>> >> marathon. I still have Markov Random Field and Markov Logic Network in
>> >> line... and two of the largest private Brazilian banks on standby.
>> >>
>> >> > On Nov 22, 2016, at 19:39, Yichao Yu  wrote:
>> >> >
>> >> >> On Tue, Nov 22, 2016 at 4:23 PM, Kevin Liu  wrote:
>> >> >> I would like to remove variable "c" from factor C. I tried removing
>> >> >> `Factor.` but it didn't work.
>> >> >
>> >> > There might be (almost certainly) multiple mistakes in the code so
>> >> > fixing one won't fix all of them.
>> >> >
>> >> >>
>> >> >>> On Tue, Nov 22, 2016 at 6:54 PM, Yichao Yu 
>> >> >>> wrote:
>> >> >>>
>> >>  On Tue, Nov 22, 2016 at 3:45 PM, Kevin Liu 
>> >>  wrote:
>> >>  Yichao, I used a hashtag in the last message to show you what I
>> >>  want
>> >>  to
>> >>  do. Is it clear?
>> >> >>>
>> >> >>> No
>> >> >>>
>> >> >>> I'm just talking about the `Factor.` in the line I linked. I don't
>> >> >>> know what you want to access. Do you just want `FactorMargin`?
>> >> >>> What's
>> >> >>> the extra `Factor.` for?
>> >> >>>
>> >> 
>> >>  On Nov 22, 2016, at 18:27, Yichao Yu  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/1c13725666f34587e57c4a1757e6222cacaeab73/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?
>> >> >>
>> >> >>
>> >
>> >
>
>


Re: [julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-23 Thread Yichao Yu
On Wed, Nov 23, 2016 at 4:02 PM, Kevin Liu  wrote:
> Yichao, would you give me some direction? I am a bit lost.

Post and/or identify the error after you've fixed the `Factor.` problem

>
> On Tue, Nov 22, 2016 at 7:58 PM, Kevin Liu  wrote:
>>
>> Do you want a cut in the profits for helping me get it to work? It's a
>> marathon. I still have Markov Random Field and Markov Logic Network in
>> line... and two of the largest private Brazilian banks on standby.
>>
>> > On Nov 22, 2016, at 19:39, Yichao Yu  wrote:
>> >
>> >> On Tue, Nov 22, 2016 at 4:23 PM, Kevin Liu  wrote:
>> >> I would like to remove variable "c" from factor C. I tried removing
>> >> `Factor.` but it didn't work.
>> >
>> > There might be (almost certainly) multiple mistakes in the code so
>> > fixing one won't fix all of them.
>> >
>> >>
>> >>> On Tue, Nov 22, 2016 at 6:54 PM, Yichao Yu  wrote:
>> >>>
>>  On Tue, Nov 22, 2016 at 3:45 PM, Kevin Liu  wrote:
>>  Yichao, I used a hashtag in the last message to show you what I want
>>  to
>>  do. Is it clear?
>> >>>
>> >>> No
>> >>>
>> >>> I'm just talking about the `Factor.` in the line I linked. I don't
>> >>> know what you want to access. Do you just want `FactorMargin`? What's
>> >>> the extra `Factor.` for?
>> >>>
>> 
>>  On Nov 22, 2016, at 18:27, Yichao Yu  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/1c13725666f34587e57c4a1757e6222cacaeab73/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?
>> >>
>> >>
>
>


Re: [julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-22 Thread Kevin Liu
Thanks. Is there anything that sticks out to you?

On Tue, Nov 22, 2016 at 7:39 PM, Yichao Yu  wrote:

> On Tue, Nov 22, 2016 at 4:23 PM, Kevin Liu  wrote:
> > I would like to remove variable "c" from factor C. I tried removing
> > `Factor.` but it didn't work.
>
> There might be (almost certainly) multiple mistakes in the code so
> fixing one won't fix all of them.
>
> >
> > On Tue, Nov 22, 2016 at 6:54 PM, Yichao Yu  wrote:
> >>
> >> On Tue, Nov 22, 2016 at 3:45 PM, Kevin Liu  wrote:
> >> > Yichao, I used a hashtag in the last message to show you what I want
> to
> >> > do. Is it clear?
> >>
> >> No
> >>
> >> I'm just talking about the `Factor.` in the line I linked. I don't
> >> know what you want to access. Do you just want `FactorMargin`? What's
> >> the extra `Factor.` for?
> >>
> >> >
> >> > On Nov 22, 2016, at 18:27, Yichao Yu  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?
> >
> >
>


Re: [julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-22 Thread Yichao Yu
On Tue, Nov 22, 2016 at 4:23 PM, Kevin Liu  wrote:
> I would like to remove variable "c" from factor C. I tried removing
> `Factor.` but it didn't work.

There might be (almost certainly) multiple mistakes in the code so
fixing one won't fix all of them.

>
> On Tue, Nov 22, 2016 at 6:54 PM, Yichao Yu  wrote:
>>
>> On Tue, Nov 22, 2016 at 3:45 PM, Kevin Liu  wrote:
>> > Yichao, I used a hashtag in the last message to show you what I want to
>> > do. Is it clear?
>>
>> No
>>
>> I'm just talking about the `Factor.` in the line I linked. I don't
>> know what you want to access. Do you just want `FactorMargin`? What's
>> the extra `Factor.` for?
>>
>> >
>> > On Nov 22, 2016, at 18:27, Yichao Yu  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/1c13725666f34587e57c4a1757e6222cacaeab73/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?
>
>


Re: [julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-22 Thread Kevin Liu
I would like to remove variable "c" from factor C. I tried removing
`Factor.` but it didn't work.

On Tue, Nov 22, 2016 at 6:54 PM, Yichao Yu  wrote:

> On Tue, Nov 22, 2016 at 3:45 PM, Kevin Liu  wrote:
> > Yichao, I used a hashtag in the last message to show you what I want to
> do. Is it clear?
>
> No
>
> I'm just talking about the `Factor.` in the line I linked. I don't
> know what you want to access. Do you just want `FactorMargin`? What's
> the extra `Factor.` for?
>
> >
> > On Nov 22, 2016, at 18:27, Yichao Yu  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?
>


Re: [julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-22 Thread Yichao Yu
On Tue, Nov 22, 2016 at 3:45 PM, Kevin Liu  wrote:
> Yichao, I used a hashtag in the last message to show you what I want to do. 
> Is it clear?

No

I'm just talking about the `Factor.` in the line I linked. I don't
know what you want to access. Do you just want `FactorMargin`? What's
the extra `Factor.` for?

>
> On Nov 22, 2016, at 18:27, Yichao Yu  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/1c13725666f34587e57c4a1757e6222cacaeab73/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?


Re: [julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-22 Thread Kevin Liu
Yichao, I used a hashtag in the last message to show you what I want to do. Is 
it clear? 

On Nov 22, 2016, at 18:27, Yichao Yu  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/1c13725666f34587e57c4a1757e6222cacaeab73/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?


Re: [julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-22 Thread Kevin Liu
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  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?
>


Re: [julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-22 Thread Yichao Yu
> 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/1c13725666f34587e57c4a1757e6222cacaeab73/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?


Re: [julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-22 Thread Kevin Liu
On Tuesday, November 22, 2016 at 5:53:14 PM UTC-2, Kevin Liu wrote:
> On Friday, November 18, 2016 at 4:07:44 PM UTC-2, Kevin Liu wrote:
> > Have a look please https://github.com/hpoit/MLN.jl/tree/master/BN
> > 
> > On Friday, November 18, 2016 at 11:48:58 AM UTC-2, Yichao Yu wrote:On Thu, 
> > Nov 17, 2016 at 2:39 PM, Kevin Liu  wrote:
> > 
> > > Right, I need the instance of Factor
> > 
> > 
> > 
> > Then use the instance of Factor.
> > 
> > 
> > 
> > >
> > 
> > > On Thursday, November 17, 2016 at 5:33:05 PM UTC-2, Yichao Yu wrote:
> > 
> > >>
> > 
> > >> On Thu, Nov 17, 2016 at 2:27 PM, Kevin Liu  wrote:
> > 
> > >> > I replaced Factor[:FactorMargin]() with Factor.FactorMargin() back
> > 
> > >> > again.
> > 
> > >> >
> > 
> > >> > Still, for FactorOperations.jl on Atom, I get {UndefVarError: Factor 
> > >> > not
> > 
> > >> > defined} at the end of each block.
> > 
> > >> >
> > 
> > >> > Factor is defined on Factor.jl, and that file evaluates fine.
> > 
> > >>
> > 
> > >> AFAICT the `Factor`is a type so `Factor.FactorMargin` is definitely 
> > >> wrong.
> > 
> > >>
> > 
> > >> >
> > 
> > >> > The main file, BN.jl, includes Factor.jl and FactorOperations.jl and
> > 
> > >> > exports
> > 
> > >> > Factor, and also evaluates fine.
> > 
> > >> >
> > 
> > >> > On Wednesday, November 16, 2016 at 11:25:24 PM UTC-2, Yichao Yu wrote:
> > 
> > >> >>
> > 
> > >> >> On Wed, Nov 16, 2016 at 7:24 PM, Kevin Liu  wrote:
> > 
> > >> >> > Hi Yichao!
> > 
> > >> >>
> > 
> > >> >> In general there's nothing from the code you posted that shows what
> > 
> > >> >> you want to do.
> > 
> > >> >>
> > 
> > >> >> >
> > 
> > >> >> > Here is the function from FactorOperations.jl
> > 
> > >> >> >
> > 
> > >> >> > function FactorDropMargin(A::Factor, Remove_var::Vector{String})
> > 
> > >> >> >     Remove_dims = indexin(Remove_var, A.var)
> > 
> > >> >> >     if any(Remove_dims==0)
> > 
> > >> >> >         error("Wrong variable!")
> > 
> > >> >> >     end
> > 
> > >> >> >
> > 
> > >> >> >     Remain_var = symdiff(A.var, Remove_var)
> > 
> > >> >> >     Remain_dims = indexin(Remain_var, A.var)
> > 
> > >> >> >
> > 
> > >> >> >     Factor[:FactorMargin](A, Remove_var, Remain_var, Remove_dims,
> > 
> > >> >> > Remain_dims) # line 85
> > 
> > >> >>
> > 
> > >> >> Unless you overloaded getindex on this type (which you should include)
> > 
> > >> >> you are construction a Vector of `Factor` from a symbol and then
> > 
> > >> >> calling it. It's impossible to tell what you actually want to do.
> > 
> > >> >>
> > 
> > >> >> And as I previously mentioned, unless you are using PyCall, the issue
> > 
> > >> >> you linked is totally unrelated to this.
> > 
> > >> >>
> > 
> > >> >> > end
> > 
> > >> >> >
> > 
> > >> >> > runtests.jl:
> > 
> > >> >> >
> > 
> > >> >> > @testset "Multiply and marginalize factor" begin
> > 
> > >> >> >
> > 
> > >> >> >   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"]) # line 19
> > 
> > >> >> >   FactorKeepMargin(C, ["b", "a"])
> > 
> > >> >> >   FactorPermute(ans, [2, 1])
> > 
> > >> >> >   FactorKeepMargin(C, ["a", "b"])
> > 
> > >> >> >
> > 
> > >> >> > end
> > 
> > >> >> >
> > 
> > >> >> > what I got on the REPL:
> > 
> > >> >> >
> > 
> > >> >> > julia> Pkg.test("BN")
> > 
> > >> >> >
> > 
> > >> >> > INFO: Testing BN
> > 
> > >> >> >
> > 
> > >> >> > Test Summary:                                     |
> > 
> > >> >> >
> > 
> > >> >> >   Define, permute factor, and call (var, card, val) | No tests
> > 
> > >> >> >
> > 
> > >> >> > Multiply and marginalize factor: Error During Test
> > 
> > >> >> >
> > 
> > >> >> >   Got an exception of type ErrorException outside of a @test
> > 
> > >> >> >
> > 
> > >> >> >   type DataType has no field FactorMargin
> > 
> > >> >> >
> > 
> > >> >> >    in FactorDropMargin(::BN.Factor, ::Array{String,1}) at
> > 
> > >> >> > /Users/Corvus/.julia/v0.5/BN/src/FactorOperations.jl:85
> > 
> > >> >> >
> > 
> > >> >> >    in macro expansion; at
> > 
> > >> >> > /Users/Corvus/.julia/v0.5/BN/test/runtests.jl:19
> > 
> > >> >> > [inlined]
> > 
> > >> >> >
> > 
> > >> >> >    in macro expansion; at ./test.jl:672 [inlined]
> > 
> > >> >> >
> > 
> > >> >> >    in anonymous at ./:?
> > 
> > >> >> >
> > 
> > >> >> >    in include_from_node1(::String) at ./loading.jl:488
> > 
> > >> >> >
> > 
> > >> >> >    in include_from_node1(::String) at
> > 
> > >> >> >
> > 
> > >> >> >
> > 
> > >> >> > /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?
> > 
> > >> >> >
> > 
> > >> >> >    in process_options(::Base.JLOptions) at ./client.jl:262
> > 
> > >> >> >
> > 
> > >> >> >    in _start() at ./client.jl:318
> > 
> > >> >> >
> > 
> > >> >> >    in _start() at
> > 
> > >> >> >
> > 
> > >> >> >
> > 
> > >> >> > 

Re: [julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-22 Thread Kevin Liu
On Friday, November 18, 2016 at 4:07:44 PM UTC-2, Kevin Liu wrote:
> Have a look please https://github.com/hpoit/MLN.jl/tree/master/BN
> 
> On Friday, November 18, 2016 at 11:48:58 AM UTC-2, Yichao Yu wrote:On Thu, 
> Nov 17, 2016 at 2:39 PM, Kevin Liu  wrote:
> 
> > Right, I need the instance of Factor
> 
> 
> 
> Then use the instance of Factor.
> 
> 
> 
> >
> 
> > On Thursday, November 17, 2016 at 5:33:05 PM UTC-2, Yichao Yu wrote:
> 
> >>
> 
> >> On Thu, Nov 17, 2016 at 2:27 PM, Kevin Liu  wrote:
> 
> >> > I replaced Factor[:FactorMargin]() with Factor.FactorMargin() back
> 
> >> > again.
> 
> >> >
> 
> >> > Still, for FactorOperations.jl on Atom, I get {UndefVarError: Factor not
> 
> >> > defined} at the end of each block.
> 
> >> >
> 
> >> > Factor is defined on Factor.jl, and that file evaluates fine.
> 
> >>
> 
> >> AFAICT the `Factor`is a type so `Factor.FactorMargin` is definitely wrong.
> 
> >>
> 
> >> >
> 
> >> > The main file, BN.jl, includes Factor.jl and FactorOperations.jl and
> 
> >> > exports
> 
> >> > Factor, and also evaluates fine.
> 
> >> >
> 
> >> > On Wednesday, November 16, 2016 at 11:25:24 PM UTC-2, Yichao Yu wrote:
> 
> >> >>
> 
> >> >> On Wed, Nov 16, 2016 at 7:24 PM, Kevin Liu  wrote:
> 
> >> >> > Hi Yichao!
> 
> >> >>
> 
> >> >> In general there's nothing from the code you posted that shows what
> 
> >> >> you want to do.
> 
> >> >>
> 
> >> >> >
> 
> >> >> > Here is the function from FactorOperations.jl
> 
> >> >> >
> 
> >> >> > function FactorDropMargin(A::Factor, Remove_var::Vector{String})
> 
> >> >> >     Remove_dims = indexin(Remove_var, A.var)
> 
> >> >> >     if any(Remove_dims==0)
> 
> >> >> >         error("Wrong variable!")
> 
> >> >> >     end
> 
> >> >> >
> 
> >> >> >     Remain_var = symdiff(A.var, Remove_var)
> 
> >> >> >     Remain_dims = indexin(Remain_var, A.var)
> 
> >> >> >
> 
> >> >> >     Factor[:FactorMargin](A, Remove_var, Remain_var, Remove_dims,
> 
> >> >> > Remain_dims) # line 85
> 
> >> >>
> 
> >> >> Unless you overloaded getindex on this type (which you should include)
> 
> >> >> you are construction a Vector of `Factor` from a symbol and then
> 
> >> >> calling it. It's impossible to tell what you actually want to do.
> 
> >> >>
> 
> >> >> And as I previously mentioned, unless you are using PyCall, the issue
> 
> >> >> you linked is totally unrelated to this.
> 
> >> >>
> 
> >> >> > end
> 
> >> >> >
> 
> >> >> > runtests.jl:
> 
> >> >> >
> 
> >> >> > @testset "Multiply and marginalize factor" begin
> 
> >> >> >
> 
> >> >> >   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"]) # line 19
> 
> >> >> >   FactorKeepMargin(C, ["b", "a"])
> 
> >> >> >   FactorPermute(ans, [2, 1])
> 
> >> >> >   FactorKeepMargin(C, ["a", "b"])
> 
> >> >> >
> 
> >> >> > end
> 
> >> >> >
> 
> >> >> > what I got on the REPL:
> 
> >> >> >
> 
> >> >> > julia> Pkg.test("BN")
> 
> >> >> >
> 
> >> >> > INFO: Testing BN
> 
> >> >> >
> 
> >> >> > Test Summary:                                     |
> 
> >> >> >
> 
> >> >> >   Define, permute factor, and call (var, card, val) | No tests
> 
> >> >> >
> 
> >> >> > Multiply and marginalize factor: Error During Test
> 
> >> >> >
> 
> >> >> >   Got an exception of type ErrorException outside of a @test
> 
> >> >> >
> 
> >> >> >   type DataType has no field FactorMargin
> 
> >> >> >
> 
> >> >> >    in FactorDropMargin(::BN.Factor, ::Array{String,1}) at
> 
> >> >> > /Users/Corvus/.julia/v0.5/BN/src/FactorOperations.jl:85
> 
> >> >> >
> 
> >> >> >    in macro expansion; at
> 
> >> >> > /Users/Corvus/.julia/v0.5/BN/test/runtests.jl:19
> 
> >> >> > [inlined]
> 
> >> >> >
> 
> >> >> >    in macro expansion; at ./test.jl:672 [inlined]
> 
> >> >> >
> 
> >> >> >    in anonymous at ./:?
> 
> >> >> >
> 
> >> >> >    in include_from_node1(::String) at ./loading.jl:488
> 
> >> >> >
> 
> >> >> >    in include_from_node1(::String) at
> 
> >> >> >
> 
> >> >> >
> 
> >> >> > /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?
> 
> >> >> >
> 
> >> >> >    in process_options(::Base.JLOptions) at ./client.jl:262
> 
> >> >> >
> 
> >> >> >    in _start() at ./client.jl:318
> 
> >> >> >
> 
> >> >> >    in _start() at
> 
> >> >> >
> 
> >> >> >
> 
> >> >> > /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?
> 
> >> >> >
> 
> >> >> > Test Summary:                   | Error  Total
> 
> >> >> >
> 
> >> >> >   Multiply and marginalize factor |     1      1
> 
> >> >> >
> 
> >> >> >
> 
> >> >> > On Wednesday, November 16, 2016 at 10:02:48 PM UTC-2, Yichao Yu
> 
> >> >> > wrote:
> 
> >> >> >>
> 
> >> >> >> On Wed, Nov 16, 2016 at 6:50 PM, Kevin Liu  wrote:
> 
> >> >> >> > From this issue https://github.com/JuliaPy/PyPlot.jl/issues/157 I
> 
> >> >> >> > understand
> 
> >> >> >>
> 
> >> >> >> ^^ This is 

Re: [julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-18 Thread Kevin Liu
Have a look please https://github.com/hpoit/MLN.jl/tree/master/BN

On Friday, November 18, 2016 at 11:48:58 AM UTC-2, Yichao Yu wrote:
>
> On Thu, Nov 17, 2016 at 2:39 PM, Kevin Liu  
> wrote: 
> > Right, I need the instance of Factor 
>
> Then use the instance of Factor. 
>
> > 
> > On Thursday, November 17, 2016 at 5:33:05 PM UTC-2, Yichao Yu wrote: 
> >> 
> >> On Thu, Nov 17, 2016 at 2:27 PM, Kevin Liu  wrote: 
> >> > I replaced Factor[:FactorMargin]() with Factor.FactorMargin() back 
> >> > again. 
> >> > 
> >> > Still, for FactorOperations.jl on Atom, I get {UndefVarError: Factor 
> not 
> >> > defined} at the end of each block. 
> >> > 
> >> > Factor is defined on Factor.jl, and that file evaluates fine. 
> >> 
> >> AFAICT the `Factor`is a type so `Factor.FactorMargin` is definitely 
> wrong. 
> >> 
> >> > 
> >> > The main file, BN.jl, includes Factor.jl and FactorOperations.jl and 
> >> > exports 
> >> > Factor, and also evaluates fine. 
> >> > 
> >> > On Wednesday, November 16, 2016 at 11:25:24 PM UTC-2, Yichao Yu 
> wrote: 
> >> >> 
> >> >> On Wed, Nov 16, 2016 at 7:24 PM, Kevin Liu  
> wrote: 
> >> >> > Hi Yichao! 
> >> >> 
> >> >> In general there's nothing from the code you posted that shows what 
> >> >> you want to do. 
> >> >> 
> >> >> > 
> >> >> > Here is the function from FactorOperations.jl 
> >> >> > 
> >> >> > function FactorDropMargin(A::Factor, Remove_var::Vector{String}) 
> >> >> > Remove_dims = indexin(Remove_var, A.var) 
> >> >> > if any(Remove_dims==0) 
> >> >> > error("Wrong variable!") 
> >> >> > end 
> >> >> > 
> >> >> > Remain_var = symdiff(A.var, Remove_var) 
> >> >> > Remain_dims = indexin(Remain_var, A.var) 
> >> >> > 
> >> >> > Factor[:FactorMargin](A, Remove_var, Remain_var, Remove_dims, 
> >> >> > Remain_dims) # line 85 
> >> >> 
> >> >> Unless you overloaded getindex on this type (which you should 
> include) 
> >> >> you are construction a Vector of `Factor` from a symbol and then 
> >> >> calling it. It's impossible to tell what you actually want to do. 
> >> >> 
> >> >> And as I previously mentioned, unless you are using PyCall, the 
> issue 
> >> >> you linked is totally unrelated to this. 
> >> >> 
> >> >> > end 
> >> >> > 
> >> >> > runtests.jl: 
> >> >> > 
> >> >> > @testset "Multiply and marginalize factor" begin 
> >> >> > 
> >> >> >   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"]) # line 19 
> >> >> >   FactorKeepMargin(C, ["b", "a"]) 
> >> >> >   FactorPermute(ans, [2, 1]) 
> >> >> >   FactorKeepMargin(C, ["a", "b"]) 
> >> >> > 
> >> >> > end 
> >> >> > 
> >> >> > what I got on the REPL: 
> >> >> > 
> >> >> > julia> Pkg.test("BN") 
> >> >> > 
> >> >> > INFO: Testing BN 
> >> >> > 
> >> >> > Test Summary: | 
> >> >> > 
> >> >> >   Define, permute factor, and call (var, card, val) | No tests 
> >> >> > 
> >> >> > Multiply and marginalize factor: Error During Test 
> >> >> > 
> >> >> >   Got an exception of type ErrorException outside of a @test 
> >> >> > 
> >> >> >   type DataType has no field FactorMargin 
> >> >> > 
> >> >> >in FactorDropMargin(::BN.Factor, ::Array{String,1}) at 
> >> >> > /Users/Corvus/.julia/v0.5/BN/src/FactorOperations.jl:85 
> >> >> > 
> >> >> >in macro expansion; at 
> >> >> > /Users/Corvus/.julia/v0.5/BN/test/runtests.jl:19 
> >> >> > [inlined] 
> >> >> > 
> >> >> >in macro expansion; at ./test.jl:672 [inlined] 
> >> >> > 
> >> >> >in anonymous at ./:? 
> >> >> > 
> >> >> >in include_from_node1(::String) at ./loading.jl:488 
> >> >> > 
> >> >> >in include_from_node1(::String) at 
> >> >> > 
> >> >> > 
> >> >> > 
> /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:? 
> >> >> > 
> >> >> >in process_options(::Base.JLOptions) at ./client.jl:262 
> >> >> > 
> >> >> >in _start() at ./client.jl:318 
> >> >> > 
> >> >> >in _start() at 
> >> >> > 
> >> >> > 
> >> >> > 
> /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:? 
> >> >> > 
> >> >> > Test Summary:   | Error  Total 
> >> >> > 
> >> >> >   Multiply and marginalize factor | 1  1 
> >> >> > 
> >> >> > 
> >> >> > On Wednesday, November 16, 2016 at 10:02:48 PM UTC-2, Yichao Yu 
> >> >> > wrote: 
> >> >> >> 
> >> >> >> On Wed, Nov 16, 2016 at 6:50 PM, Kevin Liu  
> wrote: 
> >> >> >> > From this issue https://github.com/JuliaPy/PyPlot.jl/issues/157 
> I 
> >> >> >> > understand 
> >> >> >> 
> >> >> >> ^^ This is irrelevant unless you are using PyCall 
> >> >> >> 
> >> >> >> > 
> >> >> >> > `Factor[:FactorMargin](A, Remove_var, Remain_var, Remove_dims, 
> >> >> >> > Remain_dims)` 
> >> >> >> > (line 85 of FactorOperations.jl) should pass, as it does on 
> Atom, 
> >> >> >> > but 
> >> >> >> > not on 
> 

Re: [julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-18 Thread Yichao Yu
On Thu, Nov 17, 2016 at 2:39 PM, Kevin Liu  wrote:
> Right, I need the instance of Factor

Then use the instance of Factor.

>
> On Thursday, November 17, 2016 at 5:33:05 PM UTC-2, Yichao Yu wrote:
>>
>> On Thu, Nov 17, 2016 at 2:27 PM, Kevin Liu  wrote:
>> > I replaced Factor[:FactorMargin]() with Factor.FactorMargin() back
>> > again.
>> >
>> > Still, for FactorOperations.jl on Atom, I get {UndefVarError: Factor not
>> > defined} at the end of each block.
>> >
>> > Factor is defined on Factor.jl, and that file evaluates fine.
>>
>> AFAICT the `Factor`is a type so `Factor.FactorMargin` is definitely wrong.
>>
>> >
>> > The main file, BN.jl, includes Factor.jl and FactorOperations.jl and
>> > exports
>> > Factor, and also evaluates fine.
>> >
>> > On Wednesday, November 16, 2016 at 11:25:24 PM UTC-2, Yichao Yu wrote:
>> >>
>> >> On Wed, Nov 16, 2016 at 7:24 PM, Kevin Liu  wrote:
>> >> > Hi Yichao!
>> >>
>> >> In general there's nothing from the code you posted that shows what
>> >> you want to do.
>> >>
>> >> >
>> >> > Here is the function from FactorOperations.jl
>> >> >
>> >> > function FactorDropMargin(A::Factor, Remove_var::Vector{String})
>> >> > Remove_dims = indexin(Remove_var, A.var)
>> >> > if any(Remove_dims==0)
>> >> > error("Wrong variable!")
>> >> > end
>> >> >
>> >> > Remain_var = symdiff(A.var, Remove_var)
>> >> > Remain_dims = indexin(Remain_var, A.var)
>> >> >
>> >> > Factor[:FactorMargin](A, Remove_var, Remain_var, Remove_dims,
>> >> > Remain_dims) # line 85
>> >>
>> >> Unless you overloaded getindex on this type (which you should include)
>> >> you are construction a Vector of `Factor` from a symbol and then
>> >> calling it. It's impossible to tell what you actually want to do.
>> >>
>> >> And as I previously mentioned, unless you are using PyCall, the issue
>> >> you linked is totally unrelated to this.
>> >>
>> >> > end
>> >> >
>> >> > runtests.jl:
>> >> >
>> >> > @testset "Multiply and marginalize factor" begin
>> >> >
>> >> >   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"]) # line 19
>> >> >   FactorKeepMargin(C, ["b", "a"])
>> >> >   FactorPermute(ans, [2, 1])
>> >> >   FactorKeepMargin(C, ["a", "b"])
>> >> >
>> >> > end
>> >> >
>> >> > what I got on the REPL:
>> >> >
>> >> > julia> Pkg.test("BN")
>> >> >
>> >> > INFO: Testing BN
>> >> >
>> >> > Test Summary: |
>> >> >
>> >> >   Define, permute factor, and call (var, card, val) | No tests
>> >> >
>> >> > Multiply and marginalize factor: Error During Test
>> >> >
>> >> >   Got an exception of type ErrorException outside of a @test
>> >> >
>> >> >   type DataType has no field FactorMargin
>> >> >
>> >> >in FactorDropMargin(::BN.Factor, ::Array{String,1}) at
>> >> > /Users/Corvus/.julia/v0.5/BN/src/FactorOperations.jl:85
>> >> >
>> >> >in macro expansion; at
>> >> > /Users/Corvus/.julia/v0.5/BN/test/runtests.jl:19
>> >> > [inlined]
>> >> >
>> >> >in macro expansion; at ./test.jl:672 [inlined]
>> >> >
>> >> >in anonymous at ./:?
>> >> >
>> >> >in include_from_node1(::String) at ./loading.jl:488
>> >> >
>> >> >in include_from_node1(::String) at
>> >> >
>> >> >
>> >> > /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?
>> >> >
>> >> >in process_options(::Base.JLOptions) at ./client.jl:262
>> >> >
>> >> >in _start() at ./client.jl:318
>> >> >
>> >> >in _start() at
>> >> >
>> >> >
>> >> > /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?
>> >> >
>> >> > Test Summary:   | Error  Total
>> >> >
>> >> >   Multiply and marginalize factor | 1  1
>> >> >
>> >> >
>> >> > On Wednesday, November 16, 2016 at 10:02:48 PM UTC-2, Yichao Yu
>> >> > wrote:
>> >> >>
>> >> >> On Wed, Nov 16, 2016 at 6:50 PM, Kevin Liu  wrote:
>> >> >> > From this issue https://github.com/JuliaPy/PyPlot.jl/issues/157 I
>> >> >> > understand
>> >> >>
>> >> >> ^^ This is irrelevant unless you are using PyCall
>> >> >>
>> >> >> >
>> >> >> > `Factor[:FactorMargin](A, Remove_var, Remain_var, Remove_dims,
>> >> >> > Remain_dims)`
>> >> >> > (line 85 of FactorOperations.jl) should pass, as it does on Atom,
>> >> >> > but
>> >> >> > not on
>> >> >> > the REPL, which throws
>> >> >> >
>> >> >> > Got an exception of type ErrorException outside of a @test
>> >> >> >
>> >> >> >   type DataType has no field FactorMargin
>> >> >> >
>> >> >> >in FactorDropMargin(::BN.Factor, ::Array{String,1}) at
>> >> >> > /Users/Corvus/.julia/v0.5/BN/src/FactorOperations.jl:85
>> >> >>
>> >> >> Impossible to tell without code.
>> >> >>
>> >> >> >
>> >> >> >
>> >> >> > Help, please.


Re: [julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-17 Thread David P. Sanders
If you can produce a minimal working example (the *shortest* piece of code that 
produces the problem and that people can run), you will be more likely to get 
help. This probably involves removing a lot of stuff from your code that I'd 
not relevant to this particular problem.  

Re: [julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-17 Thread Kevin Liu
Right, I need the instance of Factor

On Thursday, November 17, 2016 at 5:33:05 PM UTC-2, Yichao Yu wrote:
>
> On Thu, Nov 17, 2016 at 2:27 PM, Kevin Liu  
> wrote: 
> > I replaced Factor[:FactorMargin]() with Factor.FactorMargin() back 
> again. 
> > 
> > Still, for FactorOperations.jl on Atom, I get {UndefVarError: Factor not 
> > defined} at the end of each block. 
> > 
> > Factor is defined on Factor.jl, and that file evaluates fine. 
>
> AFAICT the `Factor`is a type so `Factor.FactorMargin` is definitely wrong. 
>
> > 
> > The main file, BN.jl, includes Factor.jl and FactorOperations.jl and 
> exports 
> > Factor, and also evaluates fine. 
> > 
> > On Wednesday, November 16, 2016 at 11:25:24 PM UTC-2, Yichao Yu wrote: 
> >> 
> >> On Wed, Nov 16, 2016 at 7:24 PM, Kevin Liu  wrote: 
> >> > Hi Yichao! 
> >> 
> >> In general there's nothing from the code you posted that shows what 
> >> you want to do. 
> >> 
> >> > 
> >> > Here is the function from FactorOperations.jl 
> >> > 
> >> > function FactorDropMargin(A::Factor, Remove_var::Vector{String}) 
> >> > Remove_dims = indexin(Remove_var, A.var) 
> >> > if any(Remove_dims==0) 
> >> > error("Wrong variable!") 
> >> > end 
> >> > 
> >> > Remain_var = symdiff(A.var, Remove_var) 
> >> > Remain_dims = indexin(Remain_var, A.var) 
> >> > 
> >> > Factor[:FactorMargin](A, Remove_var, Remain_var, Remove_dims, 
> >> > Remain_dims) # line 85 
> >> 
> >> Unless you overloaded getindex on this type (which you should include) 
> >> you are construction a Vector of `Factor` from a symbol and then 
> >> calling it. It's impossible to tell what you actually want to do. 
> >> 
> >> And as I previously mentioned, unless you are using PyCall, the issue 
> >> you linked is totally unrelated to this. 
> >> 
> >> > end 
> >> > 
> >> > runtests.jl: 
> >> > 
> >> > @testset "Multiply and marginalize factor" begin 
> >> > 
> >> >   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"]) # line 19 
> >> >   FactorKeepMargin(C, ["b", "a"]) 
> >> >   FactorPermute(ans, [2, 1]) 
> >> >   FactorKeepMargin(C, ["a", "b"]) 
> >> > 
> >> > end 
> >> > 
> >> > what I got on the REPL: 
> >> > 
> >> > julia> Pkg.test("BN") 
> >> > 
> >> > INFO: Testing BN 
> >> > 
> >> > Test Summary: | 
> >> > 
> >> >   Define, permute factor, and call (var, card, val) | No tests 
> >> > 
> >> > Multiply and marginalize factor: Error During Test 
> >> > 
> >> >   Got an exception of type ErrorException outside of a @test 
> >> > 
> >> >   type DataType has no field FactorMargin 
> >> > 
> >> >in FactorDropMargin(::BN.Factor, ::Array{String,1}) at 
> >> > /Users/Corvus/.julia/v0.5/BN/src/FactorOperations.jl:85 
> >> > 
> >> >in macro expansion; at 
> >> > /Users/Corvus/.julia/v0.5/BN/test/runtests.jl:19 
> >> > [inlined] 
> >> > 
> >> >in macro expansion; at ./test.jl:672 [inlined] 
> >> > 
> >> >in anonymous at ./:? 
> >> > 
> >> >in include_from_node1(::String) at ./loading.jl:488 
> >> > 
> >> >in include_from_node1(::String) at 
> >> > 
> >> > 
> /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:? 
> >> > 
> >> >in process_options(::Base.JLOptions) at ./client.jl:262 
> >> > 
> >> >in _start() at ./client.jl:318 
> >> > 
> >> >in _start() at 
> >> > 
> >> > 
> /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:? 
> >> > 
> >> > Test Summary:   | Error  Total 
> >> > 
> >> >   Multiply and marginalize factor | 1  1 
> >> > 
> >> > 
> >> > On Wednesday, November 16, 2016 at 10:02:48 PM UTC-2, Yichao Yu 
> wrote: 
> >> >> 
> >> >> On Wed, Nov 16, 2016 at 6:50 PM, Kevin Liu  
> wrote: 
> >> >> > From this issue https://github.com/JuliaPy/PyPlot.jl/issues/157 I 
> >> >> > understand 
> >> >> 
> >> >> ^^ This is irrelevant unless you are using PyCall 
> >> >> 
> >> >> > 
> >> >> > `Factor[:FactorMargin](A, Remove_var, Remain_var, Remove_dims, 
> >> >> > Remain_dims)` 
> >> >> > (line 85 of FactorOperations.jl) should pass, as it does on Atom, 
> but 
> >> >> > not on 
> >> >> > the REPL, which throws 
> >> >> > 
> >> >> > Got an exception of type ErrorException outside of a @test 
> >> >> > 
> >> >> >   type DataType has no field FactorMargin 
> >> >> > 
> >> >> >in FactorDropMargin(::BN.Factor, ::Array{String,1}) at 
> >> >> > /Users/Corvus/.julia/v0.5/BN/src/FactorOperations.jl:85 
> >> >> 
> >> >> Impossible to tell without code. 
> >> >> 
> >> >> > 
> >> >> > 
> >> >> > Help, please. 
>


Re: [julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-17 Thread Yichao Yu
On Thu, Nov 17, 2016 at 2:27 PM, Kevin Liu  wrote:
> I replaced Factor[:FactorMargin]() with Factor.FactorMargin() back again.
>
> Still, for FactorOperations.jl on Atom, I get {UndefVarError: Factor not
> defined} at the end of each block.
>
> Factor is defined on Factor.jl, and that file evaluates fine.

AFAICT the `Factor`is a type so `Factor.FactorMargin` is definitely wrong.

>
> The main file, BN.jl, includes Factor.jl and FactorOperations.jl and exports
> Factor, and also evaluates fine.
>
> On Wednesday, November 16, 2016 at 11:25:24 PM UTC-2, Yichao Yu wrote:
>>
>> On Wed, Nov 16, 2016 at 7:24 PM, Kevin Liu  wrote:
>> > Hi Yichao!
>>
>> In general there's nothing from the code you posted that shows what
>> you want to do.
>>
>> >
>> > Here is the function from FactorOperations.jl
>> >
>> > function FactorDropMargin(A::Factor, Remove_var::Vector{String})
>> > Remove_dims = indexin(Remove_var, A.var)
>> > if any(Remove_dims==0)
>> > error("Wrong variable!")
>> > end
>> >
>> > Remain_var = symdiff(A.var, Remove_var)
>> > Remain_dims = indexin(Remain_var, A.var)
>> >
>> > Factor[:FactorMargin](A, Remove_var, Remain_var, Remove_dims,
>> > Remain_dims) # line 85
>>
>> Unless you overloaded getindex on this type (which you should include)
>> you are construction a Vector of `Factor` from a symbol and then
>> calling it. It's impossible to tell what you actually want to do.
>>
>> And as I previously mentioned, unless you are using PyCall, the issue
>> you linked is totally unrelated to this.
>>
>> > end
>> >
>> > runtests.jl:
>> >
>> > @testset "Multiply and marginalize factor" begin
>> >
>> >   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"]) # line 19
>> >   FactorKeepMargin(C, ["b", "a"])
>> >   FactorPermute(ans, [2, 1])
>> >   FactorKeepMargin(C, ["a", "b"])
>> >
>> > end
>> >
>> > what I got on the REPL:
>> >
>> > julia> Pkg.test("BN")
>> >
>> > INFO: Testing BN
>> >
>> > Test Summary: |
>> >
>> >   Define, permute factor, and call (var, card, val) | No tests
>> >
>> > Multiply and marginalize factor: Error During Test
>> >
>> >   Got an exception of type ErrorException outside of a @test
>> >
>> >   type DataType has no field FactorMargin
>> >
>> >in FactorDropMargin(::BN.Factor, ::Array{String,1}) at
>> > /Users/Corvus/.julia/v0.5/BN/src/FactorOperations.jl:85
>> >
>> >in macro expansion; at
>> > /Users/Corvus/.julia/v0.5/BN/test/runtests.jl:19
>> > [inlined]
>> >
>> >in macro expansion; at ./test.jl:672 [inlined]
>> >
>> >in anonymous at ./:?
>> >
>> >in include_from_node1(::String) at ./loading.jl:488
>> >
>> >in include_from_node1(::String) at
>> >
>> > /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?
>> >
>> >in process_options(::Base.JLOptions) at ./client.jl:262
>> >
>> >in _start() at ./client.jl:318
>> >
>> >in _start() at
>> >
>> > /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?
>> >
>> > Test Summary:   | Error  Total
>> >
>> >   Multiply and marginalize factor | 1  1
>> >
>> >
>> > On Wednesday, November 16, 2016 at 10:02:48 PM UTC-2, Yichao Yu wrote:
>> >>
>> >> On Wed, Nov 16, 2016 at 6:50 PM, Kevin Liu  wrote:
>> >> > From this issue https://github.com/JuliaPy/PyPlot.jl/issues/157 I
>> >> > understand
>> >>
>> >> ^^ This is irrelevant unless you are using PyCall
>> >>
>> >> >
>> >> > `Factor[:FactorMargin](A, Remove_var, Remain_var, Remove_dims,
>> >> > Remain_dims)`
>> >> > (line 85 of FactorOperations.jl) should pass, as it does on Atom, but
>> >> > not on
>> >> > the REPL, which throws
>> >> >
>> >> > Got an exception of type ErrorException outside of a @test
>> >> >
>> >> >   type DataType has no field FactorMargin
>> >> >
>> >> >in FactorDropMargin(::BN.Factor, ::Array{String,1}) at
>> >> > /Users/Corvus/.julia/v0.5/BN/src/FactorOperations.jl:85
>> >>
>> >> Impossible to tell without code.
>> >>
>> >> >
>> >> >
>> >> > Help, please.


Re: [julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-17 Thread Kevin Liu
{Factor.FactorMargin()} simply marginalizes non-stated variables in Factor.

On Thursday, November 17, 2016 at 5:27:38 PM UTC-2, Kevin Liu wrote:
>
> I replaced Factor[:FactorMargin]() with Factor.FactorMargin() back again. 
>
> Still, for FactorOperations.jl on Atom, I get {UndefVarError: Factor not 
> defined} at the end of each block. 
>
> Factor is defined on Factor.jl, and that file evaluates fine. 
>
> The main file, BN.jl, includes Factor.jl and FactorOperations.jl and 
> exports Factor, and also evaluates fine. 
>
> On Wednesday, November 16, 2016 at 11:25:24 PM UTC-2, Yichao Yu wrote:
>>
>> On Wed, Nov 16, 2016 at 7:24 PM, Kevin Liu  wrote: 
>> > Hi Yichao! 
>>
>> In general there's nothing from the code you posted that shows what 
>> you want to do. 
>>
>> > 
>> > Here is the function from FactorOperations.jl 
>> > 
>> > function FactorDropMargin(A::Factor, Remove_var::Vector{String}) 
>> > Remove_dims = indexin(Remove_var, A.var) 
>> > if any(Remove_dims==0) 
>> > error("Wrong variable!") 
>> > end 
>> > 
>> > Remain_var = symdiff(A.var, Remove_var) 
>> > Remain_dims = indexin(Remain_var, A.var) 
>> > 
>> > Factor[:FactorMargin](A, Remove_var, Remain_var, Remove_dims, 
>> > Remain_dims) # line 85 
>>
>> Unless you overloaded getindex on this type (which you should include) 
>> you are construction a Vector of `Factor` from a symbol and then 
>> calling it. It's impossible to tell what you actually want to do. 
>>
>> And as I previously mentioned, unless you are using PyCall, the issue 
>> you linked is totally unrelated to this. 
>>
>> > end 
>> > 
>> > runtests.jl: 
>> > 
>> > @testset "Multiply and marginalize factor" begin 
>> > 
>> >   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"]) # line 19 
>> >   FactorKeepMargin(C, ["b", "a"]) 
>> >   FactorPermute(ans, [2, 1]) 
>> >   FactorKeepMargin(C, ["a", "b"]) 
>> > 
>> > end 
>> > 
>> > what I got on the REPL: 
>> > 
>> > julia> Pkg.test("BN") 
>> > 
>> > INFO: Testing BN 
>> > 
>> > Test Summary: | 
>> > 
>> >   Define, permute factor, and call (var, card, val) | No tests 
>> > 
>> > Multiply and marginalize factor: Error During Test 
>> > 
>> >   Got an exception of type ErrorException outside of a @test 
>> > 
>> >   type DataType has no field FactorMargin 
>> > 
>> >in FactorDropMargin(::BN.Factor, ::Array{String,1}) at 
>> > /Users/Corvus/.julia/v0.5/BN/src/FactorOperations.jl:85 
>> > 
>> >in macro expansion; at 
>> /Users/Corvus/.julia/v0.5/BN/test/runtests.jl:19 
>> > [inlined] 
>> > 
>> >in macro expansion; at ./test.jl:672 [inlined] 
>> > 
>> >in anonymous at ./:? 
>> > 
>> >in include_from_node1(::String) at ./loading.jl:488 
>> > 
>> >in include_from_node1(::String) at 
>> > 
>> /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:? 
>> > 
>> >in process_options(::Base.JLOptions) at ./client.jl:262 
>> > 
>> >in _start() at ./client.jl:318 
>> > 
>> >in _start() at 
>> > 
>> /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:? 
>> > 
>> > Test Summary:   | Error  Total 
>> > 
>> >   Multiply and marginalize factor | 1  1 
>> > 
>> > 
>> > On Wednesday, November 16, 2016 at 10:02:48 PM UTC-2, Yichao Yu wrote: 
>> >> 
>> >> On Wed, Nov 16, 2016 at 6:50 PM, Kevin Liu  wrote: 
>> >> > From this issue https://github.com/JuliaPy/PyPlot.jl/issues/157 I 
>> >> > understand 
>> >> 
>> >> ^^ This is irrelevant unless you are using PyCall 
>> >> 
>> >> > 
>> >> > `Factor[:FactorMargin](A, Remove_var, Remain_var, Remove_dims, 
>> >> > Remain_dims)` 
>> >> > (line 85 of FactorOperations.jl) should pass, as it does on Atom, 
>> but 
>> >> > not on 
>> >> > the REPL, which throws 
>> >> > 
>> >> > Got an exception of type ErrorException outside of a @test 
>> >> > 
>> >> >   type DataType has no field FactorMargin 
>> >> > 
>> >> >in FactorDropMargin(::BN.Factor, ::Array{String,1}) at 
>> >> > /Users/Corvus/.julia/v0.5/BN/src/FactorOperations.jl:85 
>> >> 
>> >> Impossible to tell without code. 
>> >> 
>> >> > 
>> >> > 
>> >> > Help, please. 
>>
>

Re: [julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-17 Thread Kevin Liu
I replaced Factor[:FactorMargin]() with Factor.FactorMargin() back again. 

Still, for FactorOperations.jl on Atom, I get {UndefVarError: Factor not 
defined} at the end of each block. 

Factor is defined on Factor.jl, and that file evaluates fine. 

The main file, BN.jl, includes Factor.jl and FactorOperations.jl and 
exports Factor, and also evaluates fine. 

On Wednesday, November 16, 2016 at 11:25:24 PM UTC-2, Yichao Yu wrote:
>
> On Wed, Nov 16, 2016 at 7:24 PM, Kevin Liu  
> wrote: 
> > Hi Yichao! 
>
> In general there's nothing from the code you posted that shows what 
> you want to do. 
>
> > 
> > Here is the function from FactorOperations.jl 
> > 
> > function FactorDropMargin(A::Factor, Remove_var::Vector{String}) 
> > Remove_dims = indexin(Remove_var, A.var) 
> > if any(Remove_dims==0) 
> > error("Wrong variable!") 
> > end 
> > 
> > Remain_var = symdiff(A.var, Remove_var) 
> > Remain_dims = indexin(Remain_var, A.var) 
> > 
> > Factor[:FactorMargin](A, Remove_var, Remain_var, Remove_dims, 
> > Remain_dims) # line 85 
>
> Unless you overloaded getindex on this type (which you should include) 
> you are construction a Vector of `Factor` from a symbol and then 
> calling it. It's impossible to tell what you actually want to do. 
>
> And as I previously mentioned, unless you are using PyCall, the issue 
> you linked is totally unrelated to this. 
>
> > end 
> > 
> > runtests.jl: 
> > 
> > @testset "Multiply and marginalize factor" begin 
> > 
> >   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"]) # line 19 
> >   FactorKeepMargin(C, ["b", "a"]) 
> >   FactorPermute(ans, [2, 1]) 
> >   FactorKeepMargin(C, ["a", "b"]) 
> > 
> > end 
> > 
> > what I got on the REPL: 
> > 
> > julia> Pkg.test("BN") 
> > 
> > INFO: Testing BN 
> > 
> > Test Summary: | 
> > 
> >   Define, permute factor, and call (var, card, val) | No tests 
> > 
> > Multiply and marginalize factor: Error During Test 
> > 
> >   Got an exception of type ErrorException outside of a @test 
> > 
> >   type DataType has no field FactorMargin 
> > 
> >in FactorDropMargin(::BN.Factor, ::Array{String,1}) at 
> > /Users/Corvus/.julia/v0.5/BN/src/FactorOperations.jl:85 
> > 
> >in macro expansion; at 
> /Users/Corvus/.julia/v0.5/BN/test/runtests.jl:19 
> > [inlined] 
> > 
> >in macro expansion; at ./test.jl:672 [inlined] 
> > 
> >in anonymous at ./:? 
> > 
> >in include_from_node1(::String) at ./loading.jl:488 
> > 
> >in include_from_node1(::String) at 
> > 
> /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:? 
> > 
> >in process_options(::Base.JLOptions) at ./client.jl:262 
> > 
> >in _start() at ./client.jl:318 
> > 
> >in _start() at 
> > 
> /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:? 
> > 
> > Test Summary:   | Error  Total 
> > 
> >   Multiply and marginalize factor | 1  1 
> > 
> > 
> > On Wednesday, November 16, 2016 at 10:02:48 PM UTC-2, Yichao Yu wrote: 
> >> 
> >> On Wed, Nov 16, 2016 at 6:50 PM, Kevin Liu  wrote: 
> >> > From this issue https://github.com/JuliaPy/PyPlot.jl/issues/157 I 
> >> > understand 
> >> 
> >> ^^ This is irrelevant unless you are using PyCall 
> >> 
> >> > 
> >> > `Factor[:FactorMargin](A, Remove_var, Remain_var, Remove_dims, 
> >> > Remain_dims)` 
> >> > (line 85 of FactorOperations.jl) should pass, as it does on Atom, but 
> >> > not on 
> >> > the REPL, which throws 
> >> > 
> >> > Got an exception of type ErrorException outside of a @test 
> >> > 
> >> >   type DataType has no field FactorMargin 
> >> > 
> >> >in FactorDropMargin(::BN.Factor, ::Array{String,1}) at 
> >> > /Users/Corvus/.julia/v0.5/BN/src/FactorOperations.jl:85 
> >> 
> >> Impossible to tell without code. 
> >> 
> >> > 
> >> > 
> >> > Help, please. 
>


Re: [julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-16 Thread Yichao Yu
On Wed, Nov 16, 2016 at 7:24 PM, Kevin Liu  wrote:
> Hi Yichao!

In general there's nothing from the code you posted that shows what
you want to do.

>
> Here is the function from FactorOperations.jl
>
> function FactorDropMargin(A::Factor, Remove_var::Vector{String})
> Remove_dims = indexin(Remove_var, A.var)
> if any(Remove_dims==0)
> error("Wrong variable!")
> end
>
> Remain_var = symdiff(A.var, Remove_var)
> Remain_dims = indexin(Remain_var, A.var)
>
> Factor[:FactorMargin](A, Remove_var, Remain_var, Remove_dims,
> Remain_dims) # line 85

Unless you overloaded getindex on this type (which you should include)
you are construction a Vector of `Factor` from a symbol and then
calling it. It's impossible to tell what you actually want to do.

And as I previously mentioned, unless you are using PyCall, the issue
you linked is totally unrelated to this.

> end
>
> runtests.jl:
>
> @testset "Multiply and marginalize factor" begin
>
>   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"]) # line 19
>   FactorKeepMargin(C, ["b", "a"])
>   FactorPermute(ans, [2, 1])
>   FactorKeepMargin(C, ["a", "b"])
>
> end
>
> what I got on the REPL:
>
> julia> Pkg.test("BN")
>
> INFO: Testing BN
>
> Test Summary: |
>
>   Define, permute factor, and call (var, card, val) | No tests
>
> Multiply and marginalize factor: Error During Test
>
>   Got an exception of type ErrorException outside of a @test
>
>   type DataType has no field FactorMargin
>
>in FactorDropMargin(::BN.Factor, ::Array{String,1}) at
> /Users/Corvus/.julia/v0.5/BN/src/FactorOperations.jl:85
>
>in macro expansion; at /Users/Corvus/.julia/v0.5/BN/test/runtests.jl:19
> [inlined]
>
>in macro expansion; at ./test.jl:672 [inlined]
>
>in anonymous at ./:?
>
>in include_from_node1(::String) at ./loading.jl:488
>
>in include_from_node1(::String) at
> /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?
>
>in process_options(::Base.JLOptions) at ./client.jl:262
>
>in _start() at ./client.jl:318
>
>in _start() at
> /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?
>
> Test Summary:   | Error  Total
>
>   Multiply and marginalize factor | 1  1
>
>
> On Wednesday, November 16, 2016 at 10:02:48 PM UTC-2, Yichao Yu wrote:
>>
>> On Wed, Nov 16, 2016 at 6:50 PM, Kevin Liu  wrote:
>> > From this issue https://github.com/JuliaPy/PyPlot.jl/issues/157 I
>> > understand
>>
>> ^^ This is irrelevant unless you are using PyCall
>>
>> >
>> > `Factor[:FactorMargin](A, Remove_var, Remain_var, Remove_dims,
>> > Remain_dims)`
>> > (line 85 of FactorOperations.jl) should pass, as it does on Atom, but
>> > not on
>> > the REPL, which throws
>> >
>> > Got an exception of type ErrorException outside of a @test
>> >
>> >   type DataType has no field FactorMargin
>> >
>> >in FactorDropMargin(::BN.Factor, ::Array{String,1}) at
>> > /Users/Corvus/.julia/v0.5/BN/src/FactorOperations.jl:85
>>
>> Impossible to tell without code.
>>
>> >
>> >
>> > Help, please.


Re: [julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-16 Thread Kevin Liu
Hi Yichao!

Here is the function from FactorOperations.jl

function FactorDropMargin(A::Factor, Remove_var::Vector{String})
Remove_dims = indexin(Remove_var, A.var)
if any(Remove_dims==0)
error("Wrong variable!")
end

Remain_var = symdiff(A.var, Remove_var)
Remain_dims = indexin(Remain_var, A.var)

Factor[:FactorMargin](A, Remove_var, Remain_var, Remove_dims, 
Remain_dims) # line 85
end

runtests.jl:

@testset "Multiply and marginalize factor" begin

  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"]) # line 19
  FactorKeepMargin(C, ["b", "a"])
  FactorPermute(ans, [2, 1])
  FactorKeepMargin(C, ["a", "b"])

end

what I got on the REPL:

*julia> **Pkg.test("BN")*

*INFO: Testing BN*

*Test Summary: | *

  Define, permute factor, and call (var, card, val) | *No tests*

*Multiply and marginalize factor: **Error During Test*

  Got an exception of type ErrorException outside of a @test

  type DataType has no field FactorMargin

   in FactorDropMargin(::BN.Factor, ::Array{String,1}) at 
/Users/Corvus/.julia/v0.5/BN/src/FactorOperations.jl:85

   in macro expansion; at /Users/Corvus/.julia/v0.5/BN/test/runtests.jl:19 
[inlined]

   in macro expansion; at ./test.jl:672 [inlined]

   in anonymous at ./:?

   in include_from_node1(::String) at ./loading.jl:488

   in include_from_node1(::String) at 
/Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?

   in process_options(::Base.JLOptions) at ./client.jl:262

   in _start() at ./client.jl:318

   in _start() at 
/Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?

*Test Summary:   | **Error  **Total*

  Multiply and marginalize factor | *1  **1*

On Wednesday, November 16, 2016 at 10:02:48 PM UTC-2, Yichao Yu wrote:
>
> On Wed, Nov 16, 2016 at 6:50 PM, Kevin Liu  
> wrote: 
> > From this issue https://github.com/JuliaPy/PyPlot.jl/issues/157 I 
> understand 
>
> ^^ This is irrelevant unless you are using PyCall 
>
> > 
> > `Factor[:FactorMargin](A, Remove_var, Remain_var, Remove_dims, 
> Remain_dims)` 
> > (line 85 of FactorOperations.jl) should pass, as it does on Atom, but 
> not on 
> > the REPL, which throws 
> > 
> > Got an exception of type ErrorException outside of a @test 
> > 
> >   type DataType has no field FactorMargin 
> > 
> >in FactorDropMargin(::BN.Factor, ::Array{String,1}) at 
> > /Users/Corvus/.julia/v0.5/BN/src/FactorOperations.jl:85 
>
> Impossible to tell without code. 
>
> > 
> > 
> > Help, please. 
>


Re: [julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-16 Thread Yichao Yu
On Wed, Nov 16, 2016 at 6:50 PM, Kevin Liu  wrote:
> From this issue https://github.com/JuliaPy/PyPlot.jl/issues/157 I understand

^^ This is irrelevant unless you are using PyCall

>
> `Factor[:FactorMargin](A, Remove_var, Remain_var, Remove_dims, Remain_dims)`
> (line 85 of FactorOperations.jl) should pass, as it does on Atom, but not on
> the REPL, which throws
>
> Got an exception of type ErrorException outside of a @test
>
>   type DataType has no field FactorMargin
>
>in FactorDropMargin(::BN.Factor, ::Array{String,1}) at
> /Users/Corvus/.julia/v0.5/BN/src/FactorOperations.jl:85

Impossible to tell without code.

>
>
> Help, please.


[julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-16 Thread Kevin Liu
>From this issue https://github.com/JuliaPy/PyPlot.jl/issues/157 I 
understand 

`Factor[:FactorMargin](A, Remove_var, Remain_var, Remove_dims, 
Remain_dims)` (line 85 of FactorOperations.jl) should pass, as it does on 
Atom, but not on the REPL, which throws

Got an exception of type ErrorException outside of a @test

  type DataType has no field FactorMargin

   in FactorDropMargin(::BN.Factor, ::Array{String,1}) at 
/Users/Corvus/.julia/v0.5/BN/src/FactorOperations.jl:85


Help, please.