groovy - Get all elements at index in 2d array -


i writing ml algorithm have list of tuples so:

[ [17582.0, 6.382129, 0.876581], [9868.0, 2.694977, 0.432818], [18333.0, 3.951256, 0.3333] ...]   

so, index=0 refer specific value feature. normalize, need min , max of every feature.

is there short hand way elements @ index = 0 or index = 1, , on of tuples?

assuming values in variable list

then can do:

def firstelements = list*.head() 

if need specific position, can do:

def secondelements = list*.getat(1) 

to column-wise min , max, transpose list, calculation:

def cwminmax = list.transpose().collect { [it.min(), it.max()] } 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -