NNs for optimizing 4 variables

Discussion in 'Strategy Building' started by Runningbear, Dec 12, 2010.

  1. amibroker can do that in minutes.
     
    #11     Dec 13, 2010
  2. Do you really only have 4 variables, or are there more? For 4, least squares regression might work. I believe you can even do this with Excel Solver. This does not include the interaction terms. And, if the variables/interactions are not linear, this won't be accurate. However it would get you started and give you a rough idea of what's going on.

    The analysis could potentially be broken up into several problems. (1) How many variables should be considered. (2) Should interactions be considered, or can the inputs be assumed to be independent. (3) Optimization/probability/likelihood calculation.

    In line with what intradaybill is saying, you could use multivariate probability distributions, and not use neural networks.

    One way to determine if interactions are present:
    signal = w1*constant + w2*A + w3*B + w4*C + w5*D + w6*AB + w7*AC + w8*AD + w9*BC + w10*BD + w11*CD + w12*ABC + w13*ABD + w14*ACD + w15*BCD + w16*ABCD
     
    #12     Dec 14, 2010
  3. gtor514

    gtor514

    It sounds to me you need to look into a Genetic Algorithm (GA's) and not NN's.

    If you can come up with an objective/fitness function with your variables, the variables can be solved very easily.

    Another method and my personal favorite method is the use of Particle Swarms (PSO's). They are easy to implement and their operation when attemting to converge on a solution can provide insight to your problem.
     
    #13     Dec 14, 2010

  4. Will have to look into particle swarm optimization!

    How would the GA be implemented? Split each variable into pieces? In this case, only 4 variables, a brute force approach might be fine. It would take more time than a genetic algorithm, however it would still run in seconds, unless there is tons and tons of data to go through. How much data are we talking about here?
     
    #14     Dec 14, 2010

  5. gtor514.

    I'm not really familiar with particle swarms. Do you have any references that can help bring me up to speed?

    Runningbear
     
    #15     Dec 14, 2010
  6. gtor514

    gtor514

    GA's and PSO's are very fast and efficient methods of optimization however converging on a solution will depend on the size and complexity of the objective/fitness function and the number of variables. With four variables, it should be no problem.

    I code in c++ and have an app that can optimize on a time series of 20,000 points with a dozen variables with 100 runs in just a few minutes and get close to some sort of convergence. It just depends on what your trying to solve, how big a population you want to begin with, your error for convergence, your solution space, etc, etc, etc

    There are plenty of implementations in Java, python, matlab, on the web. Most trading platforms have some sort of implementation of the GA to optimize trading strategies.
     
    #16     Dec 14, 2010
  7. gtor514

    gtor514

    A seach on google will give a ton of stuff. It all may seem really complicated but it's not it's actually quite simple. A PSO can programmed in less than 50 lines of code.

    This is essentially how it works. You create a population of particles whose position represent a variable you want to solve for. In your case 4 variables => 4 populations. Each population is limited to a solutions space that represents the min and max or variable limits say (-1.0 to 1.0) and each particle is randomly initialized within this search space.

    You then let the particles "swarm" or move a random direction and velocity. You take each particles position (which are your variable values) and pump them thru your objective function. You pick the particle from each population that provided the best solution and set the direction and velocity of each other particle in its direction. You repeat until you have a set of particles that best fits your solution.
     
    #17     Dec 14, 2010
  8. Overkill methods. Just use backtesting in optimization mode with the 4 variables incremented.
     
    #18     Dec 15, 2010
  9. Eight

    Eight

    in the backtesting sense of optimization [I suppose there is on the fly optimization] Openquant has a "simulated annealing" backtesting thing that can optimize a system with a lot of variables...
     
    #19     Dec 15, 2010