
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

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Hi Nathan, It is actually possible (and pretty easy) to encode natural numbers as types [1]. You could create a sequence type which is parameterized over both the element type and the number of contained elements. Nick [1] http://www.haskell.org/haskellwiki/Type_arithmetic On 09/12/2013 10:28 AM, Nathan Hüsken wrote:
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
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iF4EAREIAAYFAlIyEVMACgkQJlmDAU/j7BAI1AEAqLQLSyMYwJfzWK5LoNlv5OFK EYI5cxR8sZU3upZQYoQA/3Tk8iNW3a68RiDxF1nSfgo/ENhjfqTbxhFSo5M46y49 =wUuu -----END PGP SIGNATURE-----

Hey, Thanks for the tips. But when the lists get really long, this methods seems to be very cumbersome, or am I misssing something? Regards, Nathan Am 9/12/2013 9:09 PM, schrieb Nick Vanderweit:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
Hi Nathan,
It is actually possible (and pretty easy) to encode natural numbers as types [1]. You could create a sequence type which is parameterized over both the element type and the number of contained elements.
Nick
[1] http://www.haskell.org/haskellwiki/Type_arithmetic
On 09/12/2013 10:28 AM, Nathan Hüsken wrote:
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
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iF4EAREIAAYFAlIyEVMACgkQJlmDAU/j7BAI1AEAqLQLSyMYwJfzWK5LoNlv5OFK EYI5cxR8sZU3upZQYoQA/3Tk8iNW3a68RiDxF1nSfgo/ENhjfqTbxhFSo5M46y49 =wUuu -----END PGP SIGNATURE-----

I would probably use repa for this sort of application. http://hackage.haskell.org/package/repa On Thursday, September 12, 2013, Nathan Hüsken wrote:
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
______________________________**_________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/**mailman/listinfo/beginnershttp://www.haskell.org/mailman/listinfo/beginners
participants (3)
-
Bob Ippolito
-
Nathan Hüsken
-
Nick Vanderweit