Cross-validation using Knime - machine-learning

I am using Knime and I've created a Neural Network using MLP (MultiLayer Perceptron). It works fine. You may ignore all the yellow nodes as all they do is reformat the data sheet.
This works, but I would like to incorporate Cross Validation into the mix. There is a lack of working examples and so I am struggling. I am looking at X-Partitioner and X-Aggregator nodes but I have no idea how to use them in my network.
Can someone help me out?

The answer was quite simple. X-partitioner node basically replaces the Partitioner node. The X-Aggregator node is placed after the MLP Predictor. The X-Aggregator node is in charge of looping the neural network.

Related

How does the model.predict() function work?

I am currently new to ML, and while going through one of the tutorials, I came across the model.predict() function. I have looked through the documentation of this function, but I want to know more about it, like how it works, the algorithm which it uses for prediction, etc.
Can anyone help please?
For a neural network based model, predict() performs forward propagation. It is describes in many books and blogs. See for instance this introduction, https://towardsdatascience.com/coding-neural-network-forward-propagation-and-backpropagtion-ccf8cf369f76
Convolutional Neural Networks and Recurrent Neural Networks use layers which have slight different forward functions.

Is this possible to train new network based on old one without data?

Is this possible to train new smaller network based on already trained network without data? i.e. new network should just try to mimic behaviour of 1st one.
If it's not possible with out data, if there any benefits of have already trained network? i.e. as I understand at least we can use it for pseudo labeling.
Update:
The most relevant paper I have found:
https://arxiv.org/pdf/1609.02943.pdf
I don't think that you can say that you are training a network if you are not using any data. But you can always try to get a smaller one, for example by pruning the large network (in the simplest case, this means removing weights that have an l2 norm that is close to zero), there is a rich literature on the subject. Also, I think you might find some works in knowledge distillation useful, e.g. Data-Free Knowledge Distillation
for Deep Neural Networks .

Tensorflow: Use case for determining a dose of medication

I'm new to machine learning and trying to figure out where to start and how to apply it to my app.
My app is pulling a bunch of health metrics and based on all of them is suggesting a dose of medication (some abstract medication, doesn't matter) to take. Taking a medication is affecting health metrics and I can see if my suggestion was right of if it needs adjustments to be more precise the next time. Medications are being taken constantly so I have a lot of results and data to work with.
Does that seem like a good case for machine learning and using some of neural networks to train and make better predictions? If so - could you recommend an example for Tensorflow or Keras?
So far I only found image recognition examples and not sure how to apply similar algorithms to my problem.
I'm also a beginner into machine learning, but based on my knowledge, one way would be to use supervised learning with Keras, which uses Tensorflow as a backend. Keras is a lot easier to program than Tensorflow, but eventually Tensorflow might as well do the trick (depending on your familiarity with machine learning libraries).
You mentioned that your algorithm suggests medication based on data (from the patient).
One way to predict medication is to store all your preexisting data in a CSV file, and use the CSV module to read it. This tutorial covers the basics of reading CSV files (https://pythonprogramming.net/reading-csv-files-python-3/).
Next, you can store the data in a multi-dimensional array, and run a neural network through it. Just make sure that you have sufficiently enough data (the more the better) in comparison with the size of your neural network.
Another way, as you mentioned, would be using Convolutional Neural Networks, which theoretically could and should work, but I have very little experience programming them, so I'm afraid I can't give you any advice for that (you can program CNNs in both Keras and Tensorflow).
I do wish you good luck in your project!

How to model a for loop in a neural network

I am currently in the process of learning neural networks and can understand basic examples like AND, OR, Addition, Multiplication, etc.
Right now, I am trying to build a neural network that takes two inputs x and n, and computes pow(x, n). And, this would require the neural network to have some form of a loop, and I am not sure how I can model a network with a loop
Can this sort of computation be modelled on a neural network? I am assuming it is possible.. based on the recently released paper(Neural Turing Machine), but not sure how. Any pointers on this would be very helpful.
Thanks!
Feedforward neural nets are not Turing-complete, and in particular they cannot model loops of arbitrary order. However, if you fix the maximum n that you want to treat, then you can set up an architecture which can model loops with up to n repetitions. For instance, you could easily imagine that each layer could act as one iteration in the loop, so you might need n layers.
For a more general architecture that can be made Turing-complete, you could use Recurrent Neural Networks (RNN). One popular instance in this class are the so-called Long short-term memory (LSTM) networks by Hochreiter and Schmidhuber. Training such RNNs is quite different from training classical feedforward networks, though.
As you pointed out, Neural Turing Machines seem to working well to learn the basic algorithms. For instance, the repeat copy task which has been implemented in the paper, might tell us that NTM can learn the algorithm itself. As of now, NTMs have been used only for simple tasks so understanding its scope by using the pow(x,n) will be interesting given that repeat copy works well. I suggest reading Reinforcement Learning Neural Turing Machines - Revised for a deeper understanding.
Also, recent developments in the area of Memory Networks empower us to perform more complicated tasks. Hence, to make a neural network understand pow(x,n) might be possible. So go ahead and give it a shot!

Matching descriptor to database of descriptors

I'm trying to find a fast way to match descriptors from a database. My program works the following way:
1) Populates a database with descriptors of images (using proper feature detection algorithms)
2) Load an image
3) Extracts descriptor for that image and compares it to all descriptors in the DB, so it can find a proper match.
As you can imagine, it's very heavy to compute a comparison of 32 descriptors millions of times. I've used a hashing function, but that only works for two descriptors that are exactly the same, thus only matching two exactly identical images.
What do you suggest I use to speed up this search?
Cheers
EDIT:
I've decided to start by approaching a Neural Network solution. Here's a pretty good link for anyone who wants to get started on the subject.
What you are trying to accomplish is essentially called machine learning/classification. Directly comparing is really hopeless given the size of your database.
Just in case you are not aware of the terminology. The database that you have is called the learning-dataset. You need to use a machine learning algorithm like SVM (support vector machine), K-NN (K-nearest neighbours), Neural networks etc to learn a model. This model is later on used to predict the outcomes of an new and fresh instance, ie. the vector you want to compare your database with.
I would strong suggest the use of SVM, since it is the state of the art classifier in machine learning literature. There is an implementation of it called "SVM light".
http://svmlight.joachims.org/. It is also possible to do ranking with SVM-light. please have a look at that as well.
You can also try and use neural networks. I use neural network toolbox in matlab for this (nprtools) which is pretty neat.

Resources