I am new to AI and to get started I want to train a neural network using simple values.

My input values are: 1, 2, 3, ... And my output values: 1*1, 2*2, 3*3, ... (1, 4, 9, ...)

It's simply f(x) = x^2

I am looking for a library or SDK which supports real neural networks. I don't want to use regression but instead a neural network.

I want to train the neural network without giving it any hint about what kind of mathematical function is being used. It is ok if I have to tell it that it is a mathematical function. But I don't want to tell it whether it's linear, polynomial or exponential.

I tried php-ml but in this post I was told it doesn't support neural networks.

I am good at these languages: PHP, Java, JavaScript, C, C++.

Please recommend a library or SDK in one of these languages. If there is none then C# would also be fine.

It must run under Linux and it must be free. It must run locally and not in the cloud.


1 Answer 1


You could install Weka - it is a free desktop app (Download) and it has all classic supervised learning algorithms built in (or extendable via a package manager). Learning algorithms include Linear Regression, Multilayer convolutional neural network (which you can design by point and click), Simple Perceptron; and unsupervised learning algorithms , too.

The output will not be "most likely functionname = f(x²)" but you will get confusion matrices and metrics like accuracy, false positive rate, mean of squared errors, f-measure.

You could use the "Weka Experimenter" Component to try several possible algorithms at once. Then you must finally select an appropriate model (or data transformation) by choosing the one with the best metrics.

Drawbacks of Weka are its non-intuitive User interface (Watch some tutorial videos first), Weka is Java based (extra installation steps required), and it works best with its own input file format (.arff), although .csv files work as well.

  • I googled a little and it seems Weka can only do nn classification using the class MultilayerPerceptron. It cannot produce integers as output (see my example). If I am wrong then please tell me which Weka class I have to use.
    – zomega
    Jan 31, 2023 at 11:59
  • You are not wrong and I don't know that much about neural networks but I think a neural network classification never directly gives you integers as output. It assigns probabilities to each potential classification outcome. In the well-known tutorial Neural Networks , e.g. for classifying MNIST digits, the neural network never gives you "0" or "4" or "7" as output, it gives you a vector of probabilites p (or likelihoods) for each digit from 0-9 and you choose the p which is max. -- Maybe you are looking for something different (an ai-assisted computer algebra system, perhaps)?
    – knb
    Jan 31, 2023 at 12:21
  • I gave you the bounty for your effort. I found TensorFlow which seems to be deep learning library #1.
    – zomega
    Feb 5, 2023 at 20:41
  • Thanks. I like to have Weka (and Netlogo) at my disposal, because they are desktop apps and I come from an era where this was the dominant paradigm for working with a computer. For having all classic machine-learning algorithms "under one roof", and for having an interactive point-and click GUI, Weka is good. (Some simple routine tasks are super-awkward to execute though. Too many clicks required.). Good luck with tensorflow (use the Keras "add-on") .
    – knb
    Feb 6, 2023 at 10:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.