ML model for Signal Decomposition So recently I got a task which can be summarized as follows:
Suppose we have 3 functions f1, f2, f3 and a certain combination of the functions gives us F.
af1 + bf2 + cf3 = F

The component functions are simple and can be calculated.
In traditional regression, the task will be to approximate F while f1...f3 are the inputs which vary on each datapoint and a, b, c are the weights we want to approximate and they will then be the same values used to compute F for all data points with unknown F.
In my case, however, the task is to learn the combination of f1, f2, f3 that would yield a given F (or how F factorizes into f1, f2, f3). So F is known and f1,f2,f3 are known too
but the goal is to find the weights a, b, c which vary on data points.
I have researched how to frame this as an ML task and which paradigm to use but cannot find one yet. I have checked regression, matrix-factorization, but none of these seems like what I need.
Some Context
I have 3 signals of intensity as a function of the wavelength of light used to generate the primary colours RGB. The functions to generate these signals are known. Now, these colours can be combined to obtain secondary colours whose signal is a linear combination of the RGB signals. 
Hence, the task is: given the signal of a secondary colour, how do I determine the linear combination of RGB that gave that colour. Can a model be trained to learn the decomposition of the secondary colour signal into the RGB signals?
I have tried to run a regression on it but it performed worse than poor because I only got a single set of weights which gives me a single mixture formula for the colors while in reality there are many so the results didn't fit. 
I hope this helps to better understand if my mathematical formulation above was not clear enough.
Any help on the direction to go will be appreciated.
 A: If I understand your question, here is your problem. You have a waveform F which is defined as follows:
$$F = af_r+bf_2+cf_3$$
However, let's rewrite this in a slightly different form to avoid overusing the letter f. 
$$X_{t}=X_{r,t}+X_{g,t}+X_{b,t}$$
Since this is light we're talking about, we know its waveform is sinusoidal. We'll borrow the notation from here to express our components $Xi,t$:

You should think about the equation of a light wave in the above form because it is easy to understand. The only modifications we'll make is to exclude the $\mu$ term since I don't believe we would expect a non-zero mean for a light wave. Therefore we define:
$$X_{i,t}=R_icos(f_it+d_i) \;\;\forall \;\; i \in \{r,g,b\}$$
Your goal is to estimate the amplitude, $R$, of the red, green, and blue waves. We can do that with regression. However, note that each RGB wave contains two unknown variables: $R_i$ and $d_i$. Because $d_i$ is within the cosine function, linear regression doesn't allow us to model it directly. Instead, we reexpress our cos function as the linear combination of a sin and cos function. See the link above for details.
$$X_{i,t}=\beta_{1,i}cos(f_it)+\beta_{2,i}sin(f_it) \;\;\forall \;\; i \in \{r,g,b\}$$
where $\beta_{1,i}=R_icos(d_i)$ and $\beta_{2,i}=-Rsin(d_i)$
This is the exact same equation except that now it is linear in the parameters $\beta_1$ and $\beta_2$ which means we can use linear regression to estimate all of our $\beta$'s. Then, finally, we can estimate the amplitudes $R_i=\sqrt{\beta_{1,i}^2+\beta_{2,i}^2}$.
I put together some code to demonstrate how to perform the described regression in R. I simulated the input using the sum of red, green, and blue light of random intensity and phase. From that, I accurately estimate the amplitude of each color of light using regression onto the basis we described above. 
t = seq(from = 0, to = 1000, length.out = 1001)

# Frequencies of RGB light in 1/nm, f=2pi/lambda
# https://en.wikipedia.org/wiki/Color
freq.r = 2*pi/700
freq.g = 2*pi/530
freq.b = 2*pi/470

# We don't include the mean, as it doesn't make sense for light
amplitude.r = runif(n = 1, min = 0.1, max = 1)
amplitude.g = runif(n = 1, min = 0.1, max = 1)
amplitude.b = runif(n = 1, min = 0.1, max = 1)

phase.r = runif(n = 1, min = 0, max = pi/2)
phase.g = runif(n = 1, min = 0, max = pi/2)
phase.b = runif(n = 1, min = 0, max = pi/2)

Xt.r = amplitude.r*cos(freq.r*t+phase.r)
Xt.g = amplitude.g*cos(freq.g*t+phase.g)
Xt.b = amplitude.b*cos(freq.b*t+phase.b)
Xt.mix = Xt.r+Xt.g+Xt.b

plot(Xt.mix)
lines(Xt.r, col="red")
lines(Xt.g, col="green")
lines(Xt.b, col="blue")


cos.r = cos(freq.r*t)
sin.r = sin(freq.r*t)
cos.g = cos(freq.g*t)
sin.g = sin(freq.g*t)
cos.b = cos(freq.b*t)
sin.b = sin(freq.b*t)

df = data.frame(Xt.mix, cos.r, sin.r, cos.g, sin.g, cos.b, sin.b)

model = lm(Xt.mix~cos.r+sin.r+cos.g+sin.g+cos.b+sin.b+0,
           data = df)

amplitude.r.est = sqrt(sum(model$coefficients[1:2]^2))
amplitude.g.est = sqrt(sum(model$coefficients[3:4]^2))
amplitude.b.est = sqrt(sum(model$coefficients[5:6]^2))

data.frame(Red = c(amplitude.r,amplitude.r.est),
           Green = c(amplitude.g,amplitude.g.est),
           Blue = c(amplitude.b,amplitude.b.est),
           row.names = c("estimated", "actual"))


You have to run an individual regression on each input to estimate the weights. However, all you need to do is to repackage the above steps into a function for easy replication. 
