04/26/2023, 5:11 PM
Is there any relatively small (<2MB with dependencies) multiplatform or at least pure-JVM library that provides me with basic learning+prediction functionality? Like linear regression, gradient descent with like 10 parameters, small data sets. Would be nice if it allowed me to define basic neural networks but that's not necessity. I found libraries like Smile, DiffKt, KotlinDL, ONNX but they're all huge (100MB+) and require native dependencies. I also found KInference but it can't do training at all so I can't fine tune the model on user machine. Usecase: to be embedded in minecraft mod to optimize map tiles prefetching, rendering priority and caching. I have experience in tensorflow and pytorch but they're too big for this project and have native code dependencies. I don't need anything fancy, just some basic functionalities for simple models, small datasets, a few parameters.

Hampus Londögård

04/27/2023, 4:54 AM
You can download Smile with a small size by excluding native (or at least it was possible 1 year ago). But the license is not commercial if I recall. I’ve thought about building such a library but it’s a huge undertaking.


04/27/2023, 10:28 AM
It is hard to define, what is basic neural network, MLP could be implemented shortly, but cnn or transformer based stuff requires a lot of megabytes just code
There is no such library on the market, because users wants very different subsets of dl ml functionality. You could try tribuo or apache common math to reduce the footrprint. But I understand your pain, this is a reason why I have my private unpublished library to solve my needs in Kotlin with small size and classical ml algorithms


04/27/2023, 12:21 PM
Yeah, I meant exactly just MLP. Actually most CNN uses should also fit in like 2-5k lines of code There's actually a lot of independent use cases that require a simple solution like that. Maybe I'll just end up making some primitive home-grown solution


04/27/2023, 6:48 PM
Possible ojalgo might fit the bill. Never used its neural network package myself, but checkout this link: Might not be < 2MB