In norm, if you change the -"1 and %"1 to -"_1 _ and %"_1 _
then the function would work on an argument of any rank.
Also, the [ can be elided.  Thus:

norm1=: (-"_1 _ mean) %"_1 _ %:@:variance



----- Original Message -----
From: Raul Miller <[EMAIL PROTECTED]>
Date: Tuesday, September 4, 2007 17:40
Subject: Re: [Jgeneral] normalize data
To: General forum <[email protected]>

> On 9/4/07, Roelof Brouwer <[EMAIL PROTECTED]> wrote:
>    mean=:+/%#
>    variance=: (mean@:*:)-(*:@ mean)
>    normalize_data=: ([-mean)%(%:@: variance)
>    norm_data=: normalize_data"1&.|:
>    norm=: ([- " 1 mean)%"1 %:@: variance
> 
> ...
> 
> With the above definitions (which include a couple names supplied
> by me), the following holds:
> 
>    (norm -: norm_data) ?3 3$0
> 1
> 
> So... what was the question?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to