Discussion:
[elm-discuss] The NumPy for Elm
Francisco Ramos
2017-10-31 12:32:06 UTC
Permalink
Today I'm releasing NumElm, another small contribution to the Open Source,
Frontend and Elm community. NumElm is inspired by NumPy, the fundamental
package for scientific computing with Python. NumElm is the first step in
this ambitious idea of mine of building a Machine Learning package for Elm.
Still a long way to go, but I'm full of enthusiasm. I'm convinced about the
potential of both worlds together, Elm language and Machine Learning.

https://github.com/jscriptcoder/numelm

Please, any feedback would be highly appreciated.

Fran
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Peter Damoc
2017-10-31 12:42:02 UTC
Permalink
Hi Fran,

I would be interested in seeing performance benchmarks agains NumPy.
I'm expecting NumElm to be worse but I'm curious how much worse it is. :)

In any case, congrats for creating this!
Post by Francisco Ramos
Today I'm releasing NumElm, another small contribution to the Open Source,
Frontend and Elm community. NumElm is inspired by NumPy, the fundamental
package for scientific computing with Python. NumElm is the first step in
this ambitious idea of mine of building a Machine Learning package for Elm.
Still a long way to go, but I'm full of enthusiasm. I'm convinced about the
potential of both worlds together, Elm language and Machine Learning.
https://github.com/jscriptcoder/numelm
Please, any feedback would be highly appreciated.
Fran
--
You received this message because you are subscribed to the Google Groups
"Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
There is NO FATE, we are the creators.
blog: http://damoc.ro/
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Francisco Ramos
2017-10-31 12:52:28 UTC
Permalink
Hi Peter,

Thanks for the feedback. Yes, that's in my list of TO-DOs. I'm guessing the
difference will be quite significant, but I'm planning to use
hardward-accelerated code as a next step. I'll create though some
benchmarks gainst NumPy.

Thanks again,
Fran
Post by Peter Damoc
Hi Fran,
I would be interested in seeing performance benchmarks agains NumPy.
I'm expecting NumElm to be worse but I'm curious how much worse it is. :)
In any case, congrats for creating this!
Post by Francisco Ramos
Today I'm releasing NumElm, another small contribution to the Open
Source, Frontend and Elm community. NumElm is inspired by NumPy, the
fundamental package for scientific computing with Python. NumElm is the
first step in this ambitious idea of mine of building a Machine Learning
package for Elm. Still a long way to go, but I'm full of enthusiasm. I'm
convinced about the potential of both worlds together, Elm language and
Machine Learning.
https://github.com/jscriptcoder/numelm
Please, any feedback would be highly appreciated.
Fran
--
You received this message because you are subscribed to the Google Groups
"Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
There is NO FATE, we are the creators.
blog: http://damoc.ro/
--
You received this message because you are subscribed to the Google Groups
"Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Rupert Smith' via Elm Discuss
2017-10-31 14:19:11 UTC
Permalink
Post by Peter Damoc
Hi Fran,
I would be interested in seeing performance benchmarks agains NumPy.
I'm expecting NumElm to be worse but I'm curious how much worse it is. :)
In any case, congrats for creating this!
I'm expecting the Elm version to be faster. C'mon Elm!
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Rupert Smith' via Elm Discuss
2017-11-01 20:38:48 UTC
Permalink
Post by Francisco Ramos
https://github.com/jscriptcoder/numelm
Please, any feedback would be highly appreciated.
So, I have a project at work where we are using NumPy running on AWS. I
have been looking into how to write AWS Lambda functions using Elm, and
found this excellent project:

http://package.elm-lang.org/packages/ktonon/elm-serverless/latest
https://github.com/ktonon/elm-serverless

One cool thing about how it is implemented, is that it uses a wrapper
around the Elm program to establish a new type of 'Program'. As such it
doesn't have ports or hacked any kernel code - yet it is definitely
stretching Elm well outside of it comfort zone as a client side only
language. I think that is pretty neat, because my instincts would have been
either to use ports or do some kernel hacking and ended up with code that I
could not then share on package.elm-lang.org. I somehow automatically
assume that doing anything with elm that is not TEA is going to involve
native code in such a way that a non-shareable package is created and the
back-door that is elm-github-install will be used.

My work project involves running an algorithm in NumPy against 10s or 100s
of days of data points and doing some curve fitting to then make an
estimate of when some equipment is going to exceeed its specified operating
parameters (I'm being vague because I signed an NDA).

So once I get my Elm Lambda functions experiment working nicely, I can try
out converting the NumPy algorithms into NumElm. All the NumPy algorithms I
have are quite short, its fairly simple stuff we are doing. Even if NumElm
turns out a bit slow, its only a few hundred data points at most so I think
it will be ok. I also think fetching the data from the database (Athena)
will tend to dominate rather than the CPU work.

How would I write a curve fitting alrogithm with this? So I have a 3rd
order polynomial:

y = a + b.x + c.x^2 + d.x^3

and some linear algebra on 100 data points will yield values for a, b, c
and d. I'll post up the python code tomorrow, it seems to use an in-built
fit_curve() function.

Rupert
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Rupert Smith' via Elm Discuss
2017-11-02 14:41:39 UTC
Permalink
Post by 'Rupert Smith' via Elm Discuss
How would I write a curve fitting alrogithm with this? So I have a 3rd
y = a + b.x + c.x^2 + d.x^3
and some linear algebra on 100 data points will yield values for a, b, c
and d. I'll post up the python code tomorrow, it seems to use an in-built
fit_curve() function.
Here is the NumPy code that I would like to convert to NumElm:

import time
import numpy as nm

def get_curve(measurements, timestamps):
y = measurements
x = timestamps
z = nm.polyfit(x, y, 3)
f = nm.poly1d(z)


return f


but polyfit and poly1d have not been ported to NumElm. I will take a look
into how to port them.

Rupert
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Francisco Ramos
2017-11-02 17:27:59 UTC
Permalink
Hey Rupert,

Let me have a look when I have a little bit of time and I'll get back to
you.

Fran

On Thu, Nov 2, 2017, 15:41 'Rupert Smith' via Elm Discuss <
Post by 'Rupert Smith' via Elm Discuss
Post by 'Rupert Smith' via Elm Discuss
How would I write a curve fitting alrogithm with this? So I have a 3rd
y = a + b.x + c.x^2 + d.x^3
and some linear algebra on 100 data points will yield values for a, b, c
and d. I'll post up the python code tomorrow, it seems to use an in-built
fit_curve() function.
import time
import numpy as nm
y = measurements
x = timestamps
z = nm.polyfit(x, y, 3)
f = nm.poly1d(z)
return f
but polyfit and poly1d have not been ported to NumElm. I will take a look
into how to port them.
Rupert
--
You received this message because you are subscribed to the Google Groups
"Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Rupert Smith' via Elm Discuss
2017-11-03 09:39:55 UTC
Permalink
Post by Francisco Ramos
Hey Rupert,
Let me have a look when I have a little bit of time and I'll get back to
you.
Fran
I will also have a go at implementing the polynomial stuff in my own
Plynomials.elm built on top of what NumElm already has. If I make some good
progress with it, then we can look at pulling it into NumElm.

Rupert
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Francisco Ramos
2017-11-03 10:06:34 UTC
Permalink
Sounds good. Remember, I built NumElm with Machine Learning algorithms in
mind. So I added mostly the functionality used in such algorithms.


I created this gist for you. Just now, and without testing, so I'm not sure
if it works, but it looks like what you're looking for. Please give it a
try and let me know:

https://gist.github.com/jscriptcoder/3be0e4186bc8098d1310e6e7fb3bf441

Fran


On Fri, Nov 3, 2017, 10:39 'Rupert Smith' via Elm Discuss <
Post by 'Rupert Smith' via Elm Discuss
Post by Francisco Ramos
Hey Rupert,
Let me have a look when I have a little bit of time and I'll get back to
you.
Fran
I will also have a go at implementing the polynomial stuff in my own
Plynomials.elm built on top of what NumElm already has. If I make some good
progress with it, then we can look at pulling it into NumElm.
Rupert
--
You received this message because you are subscribed to the Google Groups
"Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Rupert Smith' via Elm Discuss
2017-11-03 23:30:51 UTC
Permalink
Post by Francisco Ramos
Sounds good. Remember, I built NumElm with Machine Learning algorithms in
mind. So I added mostly the functionality used in such algorithms.
I suppose polynomial fitting is a kind of machine learning. I am a little
bemused by how much ML currently seems to be focused on neural networks, I
always thought kernel methods would overtake the neural approach. Kernel
methods map non-linear problems back into linear ones with higher
dimensionality, just like how this polynomial curve fitting turns a
polynomial into a linear fitting problem with as many dimensions as the
degree of the polynomial.

I created this gist for you. Just now, and without testing, so I'm not sure
Post by Francisco Ramos
if it works, but it looks like what you're looking for. Please give it a
https://gist.github.com/jscriptcoder/3be0e4186bc8098d1310e6e7fb3bf441
Thanks.
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Matthieu Pizenberg
2017-11-02 18:31:46 UTC
Permalink
Hi Francisco, that's awesome what you aim for. I'm also looking forward for
more scientific programming stuff in elm.
Inspiration from numpy is a great choice considering almost all learning
frameworks are usable in python. As a sidenote though you might want to
have a look at the xtensor project <https://github.com/QuantStack/xtensor>
(also inspired by numpy). I've not used it yet but I've seen their introduction
video at PyData
and the approach looks
great! I think it could give you some ideas if you want to create a generic
package for machine learning in elm.

Cheers,
Matthieu
Post by Francisco Ramos
Today I'm releasing NumElm, another small contribution to the Open Source,
Frontend and Elm community. NumElm is inspired by NumPy, the fundamental
package for scientific computing with Python. NumElm is the first step in
this ambitious idea of mine of building a Machine Learning package for Elm.
Still a long way to go, but I'm full of enthusiasm. I'm convinced about the
potential of both worlds together, Elm language and Machine Learning.
https://github.com/jscriptcoder/numelm
Please, any feedback would be highly appreciated.
Fran
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Francisco Ramos
2017-11-02 18:41:00 UTC
Permalink
That's great. Thanks for the links. I read about PyData. Sounds
promising... I'm algo checking out ML packages in Haskell. I'd like to see
other more functional approaches.

Fran
Post by Matthieu Pizenberg
Hi Francisco, that's awesome what you aim for. I'm also looking forward
for more scientific programming stuff in elm.
Inspiration from numpy is a great choice considering almost all learning
frameworks are usable in python. As a sidenote though you might want to
have a look at the xtensor project <https://github.com/QuantStack/xtensor>
(also inspired by numpy). I've not used it yet but I've seen their introduction
video at PyData http://youtu.be/mwIQUgigjbE and the approach looks
great! I think it could give you some ideas if you want to create a generic
package for machine learning in elm.
Cheers,
Matthieu
Post by Francisco Ramos
Today I'm releasing NumElm, another small contribution to the Open
Source, Frontend and Elm community. NumElm is inspired by NumPy, the
fundamental package for scientific computing with Python. NumElm is the
first step in this ambitious idea of mine of building a Machine Learning
package for Elm. Still a long way to go, but I'm full of enthusiasm. I'm
convinced about the potential of both worlds together, Elm language and
Machine Learning.
https://github.com/jscriptcoder/numelm
Please, any feedback would be highly appreciated.
Fran
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...