Using machine learning to predict collapse and stabilize complex systems?

I have been working on the SDK with fuzzy logic for the past 3 months, and this has come to the point that I need to start intensively optimizing the engine.

As with most “utility” or “needs” based AI systems, my code works by placing various advertisements around the world, comparing these advertisements with attributes of various agents and “clogging” ads [based on each agent], respectively.

This, in turn, creates very repeating graphs for most single agent simulators. However, if you take into account various agents, the system becomes very complex and much more difficult to model my computer (since agents can broadcast advertisements with each other, creating the NP algorithm).

Below: an example of system repeatability, calculated on 3 attributes for one agent:

Up: an example of a system designed for 3 attributes and 8 agents:

exp-system

(Collapse at the beginning and restore shortly afterwards. This is the best example I could create that would fit the image, since recovery is usually very slow)

As can be seen from both examples, even with an increase in the number of agents, the system is still very repeated and, therefore, spends valuable computation time.

I am trying to restructure the program so that during periods of high repeatability the Update function only continuously repeats the line graph.

Although my fuzzy logic code can predict in advance to calculate collapse and / or system stabilization, it extremely puts my processor at risk. I believe that machine learning would be the best way to do this, since it seems that once the system has set up its initial setup, instability periods always seem to be about the same length (however, they occur in the “floor”, random times. I tell the floor because it is usually easily noticeable with the help of various figures shown on the graph, however, like the instability length, these patterns are very different from those configured for tuning).

Obviously, if the unstable periods have the same length of time, as soon as I know when the system will collapse, it is much easier to understand when it reaches equilibrium.

On the side of the note about this system, not all configurations are 100% stable during repetition periods.

This is very clearly shown in the graph:

exception

Thus, a machine learning solution would have to distinguish between Pseudo collapses and total collapses.

How viable will the use of the ML solution be? Can anyone recommend any algorithms or implementation approaches that will work best?

As for the available resources, the scoring code does not compare with parallel architectures at all (due to the explicit relationships between the agents), so if I need to devote one or two CPU threads to perform these calculations, let it be so. (I would prefer not to use a GPU for this, since the GPU is taxed on the non-AI part of my program).

Although this, most likely, will not change the situation, the system in which the code runs has 18 GB of RAM remaining at runtime. Thus, the use of a potentially highly rated solution would certainly be viable. (Although I would prefer to avoid this if necessary)

+5
source share
2 answers

Yes, I’m also not sure what the best place on StackExchange is for this topic, but I do it because I have some experience in this area.

This is a problem that often occurs when developing control systems. It is often called the black box time series modeling problem. Its "black box" in the sense that you do not know what exactly is inside. You give it several inputs, and you can measure some outputs. Given a sufficient amount of data, a fairly simple system and an appropriate modeling method, it is often possible to approximate the behavior of the system.

Many modeling methods for this revolve around the adoption of a certain discrete number of past inputs and / or measurements and try to predict what the next measurements in time will be. This is often referred to as an autoregressive model .

Depending on the complexity of the system you are trying to simulate, a non-linear autoregressive exogenous model may be the preferred option. This can take the form of a neural network or a radial basic function , which once again takes the last n measurements in time as input and gives a forecast of the next measurement as an output.

Looking at your data using similar methods, you can easily build simple models of vibrational behavior. As for your collapse or pseudo-collapse modeling, I think that this could be captured using a rather complicated model, but it can be more complicated.

So, let's look at a simple example to try to illustrate how you can build an autoregressive model of some kind of oscillatory behavior.

For the system, take a simple sine wave with frequency and add some Gaussian noise. This can be represented below: measurement x some frequency \ omega and gaussian noise \ phi at some discrete time point k.

x_k = sin (\ omega t_k) + \ phi_k

Using this, we can measure a few seconds of data. Then we will create a data set consisting of 2 arrays. The first contains sets of historical dimensions G for any time step, and the second contains a measurement at any given time step H .

If we use the linear model from the wikipedia article , then the parameters b for the autoregressive model can be found with linear regression using the linear least squares method .

H = gb

b = (G ^ T G) ^ {- 1} G ^ T H

By comparing the results of this model directly with the data set, it is fairly easy to get accurate results for this toy problem. If you need to predict only one step in the future, and real measurements will be collected again before making the next prediction, the error in the predictions does not accumulate. This is sometimes called open loop prediction.

open loop predictions from AR model

Closed-loop forecasting is where you only give the model one initial dimension. After that, you use your own forecasts as input for future forecasts. Noise in predictions can accumulate, making long-term prediction inaccurate. Although these long-term forecasts may not be accurate, this does not mean that the results will not be the same or good enough. I played a little with the toy system above, and my closed-loop predictions tended to underestimate the amplitude and often led to a damped oscillation of the correct frequency.

closed loop predictions from AR model

If such problems arise, you can add more historical patterns as input to your model, give them more training data, or use a more non-linear model.

In the aforementioned toy problem, only one value is modeled. On your graphs, it seems that there are several “channels” of data from agents and that they somehow interact with each other. To model this behavior, you can include n historical values ​​from each channel as inputs to your model, and the outputs will be forecasts of each channel.

Please let me know if I can clarify this in order to better solve your problem. I can split the matlab code that I used on the toy problem if there is interest.

+2
source

I came to the conclusion that the best way to do this is to use a chain of stamps. Instead of using one to store a number of attributes, I keep the probability of the next advertisement that the agent will choose.

So, if I eat, there is a 15% chance that I will sleep further. Then, if I sleep, there is a 70% chance that I will go to work in the morning. Obviously just rand () between iterations

0
source

Source: https://habr.com/ru/post/1203817/


All Articles