4

As an end result, I would like a computer program which can accept a list of inputs and outputs and then apply the same algorithm that went into those input/output's on another number, I.e:

If given this list of input/output's

2:4
4:8
100:200

It would realize that the algorithm would be (input * 2), or (output / 2) depending on what we wanted.

So, if given the number 16, and asked to produce an output the program would respond with 32. And if given the number 10 and asked to produce an input, it would respond with 5.

It would obviously be rather simple to 'hardcode' this into the program, although I'd like to learn how to have the program teach itself what the algorithm is. I understand that this will get rather complicated rather fast.

Peter O.
  • 32,158
  • 14
  • 82
  • 96
Storm-
  • 147
  • 8
  • 4
    Would you consider a neural network a mathematical algorithm? – Don Reba Jul 17 '15 at 00:22
  • @DonReba I have a feeling this is going to get a lot more complicated than the insane complicatedness I already predicted. – Storm- Jul 17 '15 at 00:35
  • This seems like a very open ended question. Have you tried [modeling](https://en.wikipedia.org/wiki/Data_modeling) your problem first. It will be easier to solicit for algorithms if you have a description or model of the process. If all you have is a list inputs and outputs and no knowledge of the underlying model/physics then @DonReba is correct [neural network](https://en.wikipedia.org/wiki/Artificial_neural_network) is probably the way to go. – dpmcmlxxvi Jul 17 '15 at 00:47
  • Agree that it is open-ended: there may be multiple solutions, and no one is correct. I agree with the simple solution provided by @lavin below (interpolation). – TheGreatContini Jul 17 '15 at 01:27
  • For this kind of sequence of one dimensional signals I'm not sure how much a neural network can provide. In the best case it converges to some type of shannon interpolation. In the worst case it returns random-like numbers and you can't even be sure if it really should look like that or there's a bug in the code. – lavin Jul 17 '15 at 02:50
  • 1
    This is a huge topic of active research. The only way you can begin to approach this without diving into that research is to make some sort of assumption about your algorithm. Are you looking for a best fitting polynomial of some degree? – Teepeemm Jul 17 '15 at 12:23
  • 1
    This actually sounds like classic interpolation. See https://en.wikipedia.org/wiki/Interpolation – lavin Jul 17 '15 at 00:38
  • This problem is called regression: https://en.wikipedia.org/wiki/Regression_analysis. Alternatively, it can be called curve fitting: https://en.wikipedia.org/wiki/Curve_fitting. There are a huge number of algorithms for it. – user20160 May 29 '16 at 07:39

1 Answers1

1

you can not do this reliably for any type of input/output signal dependency instead you should support only some otherwise you need some kind of AI or very complex neural network + many functional generators with insane complexity and unknown reliability of the solution ...

I would simplify this to dependencies like:

  1. polynomial up to some degree

    • (can use any interpolation/approximation)
    • y=a0+a1*x+a2*x*x+a3*x*x*x
  2. exponential

    • y=a0+a1^x
  3. other

    • If you want to support things like sin waves etc then you would need many inputs not just few to decide the type of dependency.

Anyway I think just 3 input points will be not enough

  • for example polynomial a0+a1*x+a2*x*x+a3*x*x*x=y needs at least 4 points

So at first you should determine which type of dependency it is and then try to find the coefficients of that particular function generator. For example:

  • if you have inputs x0<x1<x2<x3,... and outputs y0,y1,y2,y3,..
  • and k0=y0/x0,k1=y1/x1,...
  • if k0<<k1<<k2<<k3<<... or k0>>k1>>k2>>k3>>... it is probably exponential dependency
  • otherwise use polynomial ...

If you have mixed type signals then you need much more input points covering big enough range and probably would need some kind of approximation search of coefficients minimizing the distance between known inputs and generated output. If you have enough points you can normalize dataset and use correlation coefficient to compare it with supported function generators to simplify the decisioning

[Notes]

So you need to specify:

  • what kind of dependencies will be supported (types,singular,combined)
  • how many input points you have (minimum, recommended etc...)
  • what is the target precision/error
  • what is the target ranges of x,y
Community
  • 1
  • 1
Spektre
  • 49,595
  • 11
  • 110
  • 380