Showing posts with label random matrix theory. Show all posts
Showing posts with label random matrix theory. Show all posts

Wednesday, 12 November 2025

Understanding high-entropy random number generation for research: Leymosun Package

Preamble

The idea of generating randomness via computers goes back to von Neumann's and his team of colleagues work in Princeton and Los Alamos. Even though, he was sceptical about the idea of generating randomness via computer programs, this practice is now almost a de-facto standard, so the name pseudo-random-number-generator (PRNG). Is there a way to generate better PRNGs? This is a continuous research. A practical matter of seeding is often ignored because a good PRNG should be reliable regardless of seeding, however, in repeated calls to a random sequence may degrade this view. 

PRNGs bird's eye view : Simulating Randomness

Wigner's Cat (Leymosun Package)
Probably the easiest way to explain RNGs appears to be using discrete recurrence equations, well, actually most RNGs generates numbers based on this, such as $$x_{n+1} = f(x_{n})$$ for example it can be parametrised by $a$ and $b$, $f(x_{n}) = a x_{n} + b$. This basic form allow us remarkably to generate quite useful simulation of randomness. 

Concept of a seed 

An other concept is a seed, it can be the first number to start recurrence but it can also be some other form of something related to random generation, if $x_{0}$ is fixed or has some complicated formula. We usually put seed like 42 or 4242 or some other integer.  There are actually used code with seeds 12345.

Anytime we call a randomisation functions, such as sampling 

How eliminating seeding improves things? High-Entropy Randomness

We use new seeds at each new call, this would generate a different sequence and yields us to sample it. This practice would improve the non-predictability as we sample different sequences. But then the question is, where to get the seeds at each call? The answer lies on the "entropy pool" provided by the operating systems, such us Unix's "/dev/random". Essentially they are kind of random devices we tap into. By using hybrid approach of pseudorandom generation via algorithms and seeding from random devices yields to an increased, High-Entropy randomness. 

Leymosun: Tested implementation

Leymosun Python package provides this facility, using its random module functionality operates as described above and one doesn't need to provide any seeding, it uses non-deterministic seeding. Using NIST's test, we have shown that high-entropy approach gives higher pass scores in randomness tests compare to baseline seeding, such as 42. To install, just use:

 pip install leymosun

Conclusion

Using high-quality randomness for research is quite critical. We have shortly discussed this covering the new approach of using RNGs. 

Further reading and links


Please cite as follows:

@article{suzen21,
  title={Empirical deviations of semicircle law in mixed-matrix ensembles},
  author={S{\"u}zen, Mehmet},
  year={2021},
  journal={HAL-Science},
  url={https://hal.science/hal-03464130/}
}
 @misc{suezen25ley, 
     title = {Understanding high-entropy random number generation for research: Leymosun Package}, 
     howpublished = {\url{https://memosisland.blogspot.com/2025/11/leymosun-high-entropy-randomness.html}}, 
     author = {Mehmet Süzen},
     year = {2025}
}  

Sunday, 28 June 2020

Conjugacy and Equivalence for Deep Neural Networks: Architecture compression to selection

Preamble


A recently shown phenomenon can classify deep learning architectures with only using the knowledge gained by trained weights [suezen20a]. The classification produces a measure of equivalence between two trained neural network and astonishingly captures a family of closely related architectures as equivalent within a given accuracy. In this post, we will look into this from a conceptual perspective. 


Figure 1: VGG architecture spectral difference in the long
positive tail [suezen20a]. 
The concept of conjugate matrix ensembles and equivalence


Conjugacy is a mathematical construct reflecting different approaches to the same system should yield to the same outcome: It is reflected in the statistical mechanic's concept of ensembles. However, for matrix ensembles, like the ones offered in Random Matrix Theory, the conjugacy is not well defined in the literature. One possible resolution is to look at the cumulative spectral difference between two ensembles in the long positive tail part of the spectrum [suezen20a]. If this is vanishing we can say that two matrix ensembles are conjugate to each other. We observe this with matrix ensembles VGG vs. circular ensembles. 


 Conjugacy is the first step in building equivalence among different architectures.  If two architectures are conjugate to the same third matrix ensemble and their fluctuations on the spectral difference are very close over the spectral locations, they are equivalant in a given accuracy [suezen20a].


Outlook: Where to use equivalence in practice?

The equivalence can be used in selecting or compressing an architecture or classify different neural network architectures. Python notebook to demonstrate this with different vision architecture in PyTorch is provided, here.

Reference


[suezen20a] Equivalence in Deep Neural Networks via Conjugate Matrix Ensembles, Mehmet Suezen, arXiv:2006.13687 (2020)




(c) Copyright 2008-2024 Mehmet Suzen (suzen at acm dot org)

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License