Learn the matrix function of a sort of bilinear form (Neural Networks)
You can write the expression f(x) = |B(x)x|^2 in tensorflow and solve for B via standard gradient descent minimization. Tensorflow can minimize anything you can write in tensorflow.
I am thinking to the problem of doing regression on a scalar function f:R^n->R, where I have a set of training samples (x1,y1),...,(xN,yN), with yi = f(xi).
I know I could in principle apply any neural network architecture to do regression on this function, however I want to exploit a property I know about it to design the network.
Precisely, I know that f(x)= x^TA(x)x$ for a nxn matrix valued function A(x) which I don't know clearly, but I know is symmetric and positive definite.
I think that since I know this structure of the function, it is not an efficient approach to apply a "standard" architecture to this problem. This problem in fact looks like the one of finding and approximation of a metric on R^n.
Since A(x) is symmetric positive definite, I thought to rewrite it as A(x) = B(x)^TB(x) for an unknown matrix valued function B(x). Thus, the function f(x) rewrites in a much simpler way: f(x) = |B(x)x|^2, where the only unknown is the matrix function B(x).
Now, is there some known architecture which is well suited for this context?
Generating the training data with B(x) constant, I have solved the problem very easily defining a weight to be optimized and it works very well. However if the matrix B(x)  is x-dependent I am not completely sure on how to proceed.
Up to now I have implemented a NN which goes from R^n to R^{n^2}, where the output is reshaped into the nxn matrix B(x) to learn. However, this works well just for simple B(x)s and to me it is still not clear why.