[Jprogramming] statistical induction
Bo Jacoby
bojacoby at yahoo.dk
Wed Oct 5 04:53:32 HKT 2011
Thanks for your comments!
Raul, you asked for intermediate results?
The intermediate results for the induction example
10 deduc 50 30 20
5 3 2
1.50756 1.3817 1.20605
are
10 (+/@]) 50 30 20
100
10 (,: , 1:) 50 30 20
10 10 10
50 30 20
1 1 1
c
(,: , 1:) % +/@]
10 c 50 30 20
0.1 0.1 0.1
0.5 0.3 0.2
0.01 0.01 0.01
b
,: (%:@* -.)
10 b at c 50 30 20
0.1 0.1 0.1
0.5 0.3 0.2
0.01 0.01 0.01
0.3 0.3 0.3
0.5 0.458258 0.4
0.0994987 0.0994987 0.0994987
a
*`%`:3"2
10 a at b@c 50 30 20
5 3 2
1.50756 1.3817 1.20605
The intermediate results for the induction example
5 3 2 induc 100
46.5385 30.6923 22.7692
12.8279 11.8764 10.8416
are
T
-@(+ #)
5 3 2 T 100
_6 _4 _3
5 3 2 T~ 100
_103
_103 deduc _6 _4 _3
_47.5385 _31.6923 _23.7692
12.8279 11.8764 10.8416
5 3 2 (T~ deduc T) 100
_47.5385 _31.6923 _23.7692
12.8279 11.8764 10.8416
5 3 2 }:@(T~ deduc T) 100
_47.5385 _31.6923 _23.7692
5 3 2 T@}:@(T~ deduc T) 100
46.5385 30.6923 22.7692
5 3 2 (T@}: , }.)@(T~ deduc T) 100
46.5385 30.6923 22.7692
12.8279 11.8764 10.8416
-Bo
>________________________________
>Fra: Björn Helgason <gosinn at gmail.com>
>Til: Programming forum <programming at jsoftware.com>
>Sendt: 16:54 tirsdag den 4. oktober 2011
>Emne: Re: [Jprogramming] statistical induction
>
>I try to use =. when I can so I do not forget to make names local.
>
>In a script while testing before putting the line into a verb it is easy to
>send either one line at a time with ctrl+r or several lines with ctrl+e
>
>These kinds of names I do not want to have as globals in a system.
>
>2011/10/4 Raul Miller <rauldmiller at gmail.com>
>
>> On Tue, Oct 4, 2011 at 4:52 AM, Bo Jacoby <bojacoby at yahoo.dk> wrote:
>> > Verbs for deduction and induction are defined like this.
>> >
>> > a =. *`%`:3"2
>> > b =. ,: (%:@* -.)
>> > c =. (,: , 1:) % +/@]
>> > deduc =. a at b@c f.
>> > T =. -@(+ #)
>> > induc =. (T@}: , }.)@(T~ deduc T) f.
>>
>> This looks fun.
>>
>> I do have some cosmetic suggestions.
>>
>> First, I prefer =: over =. for definitions that I am going to use,
>> because =. definitions in a script I load from file vanish before I
>> can use them.
>>
>> Second, I would probably use / instead of `:3 -- I know that J will
>> convert gerund/ to gerund`:3 but / is still more concise (and, for me,
>> saves a round trip to the vocabulary page -- but that might not be the
>> case for someone else).
>>
>> Also, it's interesting (and educational) to try to put names to each
>> of the intermediate results that arise in this kind of computation.
>>
>> --
>> Raul
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
>
>
>--
>Björn Helgason, Verkfræðingur
>Fornustekkum II
>781 Hornafirði,
>t-póst: gosinn at gmail.com
>gsm: +3546985532
>twitter: @flugfiskur
>http://groups.google.com/group/J-Programming
>
>
>Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans
>
>góður kennari getur stigið á tær án þess að glansinn fari af skónum
> /|_ .-----------------------------------.
> ,' .\ / | Með léttri lund verður |
> ,--' _,' | Dagurinn í dag |
> / / | Enn betri en gærdagurinn |
> ( -. | `-----------------------------------'
> | ) | (\_ _/)
> (`-. '--.) (='.'=) ♖♘♗♕♔♙
> `. )----' (")_(") ☃☠
>----------------------------------------------------------------------
>For information about J forums see http://www.jsoftware.com/forums.htm
>
>
More information about the Programming
mailing list