Best way to do heavy math operations in Ignition?

When I originally created this thread I was thinking in Neural Network and Machine Learning kind of functions and capabilities. It is nice to see it evolving into something as useful and needed. What I’m thinking is a github with all these kind of basic and necessay math functions. So far is empty but I’ll be feeding it at some point in the near future.

If someone wants to participate or collaborate (so we can have a more robust library) feel free to say so and then I can add you as collaborators.

P.S. I’m fairly new to github (as you can see in the git profile, so feel free also to add structrue if needed)

2 Likes

Hi everyone,
I’ll throw my $0.02 in as well. I’m looking to do nonlinear regression on data that I am capturing with Ignition. The expectation function is y = A*(x + B)^(-C) + D so I fear it is not as easy as using Jordan’s polynomial regression function (tantalizingly close though).

Currently I have to capture the dataset in Ignition, export it into Minitab where I do the regression, and then enter my A,B,C, and D coefficients back into Ignition where I take the derivatives of the function. I’d like to avoid the need for Minitab.

Would’ve been easy in scipy, but we all know that’s not an option. I can’t decipher if either the JScience or Apache Math collections can do this kind of regression. Can they? If so, how do I implement them?

If not, Jordan, what are my chances of you adding this kind of number crunching to your library??! Do you like donuts??

Cas

Some resources to investigate… I’d be shocked if there’s nothing for your task:

https://math.nist.gov/javanumerics/

1 Like

donuts

Seriously, though, what model are you using in Minitab?

Since Ignition 8 finally uses Jython 2.7, it is possible to use Execnet to call CPython libraries from Ignition.
One of my colleagues is currently testing a regression analysis with numpy and scikit-learn. The data is send in a request to the gateway and a gateway script computes the regression in CPython using the ExecNet methods.

3 Likes

An update to this thread: The above is no longer true. We pulled Apache Math into Ignition in 7.9.8, so it's available in scripting everywhere.

2 Likes

Can you please give a brief example of how it could be used in scripting?

I believe Kathy’s refering to the system.math library.

Since the library has alot of different fuctions, it would be a bit tough to provide an example of how it can be used. But you can import things from this library(example below) now and use them to perform functions.

from org.apache.commons.math3.ml.clustering import KMeansPlusPlusClusterer

Some documentation can be found at the below links:
https://commons.apache.org/proper/commons-math/apidocs/index.html

https://commons.apache.org/proper/commons-math/userguide/index.html

Thanks Paul and grietveld!

To clarify a bit, we took the most common parts and put them into system.math to make it easy for people to use this. But for our more advanced scripters, you have access to all of org.apache.commons.math3 by pulling in the appropriate imports.

6 Likes

Resurrecting an old thread. Thank you for system.math. However, for some of these functions the manual needs to spell out the method being used. For instance, standard deviation can be sample or population and as I am sure you know, the formulas are different. Please specify which is being used or better yet, show the formula.

2 Likes

Good idea. Even better would be to identify the underlying Apache Commons function being called. Those are documented in detail.

Most of the functions come from StatUtils.

The standard deviation in particular comes from the DescriptiveStatistics class.

If you need a particular implementation, you can also just import the specific class you want directly, since we’re adding commons.math to the client/designer classpath.

Well, I meant to identify them in the user manual. Then it is unambiguous, and it simultaneously hints that there are other options.

2 Likes