Re: ask for help on list operation
- To: mathgroup at smc.vnet.net
- Subject: [mg44061] Re: [mg44036] ask for help on list operation
- From: "Peter Pein" <nospam at spam.no>
- Date: Sun, 19 Oct 2003 02:00:20 -0400 (EDT)
- References: <200310180712.DAA28088@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi Sabrina,
if I understand you correctly, you want to normalize each column separately?
Thread[(#1-#2)/(#3-#2)&[Transpose[A],minlist,maxlist]], or - if you want to
avoid calculating {min|max}list:
With[{B=Transpose[A]},
Thread[(#1-#2)/(#3-#2)&[B,Sequence@@Transpose[{Min[#],Max[#]}& /@ B]]]]
But if you want to normalize the whole matrix at once, type
(#1-#2)/(#3-#2)&[A,Min[A],Max[A]]
Peter Pein, Berlin
petsie at arcAND.de
replace && by || to write to me
----- Original Message -----
From: "sabrina" <newbie at newbie.com>
To: mathgroup at smc.vnet.net
Subject: [mg44061] [mg44036] ask for help on list operation
> Hello, all:
> I need some suggestions on the scaling of list:
> I have a set of 2 level list A:
> -0.07839 0.027997 -0.07962 0.009307 0.116985 0.971994 0.898549
> 1.038538
> -0.04786 0.012652 -0.07927 0.009344 0.086011 0.981513 0.858625
1.0432
> -0.02895 0.006401 -0.07636 0.009381 0.067194 0.986076 0.819673
> 1.047881
> -0.01743 0.003326 -0.07294 0.009418 0.055841 0.988423 0.782341
> 1.052581
> -0.01074 0.01575 -0.06966 0.005007 0.049008 0.995316 0.746731
0.528657
> -0.00641 0.000256 -0.06627 0.00503 0.044812 0.995626 0.712755
0.531166
> -0.00382 2.89E-06 -0.06304 0.005052 0.04231 0.995686 0.680436
0.533686
> -0.00227 -0.00016 -0.05996 0.005075 0.04082 0.995643 0.649692
0.536218
> -0.00135 -0.00027 -0.05704 0.005097 0.039933 0.995534 0.620447
> 0.538761
> -0.0008 -0.00035 -0.05426 0.00512 0.039406 0.995378 0.592629
0.541315
>
>
> each sublist has 8 elements.
> Now I need to find the maxima and minima for each column ( as above). I
use
> the following code:
> minlist=Apply[Min, Transpose[A],1];
> maxlist=Apply[Max,Transpose[A],2];
>
> Now I want to use x'=(x-xmin)/(max-min) for each entry in the above matrix
> How can I implement it in a list or matrix? Thanks
>
> Sabrina
>
>
- References:
- ask for help on list operation
- From: sabrina <newbie@newbie.com>
- ask for help on list operation