The present invention relates to aggregating a dataset that allocates an output variable value to input variable vectors, in particular of measured data, into a function term that models the correlation included in the dataset between the input variable and the output variables.
In many applications, the question arises in which way a predefined output variable of a technical system depends on a set of predefined input variables. For motors, for example, conclusive information is desired about the extent to which the torque depends on the angular velocity, the load, the slip and on additional parameters. Analytical models are available for simple applications. In more complex applications for which no analytical model exists, the input variables and output variables can be acquired in a dataset with the aid of measuring technology. Different options then exist for aggregating this dataset into a meaningful description. For example, a parameterized model is able to be fitted to the dataset by optimizing its parameters. However, it is also possible, for instance, to search a space of mathematical functions utilizing a symbolic regression in an effort to find a function that accurately describes the correlation between the input variables and the output variables.
According to the present invention, a method is provided for aggregating a dataset, which respectively assigns an output variable value yi to a plurality of input variable vectors Xi, i=1, . . . , N, into a function term. This ascertaining of a function term is also known as a symbolic regression. Hereinafter, the terms ‘aggregating’ and ‘symbolic regression’ are used interchangeably.
According to an example embodiment of the present invention, in the method, one or more elementary function expression(s) from a given alphabet A is/are sampled with the aid of a neural network developed as a transformer network. These elementary function expressions are assembled into one or more candidate function term(s).
A transformer network, for example, is understood in particular as a neural network in which a reciprocal dependency between all input variables in at least one layer is defined or at least tolerated. Such layers are called “attention layers”. In this way, a transformer network, for example, differs in particular from a convolutional network where preferably the input variables that have a spatial and/or temporal neighborhood relationship are offset against one another through the application of filter cores.
Sampling of function expressions, for example, particularly means that the transformer network generates a probability distribution for the individual elementary function expressions in alphabet A, and elementary function expressions are then sampled (drawn) from this probability distribution. The probability distribution may particularly be a softmax distribution in which the probabilities for all elementary function terms add up to 1.
According to an example embodiment of the present invention, it is checked whether the candidate function term(s) is/are complete. A function term is complete in particular if it is able to be evaluated by inserting concrete values for its input variables and then allocating an output variable value to these values.
In response to a not yet complete candidate function term or function terms, branching back for the sampling of further elementary function is implemented. Thus, further elementary function terms are sampled until the candidate function term(s) is/are complete. For example, it is possible to sample only an arithmetic operation (such as “+”) to begin with. Then, the two summands must also be developed through the further sampling before the function term is complete and can be evaluated.
In response to a complete candidate function term or terms 4, input variables, Xi are mapped to associated candidate output values yi* with the aid of each candidate function term. A deviation between candidate output variable values yi* and corresponding output variable values yi from the dataset are evaluated using a predefined metric.
It is checked whether a predefined abort condition is satisfied. If this is not the case, parameters θ that characterize the behavior of the transformer network are updated with the goal that the renewed sampling of function expressions and the assembling of these expressions into one or more complete candidate function term(s) will most likely improve the then obtained evaluation. Moreover, it is then branched back for the sampling of elementary function expressions with the aid of the transformer network.
The updating of parameters θ, for example, may be carried out by a backpropagation in the transformer network in any desired form, or also by reinforcement learning, for instance.
According to an example embodiment of the present invention, during the renewed sampling of elementary function expressions, it is most often the case that the development of further candidate function terms is started completely anew, that is, without the consideration of already generated candidate function terms. Optionally, however, it is possible to additionally convey to the transformer network one or more elementary function expression(s) of at least one candidate function term and their position in this candidate function term. Thus, the transformer network may build on prior experience, for instance by modifying or supplementing already used candidate function terms. However, the transformer network is not bound to such an approach and even if it receives such prior experience, it may generate a completely new candidate function term for which no relationship with the current candidate function term can be discerned.
On the other hand, if the predefined abort condition is satisfied, then a candidate function term with the best evaluation is ascertained as the desired function term, into which the dataset is aggregated. The abort condition, for example, may particularly include a threshold value or some other criterion for the evaluation of the candidate function term.
It was recognized that precisely the attention layers available in a transformer network give such a network the special ability to develop candidate function terms. The attention layers allow access to the complete candidate function term at all times.
Candidate function terms may particularly be represented in the form of expression trees. In such an expression tree, operators or functions one the hand and operands on the other hand form the nodes. The operands may particularly include variables that are populated with input variable values during the evaluation of the candidate function term, as well as constants. A node that belongs to an operator or a function has as children the particular nodes which belong to the operands that are processed by this operator or this function. Initially, for example, the development of such an expression tree may progress essentially in a depth direction before it stops and resumes at a location considerably higher in the expression tree. This requires precisely the essentially facultative access that the attention layers provide in the transformer network. In comparison, a long short-term memory, LSTM, which may basically also be used in the search for function terms, for example, is more strongly tied to the sequence in which it has sampled the elementary function expressions. For instance, if the expression tree was initially propagated into the depth, the other location where the development is to be continued at a later point may possibly have already disappeared from the time horizon provided by the LSTM of previously sampled elementary function expressions.
In one particularly advantageous example embodiment of the present invention, numerical codes are assigned to the elementary function expressions from the alphabet and also to their positions in the candidate function term. At least one candidate function term is converted into a representation formed from these numerical codes. This representation is conveyed to the transformer network during the sampling in order to be able to develop the candidate function term also in a step-by-step manner. This enables the transformer network to correctly interpret even very deep tree structures semantically and to understand which form element satisfies which particular function at which particular location in the tree in each case. For instance, the numerical codes relating to the elementary function expressions may be merged through summing or concatenating with the numerical codes that relate to the positions in the candidate function term. Prior to the merging, the numerical codes relating to the elementary function expressions are able to be preprocessed, for instance by an embedding layer. With the aid of such an embedding layer, numerical codes are particularly able to be mapped (embedded) in a vector space having a predefined dimension. The numerical codes relating to the positions in the candidate function term are likewise able to be preprocessed by positional encoding before they are merged with the numerical codes for the elementary function terms. After the positional encoding, the numerical codes can particularly encode the position of the respective elementary function term in an expression tree, for example.
In a particularly advantageous manner, the numerical codes thus indicate the positions of the elementary function expressions in the mentioned semantic expression tree.
There are different possibilities for specifying the numerical codes within the semantic expression tree. In an especially advantageous manner, numerical codes are also assigned to non-populated positions in the tree. For example, this may particularly mean that the tree is initially developed down to a predefined maximally possible depth, where each node branches to a predefined number of children during the change from one level to the next. A position may then remain unpopulated, for instance, if a node has two or more children at the next-deepest layer but is populated by a function that expects only a single argument (e.g., sine or cosine). The numerical code of each node depends only on the position of this node in the tree rather than some other content of the tree.
In contrast, if the nodes are consecutively numbered, then only a maximum length of the candidate function term but no maximum depth of the tree must be specified. In return, it will then be more difficult for the transformer network to understand the tree structure.
In a further advantageous example embodiment of the present invention, the numerical codes include vectors that have separate components for the levels of the tree in each case. Thus, if the tree thus has a depth of three, for instance, then the vector has three components. Each component assigned to a level then indicates a direction in which branching took place on the path from the root of the tree to the nodes in the transition to the respective level. For example, if branching to the left of a root node with a numerical code (0, 0, 0) took place to the second level, then this node may receive the numerical code (0, −1, 0), and if branching to the right occurs to the second level, then this node may receive the numerical code (0, 1, 0). In this scheme, neighborhood relationships of nodes are particularly easy to detect for the transformer network. The maximum depth of the tree has to be predefined. If—as in this example—the first component is always 0, then it may optionally also be omitted. A node of a tree having the maximum depth N may thus be represented by an N−1-dimensional vector.
In one particularly advantageous embodiment of the present invention, parameters θ which characterize the behavior of the transformer network are optimized with the goal of improving an evaluation averaged across a plurality or distribution of candidate function terms. Reinforcement learning, in particular, may be used to achieve a progressive improvement despite the non-deterministic character of the sampling.
If it is assumed, for instance, that τ is a candidate function term and Xi is a vector of input variables (x1, . . . , xj), then it will be possible to ascertain a fitness ξ of this candidate function term τ, for example via an average square deviation of the output variable values τ(xi) ascertained using the candidate function term from the predefined output variable values yi:
where σy indicates the standard deviation of output variable values yi. From fitness ξ, a reward R(τ) is able to be defined via
The goal of reinforcement learning is an optimization of parameters θ of the transformer network in such a way that the expected value
J(θ)=τ˜p(τ|θ)[R(τ)]
is maximized via the distribution p(τ|θ) of candidate function terms τ at a given status of parameters θ. For instance, this may be realized via a gradient ascent method
∇θJ(θ)=∇θτ˜p(τ|θ)[R(τ)]=
τ˜p(τ|θ)[R(τ)∇θlog p(τ|θ)].
Since this term is usually unable to be determined analytically, it is possible as an alternative to use an unbiased estimator
for the expected value.
For the symbolic regression, this means that a number of M function terms is sampled by the transformer network using parameters θ. To the extent that these function terms also include constants, they can be optimized with the aid of a constant optimizer. The reward for the terms will then be determined and the gradient is estimated as described in order to update the parameters of the transformer network so that the expected reward is maximized over time. As an alternative or also in combination therewith, for example, a further layer is able to be added to the transformer network with whose aid constants are able to be sampled.
However, the ultimate goal does not consist of increasing the expected value for the reward for all function terms. Instead, it is of interest that the best function term has a high reward. In a further, particularly advantageous embodiment of the present invention, only deviations that stem from a selection of best-evaluated candidate function terms are therefore utilized for updating the parameters. For example, it is possible to specify a threshold value Rε(θ) for the reward and to maximize the term
J(θ;ε)=τ˜p(τ|θ)[R(τ)|R(τ)≥Rε(θ)]
Herein, 1 is the indicator function.
For example, a corresponding generic formalism is provided by Petersen et al. in, “Deep symbolic regression: Recovering mathematical expressions from data via risk-seeking policy gradients”, arXiv: 1912.04871.
When training the transformer network, regularization terms, e.g., an entropy loss, may be used to achieve a higher variance in the terms.
As described above, input variable vectors Xi, and/or output variable values yi, may particularly include measured data that were recorded with the aid of at least one sensor. For example, in particular a large volume of measured data recorded with a high resolution is able to be aggregated into a compact function term. Apart from a mere volume aggregation, this also makes it possible to obtain a better qualitive understanding of the behavior of the output variable as a function of the input variables. For instance, the known laws of gravity may be derived from the results of drop tests in a drop tower.
In a further, particularly advantageous embodiment of the present invention, output variable yi is a measured variable of a first sensor, and the input variable vectors include measured variables of further sensors from which the measured variable of the first sensor can be ascertained at least as an approximation. If it is possible to model the dependency of the measured variable of the first sensor on the measured variables of the further sensors in a satisfactory manner, it will also be possible to omit this first sensor. For instance, a pre-series model in the device development may include all sensors, and on the path to a series model, sensors whose measured variables are also easily derivable from the measured variables of other sensors may successively be omitted. The savings in hardware costs are then multiplied by the number of units of the series production.
In general, the function term ascertained by the method may be utilized to subsequently evaluate further measured data. This is advantageous especially for the data evaluation in a control unit for a vehicle which usually has only limited hardware resources. For this reason, in a further, particularly advantageous embodiment, measured data that were recorded using at least one sensor are mapped as components of input variable vectors with the ascertained function term to output variable values. These output variable values are used to generate an actuation signal. A vehicle is actuated by this actuation signal.
In a further particularly advantageous embodiment of the present invention, alphabet A of the available elementary function expressions is restricted to operators and/or functions that are available on a predefined embedded platform for the evaluation of the ascertained function term. The predefined embedded platform is then set up for the evaluation of the ascertained function term, for instance by loading a corresponding software or some other program. For instance, embedded platforms that are especially energy-efficient at the expense of restricting the available instruction set are available on the market. For example, there are platforms on which only the four basic arithmetic operations are available, and logarithms can be called up from tables, but no exponential function and no trigonometric functions are able to be calculated. The method then supplies the particular function term that approximates the relationship between the input variables and the output variables as best as possible under the marginal condition of the restricted alphabet A.
In a further particularly advantageous embodiment of the present invention, the elementary function expressions of at least one best-evaluated candidate function term as well as their positions in this best-evaluated candidate function term in multiple epochs are conveyed to the transformer network. By storing the best experience in such a way in an epoch-spanning manner, the transformer network is given an even greater incentive for sampling good function terms. This is comparable to the experience replay in reinforcement learning. In this context, it is optionally possible to modify a portion of the reloaded function terms by exchanging old elementary function expressions for newly sampled ones or by expanding the function term by newly sampled elementary function expressions. An exploration may be carried out on this basis with the goal of finding even better function terms.
Sampled function terms may also have simplification potential. For example, the two function terms sin(x+x−x) and sin(x) are identical, but the latter term is simpler and thus should preferably be selected. It is therefore advantageous to propagate not only the candidate function terms but also possible simplifications of these candidate function terms through the transformer network. They may then be treated exactly like other terms in the transformer network. This teaches the transformer network to prefer simple terms.
To achieve higher variability in the function terms and to prevent that the optimization of the parameters of the transformer network leads to a local extreme, it is possible, for instance, to sample elementary function expressions for a certain percentage from a predefined distribution, e.g., an equal distribution, across all elementary function expressions in alphabet A. This percentage can be adapted during the optimization. For example, if the reward on average does not improve across multiple epochs, then the percentage is able to be increased. This increases the chance of jumping out of a local extreme. If the reward improves, on the other hand, the percentage is able to be reduced because the network training obviously seems to go in the right direction.
The method may be computer-implemented, especially in its entirety or in part. The present invention therefore also relates to a computer program including machine-readable instructions that when executed on a computer or on a plurality of computers, induce the computer(s) to execute the described method. In this sense, control units for vehicles and embedded systems for technical systems that are likewise capable of carrying out machine-readable instructions should also be considered computers.
In the same way, the present invention also relates to a machine-readable data carrier and/or to a download product including the computer program. A download product is a digital product that is transmittable via a data network, i.e., a digital product able to be downloaded by a user of the data network, which may be offered for sale in an online shop for an immediate download, for example.
In addition, a computer may be equipped with the computer program, the machine-readable data carrier and/or the download product.
Additional measures improving the present invention will be represented in greater detail in the following text together with the description of the preferred exemplary embodiments with the aid of figures.
In step 110, a function expression or a plurality of function expressions from an alphabet A is/are sampled with the aid of transformer network 1.
In the process, alphabet A according to block 111 is able to be restricted to operators or functions that are available on a predefined embedded platform for the evaluation of ascertained function term 4*.
In step 120, these elementary function expressions 3a-3d are assembled to form one or more candidate function term(s) 4.
According to block 112, numerical codes 6a-6d; 7a-7d are able to be assigned to elementary function expressions 3a-3d from alphabet A as well as their positions 3a #-3d # in candidate function term 4 in each case. According to block 113, at least one candidate function term 4 is then able to be converted into a representation 8 formed from these numerical codes 6a-6d; 7a-7d. According to block 114, this representation 8 may then be conveyed to transformer network 1 during sampling 110 in order to be able to develop candidate function term 4 also in multiple steps of the sampling.
In step 125, it is checked whether the candidate function term(s) 4 is/are complete. If this is not the case (truth value 0), branching back for the sampling 110 of further elementary function expressions then takes place in step 126.
However, if the candidate function term(s) 4 is/are complete (truth value 1), input variables Xi are mapped in step 130 to associated candidate output variable values yi* with the aid of each candidate function term 4.
In step 140, a deviation between candidate output variable values yi* and corresponding output variable values yi from dataset 2 are evaluated using a predefined metric 5.
In step 180, it is checked whether a predefined abort condition is satisfied. If this is not the case,
In the process, according to block 151, parameters θ which characterizes the behavior of transformer network 1 can be optimized with the goal of improving an evaluation 5a averaged across a plurality or distribution of candidate function terms 4.
According to block 152, only deviations that stem from a selection of best-evaluated candidate function terms 4 may be used for updating parameters θ.
Optionally, in step 170, one or more elementary function expression(s) 3a-3d of at least one candidate function term 4 and its/their position(s) 3a #-3d # in this candidate function term 4 may additionally be conveyed to transformer network 1. In the process, for instance, especially the elementary function expressions 3a-3d and also their positions 3a #-3d # are able to be encoded by numerical codes 6a-6d; 7a-7d in the same way as in the original preparation of the complete candidate function term.
According to block 174, elementary function expressions 3a-3d of at least one best-evaluated candidate function term 4 and their positions 3a #-3d # in this best-evaluated candidate function term 4 in a plurality of optimization epochs may be conveyed to transformer network 1.
On the other hand, if the abort condition is satisfied (truth value 1 in step 180), then a candidate function term 4 having the best evaluation 5a is ascertained as the desired function term 4* in step 190 into which dataset 2 is aggregated. If there is a selection from among a plurality of candidate function terms 4 of different complexity, then in particular a less complex candidate function term 4 may be given priority.
In step 210, measured data that were recorded using at least one sensor are mapped as components of input variable vectors Xi with the ascertained function term 4* to output variable values yi.
In step 220, an actuation signal 220a is formed from these output variable values yi.
In step 230, a vehicle 50 is actuated with the aid of this actuation signal 220a.
If alphabet A was restricted to the operators or functions available on a predefined embedded platform according to block 111, then this predefined embedded platform is set up in step 240 for the evaluation of ascertained function term 4*.
Via preprocessing layers 11 and/or 12, elementary function expressions 3a-3d as well as their positions 3a #-3d #, and/or their numerical codes 6a-6d, 7a-7d are processed into an input 1a for transformer network 1. Transformer network 1 includes two multi-head attention layers 13 and 14, which generate an output 1b. This output 1b is combined in an averaging layer 15 and processed into a softmax probability distribution p(δ) for elementary function expressions 6. The next elementary function expression 3a-3d to be added to the function term is drawn from this probability distribution p(δ). This elementary function expression is assigned the position 7e with numerical code 5 in expression tree 9.
According to
In contrast, in
According to
All nodes that are obtained by branching to the left from the root are given the direction −1 in the second component of their numerical code. All nodes that are obtained by branching to the right of the root receive the direction 1 in the second component of their numerical code. For the nodes at the second level of the tree, the third component is still 0 because the third level has not yet been reached.
In an analogous manner, branching to the left in the transition from the second to the third level of the tree leads to an entry −1, and branching to the right leads to an entry 1 in the third component of the numerical code.
Number | Date | Country | Kind |
---|---|---|---|
10 2021 207 936.9 | Jul 2021 | DE | national |