Re: [xsl] Performance of XSLT in a neural network application

Subject: Re: [xsl] Performance of XSLT in a neural network application
From: "BR Chrisman brchrisman@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 22 Aug 2020 18:23:55 -0000
as of 10-15 years ago, fortran and mpi had the fastest libraries for
distributed large matrix operations... maybe you can link a library in
via some creative method to an xslt processor... :)
I wrote simulations several years ago that were fast in xslt, but they
used C to perform number crunching on the data elements specified by
the xslt result tree... and the speedup from doing that was in the
regime of 2 orders of magnitude over native number crunching in the
xslt processor I was using at the time.
The 'loop' there was basically:
xslt marks up a tree of structure+data with numerical triggers/targets
hands off tree to a routine in C which identifies data that needs to
be processed mathematically
invokes simulation code that progresses the values forward (in
time),returns when trigger conditions are hit
xslt's more complex processing is invoked and resets triggers/targets
repeat

But if you were simulating orbital dynamics and wanted to perform some
complex xslt processing at an apogee... that might work because
encoding the condition for handing control back to xslt would be
fairly simple.  For a complex stochastic model (the application I
worked on), it would be similar... roll things forward in time until a
condition is hit, then invoke xslt for complex handling and reset
trigger/traps in the result document.  If that's not frequent, it
should be fast.

Seems complex, but it was still far simpler than options like writing
the same thing entirely in another language... more flexible as well.
If the conditions are extremely complex and require the full
capabilities of xslt every step of the way, that might be difficult.
I don't know the details of your model.

On Sat, Aug 22, 2020 at 6:20 AM Roger L Costello costello@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Hi Folks,
>
> I used XSLT to implement a neural network that recognizes handwritten digits.
>
> I have a small training and test data set consisting of 100 and 10 records, respectively.
>
> I also have a large training and test data set consisting of 60,000 and 10,000 records, respectively
>
> Neural networks involve a lot of matrix operations.
>
> In my first implementation I stored the data in XML and the matrix operations operated on XML.
>
> In my second implementation I removed all XML and exclusively used XSLT maps and XSLT sequences.
>
> In my third implementation I used Python instead of XSLT.
>
> Here are the performance results:
> ---------------------------------------------------------------------------------------
> For the small training and test data set:
>
> First implementation (XML): 6 and one-half minutes
>
> Second implementation (maps, sequences): 28.7 seconds
>
> Python implementation: less than 1 second
> ---------------------------------------------------------------------------------------
> For the large training and test data set:
>
> First implementation (XML): more than 24 hours (I stopped it after it had run for 24 hours)
>
> Second implementation (maps, sequences): 5 hours
>
> Python implementation: 30 seconds
> ---------------------------------------------------------------------------------------
> Conclusion: XSLT is not a viable language for creating neural networks.
>
> /Roger

Current Thread