DEVICE FOR AND COMPUTER IMPLEMENTED METHOD OF MACHINE LEARNING

Information

  • Patent Application
  • 20220101196
  • Publication Number
    20220101196
  • Date Filed
    August 19, 2021
    3 years ago
  • Date Published
    March 31, 2022
    2 years ago
  • CPC
    • G06N20/00
  • International Classifications
    • G06N20/00
Abstract
A method of machine learning a model for mapping a dataset to a solution of a task depending on a first parameter. The method includes determining a second parameter for assigning the second parameter to the first parameter in a first iteration of learning and determining a third parameter for determining a rate for changing the first parameter in at least one iteration of learning depending on the third parameter and depending on a measure for evaluating the solution to the task. The determining of the second or third parameter includes determining a solution of an initial value problem that depends on partial derivatives, and determining the second parameter and/or the third parameter depending on at least one of the partial derivatives.
Description
CROSS REFERENCE

The present application claims the benefit under 35 U.S.C. § 119 of European Patent Application No. EP 20198329.3 filed on Sep. 25, 2020, which is expressly incorporated herein by reference in its entirety.


FIELD

The present invention relates to a device for and a computer implemented method of machine learning in particular of a model.


BACKGROUND INFORMATION

In machine learning, a set of parameters of the model is determined in training iterations according to a learning rule. Gradient-based meta learning aims to adapt the learning rule to a set of related tasks. The learning rule describes how the set of parameters changes over training iterations.


Model Agnostic Meta Learning, MAML, is an example for gradient-based meta learning. An example for MAML is described in “Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networks,” which is retrievable from https://arxiv.org/abs/1703.03400.


Gradient-based meta learning methods including MAML use variants of gradient descent to determine the learning rule.


SUMMARY

In accordance with example embodiments of the present invention, a device for and computer implemented method of machine learning uses a learning rule that is a variant of a gradient flow. Gradient descent is a special case of gradient flow. Gradient flow is a gradient descent with infinitesimal step size, or equivalently, gradient descent in continuous-time. With gradient flow, the learning rule is given by an ordinary differential equation, ODE, that describes the change in the parameters of interest over time. Learning with gradient flow is an initial value problem, IVP, i.e., given an initial value for the parameters and an ODE describing the change in the parameters over time, compute the value of the parameters at some future time.


In accordance with an example embodiment of the present invention, the computer implemented method of machine learning a model for mapping a dataset to a solution of a task depending on a first parameter comprises determining a second parameter for assigning the second parameter to the first parameter in a first iteration of learning and determining a third parameter for determining a rate for changing the first parameter in at least one iteration of learning depending on the third parameter and depending on a measure for evaluating the solution to the task, wherein determining the second parameter or third parameter comprises determining a solution of an initial value problem that depends on a derivative of the measure with respect to the first parameter, wherein determining the solution comprises determining a first part of the solution of the initial value problem depending on an initial value, determining a second part of the solution of the initial value problem depending on the first part, determining a partial derivative of the first part, determining a partial derivative of the second part, and determining the second parameter and/or the third parameter depending on at least one of the partial derivatives. This improves the performance of gradient-based meta learning significantly. This method directly improves a machine learning system. Given a set of machine learning tasks, the method aims to make a machine learning system better at learning to solve related tasks.


In accordance with an example embodiment of the present invention, preferably, the method comprises sampling the task from a distribution.


In accordance with an example embodiment of the present invention, preferably, the method comprises sampling a batch of tasks from the distribution, determining a plurality of partial derivatives for the batch of tasks, and determining the second parameter and/or the third parameter depending on the plurality of partial derivatives.


In accordance with an example embodiment of the present invention, preferably, the method comprises determining the partial derivatives with respect to the first parameter, and determining a change of the second parameter depending on a function of the partial derivatives, or determining the partial derivative with respect to the third parameter and determining a change of the third parameter depending on a function of the partial derivatives.


In accordance with an example embodiment of the present invention, preferably, determining the second parameter comprises randomly initializing the initial value in a first step of a plurality of steps of solving the initial value problem.


In accordance with an example embodiment of the present invention, preferably, the third parameter is initialized in the first step of the plurality of steps as a positive scalar or a vector or matrix of positive scalars.


In accordance with an example embodiment of the present invention, preferably, determining the solution of the initial value problem comprises solving the initial value problem with an ordinary differential equation solver according to an explicit Runge-Kutta method, in particular other than the Euler method. Gradient descent is recovered if Euler's method with step size 1 is used to solve this IVP. However, Euler's method is a very basic ODE solver and so it is unlikely to accurately follow the dynamics specified by the learning rule. On the other hand, if a more accurate ODE solver is used to solve the IVP, then the learning rule will be followed more accurately. The idea is that, since the solution to the IVP given by a more accurate ODE solver will follow the learning rule more accurately, it can give more accurate feedback on how the learning rule should be adapted.


In accordance with an example embodiment of the present invention, preferably, the method comprises determining for the task a plurality of parts of the solution of the initial value problem including the first part and the second part, and storing at least a part of the plurality of parts in memory.


In accordance with an example embodiment of the present invention, preferably, determining the plurality of partial derivatives for the task depending on the plurality of parts of the solution of the initial value problem comprises reading a first subset of the plurality of parts of the solution of the initial value problem from memory and determining a second subset of the plurality of parts of the solution of the initial value problem depending on at least one part of the solution of the initial value problem of the first subset. This applies gradient checkpointing for increased memory efficiency. An example of gradient checkpointing is described in “Achieving Logarithmic Growth Of Temporal And Spatial Complexity In Reverse Automatic Differentiation” which is retrievable from https://www.researchgate.net/publication/2550794 Achieving_Logarithmic_Growth_Of_Temporal_And_Spatial_Complexity_In_Reverse_Automatic_Differentiation.


In accordance with an example embodiment of the present invention, preferably, the rate is defined depending on an ordinary differential equation comprising a derivative of a temporal course of the first parameter with respect to time and a partial derivative of a temporal course of the measure with respect to the temporal course of the first parameter.


In accordance with an example embodiment of the present invention, preferably, the method comprises determining in iterations different second parameter and/or third parameter for different batches of tasks sampled from the distribution, wherein the method comprises changing the first parameter after at least one of the iterations according to the second parameter and/or third parameter of the at least one of the iterations.


In accordance with an example embodiment of the present invention, the method may comprise assigning the second parameter to the first parameter in a first iteration, determining the rate for changing the first parameter in the iteration depending on the third parameter, and changing the first parameter in the first iteration and/or a second iteration after the first iteration with the rate.


The device for machine learning the model is configured to perform steps in the method.


Further advantageous embodiments of the present invention are derivable from the description below and the figures.





BRIEF DESCRIPTION OF THE DRAWINGS


FIG. 1 depicts a device for machine learning schematically, in accordance with an example embodiment of the present invention.



FIG. 2 depicts steps in a computer implemented method of machine learning, in accordance with an example embodiment of the present invention.



FIG. 3 depicts the device in an environment, in accordance with an example embodiment of the present invention.





DETAILED DESCRIPTION OF EXAMPLE EMBODIMENTS


FIG. 1 depicts a device 100 for machine learning schematically. The device 100 comprises at least one processor and at least one memory. FIG. 1 depicts an example with a processor 102 and a memory 104. The memory 104 is configured to store computer readable instructions, that when executed by the processor 102, cause the processor 102 to execute steps of a computer implemented method that will be described with reference to FIG. 2 below.


The method is described for a model f(x,θ) for mapping a dataset x to a solution of a task τi depending on a first parameter θ. The task τi defines a dataset x or a means for sampling the dataset x. The task τi defines a measure L for evaluating the solution to the task τi. The measure L may be a norm for evaluating a difference of the solution to the task τi to a reference. The norm is for example a mean square error. For example, measure L could be the square of the distance between a prediction and a target. The measure L(i) may be a performance measure for task τi. It may be a loss function that takes a prediction made by the model f(x,θ) and may return a scalar value. The goal of task τi may be stated as: maximize/minimize the measure L(i). In one example, the tasks τi from the task distribution q(τ) have the same loss function, i.e., L(i)=L for every i.


The method comprises a step 202 of providing a task distribution p(τ), the model f(x;θ) with first parameters θ, second parameters θ0 and a learning rule defining a rate








d

θ


d

t


=

g


(


dL

d





θ


,
θ
,

t
;
γ


)






of change for the first parameters θ depending on third parameters γ.


The learning rule may define the rate in terms of a function of a derivative of the measure L, e.g., with a scalar third parameter γ







g


(



d

L


d

θ


,
θ
,

t
;
γ


)


=


-
γ




d

L


d

θ







or as a vector or matrix of such third parameter γ







g


(



d

L


d

θ


,
θ
,

t
;
γ


)


=


-

diag


(
γ
)






d

L


d

θ







The learning rule defines the rate depending on an ordinary differential equation, ODE.


In the example, the ODE is








d


θ


(
t
)




d

t


=


-
γ







L

(
i
)




(


x

(
i
)


,

θ


(
t
)



)






θ


(
t
)









The ordinary differential equation comprises a derivative of a temporal course of the first parameter θ(t) with respect to time t and a partial derivative of a temporal course of the measure L(i)(x(i),θ(t)) for the task τi with respect to the temporal course of the first parameter θ(t).


The method comprises a step 204 of meta learning.


Meta learning comprises determining in iterations different second parameter θ0 and/or third parameter γ for different batches of tasks τ12, . . . , τn˜p(τ) that are sampled from the distribution p(τ).


The method may comprises changing the first parameter θ after at least one of the iterations according to the second parameter θ0 and/or third parameter γ of the at least one of the itrations.


For an iteration of meta learning, the method comprises a step 204-1 of sampling a batch of tasks τ12, . . . , τn˜p(τ) from the task distribution p(τ).


For a tasks τi of the batch of tasks τ12, . . . , τn˜p(τ) the method comprises a step 204-2 of task learning.


The step 204-2 comprises performing T steps 204-2a of solving an IVP. In an example the initial value problem is








θ


(
T
)



(
i
)


=


θ


(
0
)


+



0
T




g


(



d


L

(
i
)




d

θ


,
θ
,

t
;
γ


)



dt







with a higher-order ODE solver than Euler's method.


The solution of the IVP depends on a derivative of the measure L with respect to the first parameter θ







d


L

(
i
)




d

θ





Determining the solution comprises determining a first part of the solution of the initial value problem depending on an initial value θ(0). The initial value θ(0) may be randomly initialized in a first step of the plurality T of steps for the tasks τi.


The third parameter γ is initialized in the first step of the plurality T of steps as a positive scalar or a vector or matrix of positive scalars. In an example, the scalar is, e.g., 0.01.


For the task τi the initial value is θ(0)(i). When two steps are used, i.e for T=2, this corresponds to θ(T−1)(i).


Determining the solution comprises determining a second part of the solution of the initial value problem depending on the first part.


When two steps are used, i.e., for T=2 the second part of the solution is θ(1)(i) and corresponds to θ(T)(i).


For two tasks, i.e., for i=2, and when the Euler method with a step size 1 is used to approximate the solution of the IVP, then the following T parts are calculated:








θ


(
0
)



(
1
)


=

θ
0









θ


(
1
)



(
1
)


=



θ


(
0
)



(
1
)


+

g


(



d


L

(
1
)




d



θ


(
0
)



(
1
)




,


θ


(
0
)



(
1
)


,

0
;
γ


)















θ



(
T
)


(
1
)



=




θ


(

T
-
1

)



(
1
)


+


g


(



d


L

(
1
)




d



θ


(

T
-
1

)



(
1
)




,


θ


(

T
-
1

)



(
1
)


,


T
-
1

;
γ


)









θ


(
0
)



(
2
)




=



θ
0








θ


(
1
)



(
2
)



=



θ


(
0
)



(
2
)


+

g


(



d


L

(
2
)




d



θ


(
0
)



(
2
)




,


θ


(
0
)



(
2
)


,

0
;
γ


)


















θ


(
T
)



(
2
)


=



θ


(

T
-
1

)



(
2
)


+

g


(



d


L

(
2
)




d



θ


(

T
-
1

)



(
2
)




,


θ


(

T
-
1

)



(
2
)


,


T
-
1

;
γ


)







Here, θ(1)(0), θ(1) (1), . . . , θ(1)(T), θ(2)(0), θ(2)(1), . . . , θ(2)(T) are all intermediate values in a calculation of a meta loss Lmeta.


In one example a plurality of parts of the solution of the IVP including the first part and the second part are calculated for the task τi.


The solution of the IVP may be determined with an ordinary differential equation solver according to an explicit Runge-Kutta method, in particular other than the Euler method.


The step 204-2 comprises a step 204-2b of computing the meta loss







L

m

e

t

a


=



i




L

(
i
)




(


θ


(
T
)



(
i
)


)







The meta loss Lmeta is determined depending on the plurality of parts of the solution of the IVP for different task τi of the batch of tasks τ12, . . . , τn.


In one aspect, at least a part of the plurality of parts is stored in memory. To save memory, a part of the plurality of parts is stored in memory and another part of the plurality of parts is used for determining the solution but not stored in memory for later usage.


In the example, the meta loss Lmeta is determined for the tasks τi of the batch of tasks τ12, . . . , τn˜p(τ). This is referred to as a forward propagation.


The step 204-2 comprises a step 204-2c of computing partial derivatives of the meta loss Lmeta with respect to meta parameters. In the example, the second parameter θ0 and the third parameter γ are the meta parameters. In the example the partial derivative of the meta loss Lmeta with respect to the second parameter θ0 is







d


L

m

e

t

a




d


θ
0






In one example, this can be determined by










L

m

e

t

a






θ
0



=






L

m

e

t

a







L

(
1
)




(


θ

(
1
)




(
T
)


)










L

(
1
)




(


θ

(
1
)




(
T
)


)







θ

(
1
)




(
T
)










θ

(
1
)




(
T
)







θ

(
1
)




(

T
-
1

)




















θ

(
1
)




(
1
)







θ

(
1
)




(
0
)










θ

(
1
)




(
0
)






θ
0




+




L

m

e

t

a







L

(
2
)




(


θ

(
2
)




(
T
)


)
















L

(
2
)




(


θ

(
2
)




(
T
)


)







θ

(
2
)




(
T
)










θ

(
2
)




(
T
)







θ

(
2
)




(

T
-
1

)




















θ

(
2
)




(
1
)







θ

(
2
)




(
0
)










θ

(
2
)




(
0
)






θ
0







In the example the partial derivative of the meta loss Lmeta with respect to the third parameter γ is







d


L

m

e

t

a




d

γ





This is referred to backpropagation. In one aspect, this step may comprise reading the plurality of parts of the IVP from memory.


The backpropagation may use checkpointing.


This means that determining the plurality of partial derivatives for the task τi depending on the plurality of parts of the solution of the IVP comprises reading a first subset of the plurality of parts of the solution of the IVP from memory and determining a second subset of the plurality of parts of the solution of the IVP depending on at least one part of the solution of the IVP of the first subset.


This means, a plurality of partial derivatives is determined for the batch of tasks τ1, τ2, . . . , τn.


In one aspect, the partial derivatives are determined with respect to the first parameter θ. In this aspect, a change of the second parameter θ0 is determined depending on a function, e.g., a sum, of these partial derivatives.


In one aspect, the partial derivatives are determined with respect to the third parameter γ. In this aspect, a change of the third parameter γ is determined depending on a function, e.g., a sum, of these partial derivatives.


The step 204-2 comprises a step 204-2d of updating the meta parameters using these partial derivatives of Lmeta, e.g.,








d


L
meta



d


θ
0



,



d


L
meta



d

γ


.





The second parameter θ0 is in one example determined depending on at least one of the partial derivatives with respect to the second parameter θ0. The third parameter γ is in one example determined depending on at least one of the partial derivatives with respect to the third parameter γ.


The second parameter θ0 or the third parameter γ may be determined depending on a plurality of partial derivatives.


The method comprises a step 206 of returning the adapted meta parameters. In the example, the second parameter θ0 and the third parameter γ are returned.


The method may comprise a step 208 of determining the rate








d

θ


d

t


=

g


(


dL

d





θ


,
θ
,

t
;
γ


)






depending on the meta parameters, in the example the second parameter θ0 and the third parameter γ.


The method may end after the second parameter θ0 and/or the third parameter γ are returned. The method may end after determining the rate








d

θ


d

t


.




The method optionally comprises a step 210 and several iterations of a step 212.


The step 210 comprises assigning the second parameter θ0 to the first parameter θ in a first iteration t of learning.


The step 212 comprises changing the first parameter θ after the first iteration depending on the rate








d

θ


d

t


=


g


(


dL

d





θ


,
θ
,

t
;
γ


)


.





The step 212 may be repeated for a fixed amount of iterations.



FIG. 3 depicts the device 100 in an environment 300. The environment 300 comprises at least one sensor 302 and at least one actuator 304. The at least one sensor 304 in one example is configured to measure or detect physical or chemical characteristic of the environment 300. The at least one sensor 302 in one example is configured to output the dataset x or parts thereof depending on at least one physical or chemical characteristic of the environment 300 measured or detected by the at least one sensor 302. The at least one sensor 302 is in one example configured to output data for a measured or detected characteristic of one or more of the following types:


a digital image, e.g., video, radar, LiDAR, ultrasonic, motion, or thermal image of the environment 300 or a subject or object therein;


a scalar time series, e.g., of a temperature in the environment 300 or another operating variables of a machine or another apparatus in the environment 300;


an audio signal in the environment 300.


The processor 102 is in one example configured for classifying the data from the at least one sensor 302, for detecting a presence of objects in this data or for performing a semantic segmentation on this data, e.g., regarding traffic signs, road surfaces, pedestrians or vehicles in particular in the environment 300.


The processor 102 may be configured for supervised learning and reinforcement learning. The at least one processor 102 may be configured for an unsupervised anomaly detection setting. This means the processor 102 may be configured to detect anomalies. More specifically, the method described above may be used to adapt a learning strategy of an anomaly detection model to a given set of anomaly detection tasks. For example, suppose one had a set of related anomaly detection tasks, e.g., audio recordings from a set of somewhat related microphones, and an anomaly detection model, e.g., an autoencoder. Then the method is used to adapt the learning rule used to train this autoencoder such that it learns to detect anomalies in recordings from similar microphones faster and/or with greater sample-efficiency than it would otherwise.


The at least one actuator 304 is in one example configured to perform or cause an action in the environment 300. For example, the processor 102 is configured for classifying the data from the at least one sensor 302, for detecting the presence of objects and to control the action in the environment 300 according to a type or position of an object that is present in the environment 300. The device 100 may be configured to control an at least partial autonomous vehicle according to the type or position of the object.


The device 100 comprises in this aspect at least one interface 306 that is configured to interact with the at least one sensor 302 and/or the at least one actuator 304.


Likewise, the device may be adapted to compute a control signal for controlling any other physical system, like, e.g., a computer-controlled machine, like a robot, a vehicle, a domestic appliance, a power tool, a manufacturing machine, a personal assistant or an access control system.


Likewise, the device may be adapted to compute a control signal for controlling a system for conveying information, like a surveillance system or a medical (imaging) system.


To this end, a suitable set of related tasks may be provided, e.g., by an expert. The method described above may be executed for this set of related tasks to improve the learning rule used by, for example, the computer-controlled machine or the surveillance system.

Claims
  • 1. A computer implemented method of machine learning a model for mapping a dataset to a solution of a task depending on a first parameter, the method comprising the following steps: determining a second parameter for assigning the second parameter to the first parameter in a first iteration of learning; anddetermining a third parameter for determining a rate for changing the first parameter in at least one iteration of learning depending on the third parameter and depending on a measure for evaluating the solution to the task;wherein the determining of the second parameter or third parameter includes determining a solution of an initial value problem that depends on a derivative of the measure with respect to the first parameter;wherein the determining of the solution of the initial value problem includes determining a first part of the solution of the initial value problem depending on an initial value, determining a second part of the solution of the initial value problem depending on the first part, determining for the first part a partial derivative, determining for the second part a partial derivative, and determining the second parameter and/or the third parameter depending on at least one of the partial derivatives.
  • 2. The method according to claim 1, further comprising: sampling the task from a distribution.
  • 3. The method according to claim 2, further comprising: sampling a batch of tasks from the distribution;determining a plurality of partial derivatives for the batch of tasks; anddetermining the second parameter or the third parameter depending on the plurality of partial derivatives.
  • 4. The method according to claim 2, further comprising: determining the partial derivatives with respect to the first parameter, and determining a change of the second parameter depending on a function, the function being a sum of the partial derivatives; ordetermining the partial derivative with respect to the third parameter and determining a change of the third parameter depending on a function, the function being a sum of the partial derivatives.
  • 5. The method according to claim 1, wherein the determining of the second parameter includes randomly initializing the initial value in a first step of a plurality of steps of solving the initial value problem.
  • 6. The method according to claim 5, wherein the third parameter is initialized in the first step of the plurality of steps as a positive scalar or a vector or matrix of positive scalars.
  • 7. The method according to claim 1, wherein the determining of the solution of the initial value problem includes solving the initial value problem with an ordinary differential equation solver according to an explicit Runge-Kutta method other than the Euler method.
  • 8. The method according to claim 1, further comprising: determining for the task a plurality of parts of the solution of the initial value problem including the first part and the second part, and storing at least a part of the plurality of parts in memory.
  • 9. The method according to claim 8, wherein the determining of the plurality of partial derivatives for the task depending on the plurality of parts of the solution of the initial value problem includes reading a first subset of the plurality of parts of the solution of the initial value problem from memory and determining a second subset of the plurality of parts of the solution of the initial value problem depending on at least one part of the solution of the initial value problem of the first subset.
  • 10. The method according to claim 1, wherein the rate is defined depending on an ordinary differential equation including a derivative of a temporal course of the first parameter with respect to time and a partial derivative of a temporal course of the measure with respect to the temporal course of the first parameter.
  • 11. The method according to claim 1, further comprising: determining in iterations different second parameter and/or third parameter for different batches of tasks sampled from the distribution;wherein the method further comprises changing the first parameter after at least one of the iterations according to the second parameter and/or third parameter of the at least one of the iterations.
  • 12. The method according to claim 1, further comprising assigning the second parameter to the first parameter in a first iteration, determining the rate for changing the first parameter in the first iteration depending on the third parameter, and changing the first parameter in the first iteration and/or a second iteration after the first iteration with the rate.
  • 13. A device for machine learning a model for mapping a dataset to a solution of a task depending on a first parameter, the device configured to: determine a second parameter for assigning the second parameter to the first parameter in a first iteration of learning; anddetermine a third parameter for determining a rate for changing the first parameter in at least one iteration of learning depending on the third parameter and depending on a measure for evaluating the solution to the task;wherein the determination of the second parameter or third parameter includes determining a solution of an initial value problem that depends on a derivative of the measure with respect to the first parameter;wherein the determination of the solution of the initial value problem includes determining a first part of the solution of the initial value problem depending on an initial value, determining a second part of the solution of the initial value problem depending on the first part, determining for the first part a partial derivative, determining for the second part a partial derivative, and determining the second parameter and/or the third parameter depending on at least one of the partial derivatives.
  • 14. A non-transitory computer-readable medium on which is stored a computer program for machine learning a model for mapping a dataset to a solution of a task depending on a first parameter, the computer program, when executed by a computer, causing the computer to perform the following steps: determining a second parameter for assigning the second parameter to the first parameter in a first iteration of learning; anddetermining a third parameter for determining a rate for changing the first parameter in at least one iteration of learning depending on the third parameter and depending on a measure for evaluating the solution to the task;wherein the determining of the second parameter or third parameter includes determining a solution of an initial value problem that depends on a derivative of the measure with respect to the first parameter;wherein the determining of the solution of the initial value problem includes determining a first part of the solution of the initial value problem depending on an initial value, determining a second part of the solution of the initial value problem depending on the first part, determining for the first part a partial derivative, determining for the second part a partial derivative, and determining the second parameter and/or the third parameter depending on at least one of the partial derivatives.
Priority Claims (1)
Number Date Country Kind
20198329.3 Sep 2020 EP regional