0

On paper it seems quite simple so forgive me if I'm missing something obvious.

I've got 2 input arrays X1 and X2 of the same shape, and a target array Y also of the same shape. I'd like to combine X1 and X2 in some way to produce an approximation of Y. The combination should be element-wise, eg X1[0][0] combines with X2[0][0] and so on. I'd appreciate any ideas on how to do this in python, and if you think there are good non-linear methods that would also be really helpful, thanks.

5
  • please provide a minimal example (X1, X2 and Y) for clarity
    – mozway
    Commented Apr 11, 2023 at 9:44
  • 1
    a linear combination is defined as ax + by so the problem is to find the coefficients a and b such that ax + by = z. This to me seems more of a mathematics problem than a python one.
    – Fra93
    Commented Apr 11, 2023 at 9:50
  • @mozway Just standard float arrays. So all could be something like np.array([0.3, 0.4, 1.2, 1.4], [2.3, 0.5, 1.8, 0.1])
    – Mike
    Commented Apr 11, 2023 at 9:54
  • @Fra93 Well yeah but I'm wondering if there are convenient python solutions, eg the numpy polyfit method does a linear approximation with 1 input array and a target array
    – Mike
    Commented Apr 11, 2023 at 9:56
  • @Mike then I think you first should come up with an algorithm and then try implement it. If you fail, you ask here. If you don't have any algorithm in mind, you should ask on mathematics stack exchange, or maybe the dsp stack exchange :)
    – Fra93
    Commented Apr 11, 2023 at 14:44

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.