Geometric framework to predict structure from function in neural networks