I have a family of convergence curves as you can see in the image below:

enter image description here

I would like to train a model that fits reasonably well to all the curves at the same time in my dataset. Is it possible? Do you have any suggestion? It could be a classical econometric model or even machine learning / deep learning models.

  • $\begingroup$ What are your findings so far? $\endgroup$
    – nbro
    Jun 4 at 7:47
  • $\begingroup$ Please, also describe why you need to fit a model to multiple curves. What is your specific problem? $\endgroup$
    – nbro
    Jun 4 at 18:32
  • $\begingroup$ I need to generalize an optimization for numerical solution of an equation. Each solution follows one of these curves, so I need to generalize this solution of optimization to all these multiple curves. More specifically, the model should work fine for whatever the parameters of my equation are, which will result in different curves like the ones shown. $\endgroup$
    – giovasbr
    Jun 4 at 22:58
  • $\begingroup$ Please, edit your post to include those details directly there. $\endgroup$
    – nbro
    Jun 4 at 23:35
  • $\begingroup$ One thing that comes to mind that could be useful in your case is the Gaussian process. Right now, I don't have time to explain more, but you can look it up here distill.pub/2019/visual-exploration-gaussian-processes. Once you have an answer to your question, feel free to write it below for future reference. $\endgroup$
    – nbro
    Jun 4 at 23:47

1 Answer 1


This looks like a 1-to-many problem.

Given a single scalar x value, you want your output to be an array of size N where N is the number of curves.

as an example you can build a model in this way using tensorflow:

#====================== Build achitecture:
import tensorflow as tf
Input = tf.keras.layers.Input(shape=(1),name='Input')  #<<--- Takes a single scaler input
xi = tf.keras.layers.Dense(units=100,activation='relu',name='D1')(Input)
xi = tf.keras.layers.Dense(units=100,activation='relu',name='D2')(xi)
Output = tf.keras.layers.Dense(units=10,activation='relu',name='Output')(xi) #<<-- 1 unit for each output

model = tf.keras.Model(Input,Output,name='Model1')

Here is a visualizations of the results:

enter image description here

You can view the entire notebook here if you need it.

Hope this helps :)

  • 1
    $\begingroup$ I have a question: in your approach, does this scalar somehow identify the curve that will be plotted? I ask this because as I said and a previous comment I need to generalize an optimization for numerical solution of an equation. So if somehow the paremters of the function, in your case s and k could identify the curve, it would be awesome! $\endgroup$
    – giovasbr
    Jun 22 at 21:47
  • $\begingroup$ So for an input tensor X of shape (n_samples,) you get an output tensor Y of shape (n_samples, m_functions) so if you want to access the output of just the kth function you could slice it: Y_k = Y[ : ,k]. We could have trained the model such that the input tensor X is of shape (n_samples,2) where each sample is a 1d tensor of size 2: [x_value, function_id] then you would just get an output of size (n_samples). I had taken the stipulation " ... fits reasonably well to all the curves at the same time" to mean you wanted all outputs simultaneously. $\endgroup$
    – J.Kent
    Jun 28 at 3:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .