The present application claims priority to the Japanese patent application identified as 2011-277384, filed on Dec. 19, 2011, and entitled “Matrix Storage Method for System Identification, Program Product, and System,” the disclosure of which is incorporated by reference herein in its entirety.
The field relates generally to system identification based on a parametric model, and more specifically to a matrix storage method for system identification based on a systems model.
Hitherto, in system identification based on a parametric model, an objective function for parameter estimation including a prediction error is constituted, and a process of deciding parameters to minimize the objective function is performed. The objective function that is most normally used is a quadratic function. In this case, the process of deciding parameters to minimize the objective function is called “least-squares method estimation.”
Parameters to be identified are defined as x=(x1, . . . , xm) and plant models are defined as {circumflex over (ƒ)}(x).
A problem of deciding parameters using the least-squares method is defined by the following expression as a problem of deciding parameters which allow square error ε2 with respect to observation values ƒi(i=1, . . . , n) to be minimized. Here, m and n are natural numbers and m<n is satisfied:
Then, it is a problem of identifying m parameters on the basis of the following m simultaneous equations obtained by performing partial differentiation on the square error ε2 by using the individual parameters. The simultaneous equations are defined as normal equations where
Thus, the problem to be solved by using the least-squares method is defined as follows:
Here, the following expression is obtained when terms of partial differentiation are expressed by matrix A:
A
T
A·Δ
x
=A
Tε.
When this expression is transformed by replacing Δx by {circumflex over (θ)}, the following expression is obtained:
{circumflex over (θ)}=(ATA)−1ATε
where ε is the difference between observation value ƒi and plant model {circumflex over (ƒ)}(x) and {circumflex over (θ)} is the estimated value of the parameter to be identified.
Particularly, in the least-squares method, it is known that the term ATA of the following matrix is a sparse matrix. Here, it is assumed that matrix A is an m×m matrix, aij represents an ij element of matrix A, and n represents the number of measurements.
Generally, a person who performs modeling is different from a person who writes analysis code. Thus, studies of how to efficiently perform calculation when sparse matrix ATA is given have been made. However, the form of a sparse matrix significantly varies or properties thereof locally vary in individual object problems, and thus it is necessary to perform a process of determining a storage scheme by testing some storage schemes at the time of calculation or to perform an experiment for determining a storage scheme in advance. Also, since the same storage scheme is selected for the entire sparse matrix ATA, it is difficult to efficiently store the sparse matrix.
With the above-described techniques according to the related art, however, it is impossible to take information about a systems model into consideration when storing values in a sparse matrix, and thus a resulting sparse matrix is not adequate from the viewpoint of increasing calculation speed.
Accordingly, embodiments of the invention provide a technique of efficiently storing values in a sparse matrix which is used in the least-squares method for calculating parameters for system identification in order to increase calculation speed, by taking information about a systems model into consideration.
Observation is composed of a plurality of elements. The elements of observation are subsets of observation each being composed of a different group of and a different number of parameters. Thus, in a system according to embodiments of the invention, a sparse matrix used for the least-squares method is divided into small matrices in accordance with the number of elements of observation.
On the other hand, an observation ID is assigned to each element of observation, a parameter ID is assigned to each parameter, and these IDs are associated with parameters of elements in ID mapping. In the system according to an embodiment of the invention, the positions of nonzero elements are determined in accordance with whether or not ID mapping exists, the correspondence between the observation ID and the parameter ID, and the positions of small matrices, and the storage scheme for each small matrix is selected based thereon.
The storage schemes available here include CSR, ELL, DIA, BSR, COO, and DNS. The system according to an embodiment of the invention selects a storage scheme in accordance with conditions, such as whether or not a target element is a diagonal element, whether or not a term decided without ID mapping exists, and whether or not the same ID mapping is referred to.
The system according to an embodiment of the invention selects a storage scheme in this way and stores elements in a matrix, and then performs calculation using a known method, such as the SCG method, thereby obtaining values of parameters.
In embodiments of the invention, elements are stored in a sparse matrix which is used in the least-squares method for calculating parameters for system identification by taking information about a systems model into consideration, and thereby an effect is obtained in which calculation speed of calculating parameters for system identification is increased.
These and other embodiments of the invention will become apparent from the following detailed description of illustrative embodiments thereof, which is to be read in connection with the accompanying drawings.
Hereinafter, an embodiment of the invention will be described with reference to the drawings. Unless otherwise noted, the same reference numerals denote the same objects throughout the drawings. Note that the description given below is of an embodiment of the invention, and it is not intended to limit the invention to that described below or that shown in one or more of the drawings.
Although not individually illustrated, an operating system is stored in the HDD 108 in advance. The operating system may be an arbitrary operating system compatible with the CPU 104, such as Linux™, Windows XP™ or Windows™ 7 by Microsoft Corporation, or Mac OS™ by Apple Inc.
Furthermore, observation data 204 for performing system identification, ID mapping data 206 indicating the correspondence between observation and parameters, a matrix storage routine 208, and a parameter calculation routine 210 based on a stored matrix are stored in the HDD 108. The matrix storage routine 208 and the parameter calculation routine 210 can be created by using an arbitrary existing programming language, such as Java®, C, C++, or C#. The details of these parameters and processing routines will be described below with reference to
The keyboard 110 and the mouse 112 are used to perform operations or to input characters in the operating system or a main program 202 which is loaded from the HDD 108 to the main storage 106 and is displayed on the display 114.
The display 114 is preferably a liquid crystal display. A display having an arbitrary resolution, such as XGA (a resolution of 1024×768) or UXGA (a resolution of 1600×1200), may be used, for example. Although not illustrated, the display 114 is used to display an operation window for starting a process according to an embodiment of the invention, a parameter calculation result, etc.
Next, a logical configuration of a process according to an embodiment of the invention will be described with reference to the functional block diagram in
In
The observation data 204 holds observation data in the form illustrated in
Each element is associated with a set of parameters and a function which gives an observation value. For example, element j1 is associated with parameters Pik={p11, . . . , P1N1} and function ƒ(Pik).
Here, multiplicity corresponds to the number of objects to be measured with the corresponding parameters. For example, when the parameters are (x, y) coordinates, multiplicity M means that there is a set of M parameters (x1, y1), (x2, y2), . . . , and (xM, yM).
With the elements j1, j2, and j3, θi, is calculated using the following expression:
Regarding the ID mapping data 206, a parameter ID is assigned to each parameter set used for observation, an ID is assigned to each of the above-described m observations, and, as illustrated in
A sparse matrix ATA used for calculation with the least-squares method is divided in the manner illustrated in
The following types of storage schemes may be used in embodiments of the invention:
Compressed Sparse Row (CSR)
A storage scheme in which a sparse matrix is scanned in a row direction and zero elements are omitted. Values of nonzero elements, column numbers of stored nonzero elements, and start positions in individual rows are stored.
ELLPACK/ITPACK (ELL)
The size of one side of a sparse matrix is represented by n, and the maximum number of nonzero elements per row in the sparse matrix is represented by k, and the sparse matrix is stored in a dense matrix of nk. When the number of nonzero elements per row is smaller than k, zero is padded.
Diagonal (DIA)
Values of nonzero diagonal elements, and the offset of each diagonal from the principal diagonal are stored.
Block Sparse Row (BSR)
A sparse matrix is divided into partial matrices (called blocks), each having a size of r×c. With a procedure similar to CSR, nonzero blocks each having at least one nonzero element are stored. All the elements of the nonzero blocks are stored, and block column numbers of the nonzero blocks and start positions of block rows are stored.
Coordinate (COO)
Values of nonzero elements, row numbers, and column numbers are stored for individual nonzero elements.
Dense (DNS)
A storage method for a dense matrix. A sparse matrix is stored as an array.
The parameter calculation routine 210 has a function of calculating parameters for system identification by using the stored matrix data 212 and storing the calculated parameters as parameter data 214 in, preferably, the HDD 108. Preferably, the parameter calculation routine 210 calculates parameters by solving the following expression using a scaled conjugate gradient (SCG) method:
{circumflex over (θ)}=(ATA)−1ATε
where ε is the difference between observation value ƒi and plant model {circumflex over (ƒ)}(x) and {circumflex over (ƒ)} is the estimated value of parameter to be identified. A specific calculation algorithm for this will be described below.
Next, a process of the matrix storage routine 208 will be described with reference to the flowchart in
Referring back to
In step 602, the matrix storage routine 208 determines whether or not a target small matrix is a diagonal element, that is, on the principal diagonal. If the target small matrix is a diagonal element, the matrix storage routine 208 determines in step 604 whether or not ID mapping exists.
Here, a case where ID mapping does not exist is a case where, as illustrated in
On the other hand, a case where ID mapping exists is a case where, as illustrated in
If ID mapping exists, in step 606, the matrix storage routine 208 generates N rows×N columns of blocks at the position of offset M from the principal diagonal, selects BSR or DIA in accordance with user setting, and stores elements. Here, M represents the value of a parameter index, and corresponds to M1, M2, and M3 in
If ID mapping does not exist, in step 608, the matrix storage routine 208 determines that there is a dense matrix (DNS) of N rows×N columns, and stores elements.
If it is determined in step 602 that the target small matrix is not a diagonal element, the matrix storage routine 208 generates NL×NR blocks in step 610. Here, NL and NR are the numbers of parameters defined by a left element and a right element of matrix multiplication, respectively, in an off-diagonal element.
In step 612, the matrix storage routine 208 determines whether or not a value decided without ID mapping exists. Here, a case where a value decided without ID mapping exists is the case illustrated in
If a value decided without ID mapping exists, the matrix storage routine 208 stores a dense matrix in step 614.
If a value decided without ID mapping does not exist, the matrix storage routine 208 determines in step 616 whether or not the same ID mapping is referred to.
A case where the same ID mapping is referred to is the case illustrated in
A case where different ID mappings are referred to is the case illustrated in
If it is determined that the same ID mapping is referred to, the matrix storage routine 208 determines in step 618 that the block is on the principal diagonal, and selects BSR or DIA in accordance with user setting.
If the same ID mapping is not referred to (the case illustrated in
Next, an algorithm of the SCG method executed by the parameter calculation routine 210 will be described. This algorithm is based on, for example, Hayami and Harada, “The use of the scaled conjugate gradient algorithm on vector processors”, research reports of Information Processing Society of Japan, high-performance computing (HPC), Vol. 1986, No. 40 (1986-HPC-017) pp. 1-6, 1986, which is incorporated by reference herein.
Here, when A represents a sparse matrix, x represents a parameter vector to be obtained, and b represents an observation value vector, linear simultaneous equations Ax=b are obtained. Then, scaling is performed by using diagonal terms of the matrix A, and the conjugate gradient method (CG method) is applied. For this purpose, an initial value is given first in the following expressions:
Next, x is updated by repeating the following expressions, and calculation stops when convergence is reached. In the following expressions, the form (A, B) is defined as calculating the inner product of vector A and vector B.
When calculation converges, the parameter calculation routine 210 writes parameters as a calculation result, which is the parameter data 214, onto the HDD 108, preferably. The parameter calculation routine 210 may use an arbitrary method for calculating simultaneous linear equations in which a certain convergence speed can be expected, such as an Incomplete Cholesky Conjugate Gradient (ICCG) method or a modified ICCG (MICCG) method, other than the SCG method.
The invention has been described above in accordance with a specific embodiment. The invention, however, is not limited solely to the particular embodiment described above and shown in the drawings. One of ordinary skill in the art will readily appreciate that various modifications can be considered within the scope of the technical spirit of the invention. For example, the size of a matrix and the number of parameters may be arbitrarily set, and also the hardware of a computer being used may have an arbitrary available platform and architecture.
Number | Date | Country | Kind |
---|---|---|---|
JP2011-277384 | Dec 2011 | JP | national |