[Haskell-beginners] 2D rectanlge array type

Nathan Hüsken nathan.huesken at posteo.de
Thu Sep 12 18:28:07 CEST 2013


Hey,

I am experimenting with machine learning in haskell. For training a 
model, I need to input a list of features. A features itself is a set of 
floating point numbers. So my training data has the type:

     [Feature]

What I am wondering is which type I should use for Feature. As I said, 
it is a set of floats. But every feature must have exactly the same 
number of floats. I could use

type Feature = [Float]

but that would not ensure that every feature has the same number of 
flaots. I could use tuples

type Feature = (Float,Float,Float,Float,Float ...)

The number of features varies from application to application. And I do 
not know how to encode that with tuples. Also the number of features can 
get very big (in extreme cases up to ~1000, in normal cases ~100).

How would you do that?

Thanks!
Nathan





More information about the Beginners mailing list