The two stages adaptive training method of Mental imagery brain-computer interface
Technical field
It is mutually adapted problem the present invention relates to the man-machine training process of brain-computer interface, is connect for Mental imagery type brain machine
A kind of adaptive training method of mouth.
Background technique
There is be mutually adapted between the user and brain machine interface system of brain-computer interface.In man-machine training process
In, the characteristics of brain machine interface system constantly collects data and adapts to user by the method for machine learning, and user passes through observation
The feedback of brain machine interface system adjusts the activity in brain actively also to adapt to the working method of brain-computer interface.Brain-computer interface user
Being mutually adapted between brain machine interface system is a dynamic process.User feedback is not considered when collecting training data, only
Carry out machine learning on a static training set, it is not consistent with this characteristic of brain-computer interface, it is unfavorable for improving brain machine
The performance of interface.
Summary of the invention
In view of this, the purpose of the present invention is the brain-computer interface for Mental imagery type provides, one kind is man-machine to be mutually adapted
Training method.The man-machine training process of Mental imagery brain-computer interface is divided into two stages by the present invention, and previous stage is single letter
Appoint the stage, the latter half is mutual trusted phase.In single trusted phase, brain machine interface system trust data, using incremental learning
Method constantly updates classifier with new data.In mutual trusted phase, brain machine interface system trust data and classifier simultaneously allow two
Person is mutually adapted.
The present invention is realized using under type: a kind of two stages adaptive training method of Mental imagery brain-computer interface, including
Following steps:
Step S1: this step is in single trusted phase, and Mental imagery brain machine interface system trust data is updated with data and divided
Class device;When initial, user carries out the Mental imagery of multiple trial, and system online acquisition sample obtains one using LDA/QR algorithm
A preliminary transfer matrix G, and classification center vector set C is calculated, form preliminary classification device;User carries on Mental imagery,
System obtains new samples with the Mental imagery of classifier online recognition user and to user feedback;Whenever completion one
Trial, system updates transfer matrix G using ILDA/QR algorithm, and calculates classification center vector set C, forms new classifier simultaneously
It is used for the identification and feedback of next trial, is terminated until the stage;
Step S2: this step is in mutual trusted phase, Mental imagery brain machine interface system while trust data and classifier,
The two is allowed to be mutually adapted;When initial, system uses the Mental imagery of the finally obtained classifier online recognition user of step S1 simultaneously
To user feedback;After user carries out a certain number of trial, system is used using optimum seeking method screening new samples are mutually trusted
LDA/QR algorithm or ILDA/QR algorithm update transfer matrix G, and calculate classification center vector set C, form new classifier and incite somebody to action
For it is next identification and feedback, until man-machine training terminates.
Further, the step S1 specifically includes the following steps:
Step S11: user carries out the Mental imagery of multiple trial, system online acquisition signal, every a time interval
A segment signal is intercepted, m dimensional feature vector is converted into through feature extraction, is denoted as x;
Step S12: all feature vectors obtained in the step S11 construct data matrix A, and according to classification number
K structural matrix E;
Step S13: LDA/QR algorithm is executed, obtains optimal transfer matrix G, and class center vector collection C, shape is calculated
At preliminary classification device;
Step S14: user carries out the Mental imagery of a trial;System online acquisition EEG signals, every a time
Interval one segment signal of interception is converted to feature vector x through feature extraction, identifies x with classifier, controlled according to recognition result movement
Object is to user feedback;
Step S15: executing ILDA/QR algorithm, updates transfer matrix G, then updates data matrix A, and calculate class center
Vector set C forms new classifier;
Step S16: this stage terminates;Otherwise, new classifier is used for the identification and feedback of next trial, returns to step
Rapid S14.
Further, the step S2 specifically includes the following steps:
Step S21: setting mark flag is 0, and construction container is for storing k type games imagination sample;
Step S22: user carries out the Mental imagery of a trial;System online acquisition EEG signals, every a time
Interval one segment signal of interception is converted to feature vector x through feature extraction, identifies x with classifier, controlled according to recognition result movement
Object is to user feedback;
Step S23: at the end of current trial, if controll plant hits the mark, all samples of the trial is stored in and are held
Device, and record the trial and hit the mark the spent time;
Step S24: if trial number is not up to adaptive updates condition, return step S22;Otherwise, system uses mutual trust
Optimum seeking method is appointed to screen new samples;
Step S25: if flag is equal to 0, constructing data matrix A, according to classification number k structural matrix E, executes LDA/QR and calculates
Method obtains new transfer matrix G, and setting flag is 1;Otherwise, it executes ILDA/QR algorithm and updates transfer matrix G, and more new data
Matrix A;
Step S26: being calculated new class center vector collection C according to transfer matrix G and data matrix A, forms new point
Class device, and empty container;
Step S27: man-machine training terminates;Otherwise, return step S22.
Further, mutual trust optimum seeking method described in step S24 comprises the steps of:
Step S41: according to hitting the mark, the spent time screens trial;With the corresponding consuming of trial all in container
Time one preliminary set of composition, finds out the minimum consuming time, other consuming times exist using the minimum consuming time as symmetry axis
Its symmetric position generates a virtual time, and all virtual times are added to preliminary set and form reference set, calculates reference set
The standard deviation of conjunction is chosen and expends the time less than the minimum trial for expending the sum of time and standard deviation;
Step S42: with the method Screening Samples of supporting vector;All sample standard deviations corresponding to the trial that step S41 chooses
Candidate samples collection is added, the training on candidate samples collection, chooses those samples for being confirmed as supporting vector with SVM;
Wherein, the trial indicates an experimental considerations unit in the man-machine training process of Mental imagery brain-computer interface;trial
When beginning, brain machine interface system gives a target at random;User's imagination of launching a campaign is tried hard to the mobile controll plant of target, brain
Machine interface system determines the direction of practical movement controll plant by identifying the type of Mental imagery;When controll plant hits mesh
Mark or time-out, trial terminate.
Further, the method for construction described in step S12 and S25 or update data matrix A are as follows:
Data matrix A=[x1,x2,…,xn]=[A1,…,Ak]∈Rm×n, xi∈Rm×1I=1 ..., n indicates a m dimension
Sample point, n sample point is shared in A;M is determined by feature extracting method, is fixed and invariable in system operation;n
It is that dynamic increases in system operation;Each sample block matrixWhat is indicated is the i-th class
The set of all sample points shares k classification, niI=1 ..., k indicate the number of samples of the i-th class,
Further, according to classification number k structural matrix E's described in step S12 and S25 method particularly includes:
MatrixWherein
Further, the input of the LDA/QR algorithm is data matrix A ∈ Rm×nWith E ∈ Rn×k, export as transfer matrix
G∈Rm×k;
Specifically includes the following steps:
Step S31: the economic QR for calculating A is decomposed, A=QR, Q ∈ Rm×n, R ∈ Rn×n, wherein Q is to arrange orthogonal, R right and wrong
Unusual;
Step S32: one lower triangular linear system R of solutionTH=E, solution obtain H;
Step S33: G, G=QH is calculated.
Further, the input of the ILDA/QR algorithm is column orthogonal matrix Q, optimal transfer matrix G and new sample
Eigen vector x and its classification l export column orthogonal matrix Q and transfer matrix G for update;
Specifically includes the following steps:
Step S41: r=Q is calculatedTX,Q=[Q (x-Qr)/α];
Step S42: r=-G is calculatedTX, r (l)=r (l)+1, r=r/ α, G=G+Q (:, n+1) rT。
Further, the calculation method of the classification center vector set C are as follows: the data matrix A of existing known class and
Transfer matrix G calculates P=ATG,Wherein pj∈R1×kJ=1 ..., n indicates every in data matrix A
The corresponding projection result of one sample point, Pi∈R1×kI=1 ..., that k is indicated is all p for belonging to the i-th classjSet;It calculates
The center C of each classi∈R1×k,Obtaining class center vector collection is
Further, the specific classification method of the classifier are as follows: sample to be determined is characterized vector x, calculates di=| |
xTG-Ci||2I=1 ..., k select the smallest di, feature vector x is determined as corresponding classification.
The user of brain-computer interface both needs to allow before using brain machine interface system phase by a personal-machine training process
Coadaptation.The state of user is not static constant in this process, feedback procedure of the user in observation brain machine interface system
In adjust the state of itself constantly to adapt to the working method of brain-computer interface.The matter of the collected data set of brain machine interface system
Amount is the variation with User Status and changes.System is allowed to be capable of the data of preferred high quality automatically in man-machine training process
It is very important.Therefore, compared with prior art, the invention has the following advantages that
1. the present invention can allow brain machine interface system automatic preferred sample in man-machine training process, so that brain-computer interface is used
The kilter at family can highlight in new samples set.
2. present invention employs the methods of incremental learning.When there are new samples, it is not necessarily to re -training, brain machine interface system
The information that new samples are contained can quickly be absorbed.
3. present invention employs be concisely and efficiently algorithm.Brain machine interface system can in man-machine training process it is online self
It updates, so that brain machine interface system and being mutually adapted for user can be dynamically completed in man-machine training process.
To sum up, method provided by the invention can enhance brain machine interface system and the mutual of user in man-machine training process and fit
It should be able to power.
Detailed description of the invention
Fig. 1 is main-process stream schematic diagram of the invention.
Fig. 2 is the flow diagram of step S1 of the invention.
Fig. 3 is the flow diagram of step S2 of the invention.
Fig. 4 is the schematic diagram of a trial of Mental imagery of the present invention.
Specific embodiment
The present invention will be further described with reference to the accompanying drawings and embodiments.
This implementation provides a kind of two stages adaptive training method of Mental imagery brain-computer interface, as shown in Figure 1, include with
Lower step:
Step S1: this step is in single trusted phase, and Mental imagery brain machine interface system trust data is updated with data and divided
Class device;When initial, user carries out the Mental imagery of multiple trial, and system online acquisition sample obtains one using LDA/QR algorithm
A preliminary transfer matrix G, and classification center vector set C is calculated, form preliminary classification device;User carries on Mental imagery,
System obtains new samples with the Mental imagery of classifier online recognition user and to user feedback;Whenever completion one
Trial, system updates transfer matrix G using ILDA/QR algorithm, and calculates classification center vector set C, forms new classifier simultaneously
It is used for the identification and feedback of next trial, is terminated until the stage;
Step S2: this step is in mutual trusted phase, Mental imagery brain machine interface system while trust data and classifier,
The two is allowed to be mutually adapted;When initial, system uses the Mental imagery of the finally obtained classifier online recognition user of step S1 simultaneously
To user feedback;After user carries out a certain number of trial, system is used using optimum seeking method screening new samples are mutually trusted
LDA/QR algorithm or ILDA/QR algorithm update transfer matrix G, and calculate classification center vector set C, form new classifier and incite somebody to action
For it is next identification and feedback, until man-machine training terminates.
In the present embodiment, as shown in Fig. 2, the step S1 specifically includes the following steps:
Step S11: user carries out the Mental imagery of multiple trial, system online acquisition signal, every a time interval
A segment signal is intercepted, m dimensional feature vector is converted into through feature extraction, is denoted as x;
Step S12: all feature vectors obtained in the step S11 construct data matrix A, and according to classification number
K structural matrix E;
Step S13: LDA/QR algorithm is executed, obtains optimal transfer matrix G, and class center vector collection C, shape is calculated
At preliminary classification device;
Step S14: user carries out the Mental imagery of a trial;System online acquisition EEG signals, every a time
Interval one segment signal of interception is converted to feature vector x through feature extraction, identifies x with classifier, controlled according to recognition result movement
Object is to user feedback;
Step S15: executing ILDA/QR algorithm, updates transfer matrix G, then updates data matrix A, and calculate class center
Vector set C forms new classifier;
Step S16: this stage terminates;Otherwise, new classifier is used for the identification and feedback of next trial, returns to step
Rapid S14.
In the present embodiment, as shown in figure 3, the step S2 specifically includes the following steps:
Step S21: setting mark flag is 0, and construction container is for storing k type games imagination sample;
Step S22: user carries out the Mental imagery of a trial;System online acquisition EEG signals, every a time
Interval one segment signal of interception is converted to feature vector x through feature extraction, identifies x with classifier, controlled according to recognition result movement
Object is to user feedback;
Step S23: at the end of current trial, if controll plant hits the mark, all samples of the trial is stored in and are held
Device, and record the trial and hit the mark the spent time;
Step S24: if trial number is not up to adaptive updates condition, return step S22;Otherwise, system uses mutual trust
Optimum seeking method is appointed to screen new samples;
Step S25: if flag is equal to 0, constructing data matrix A, according to classification number k structural matrix E, executes LDA/QR and calculates
Method obtains new transfer matrix G, and setting flag is 1;Otherwise, it executes ILDA/QR algorithm and updates transfer matrix G, and more new data
Matrix A;
Step S26: being calculated new class center vector collection C according to transfer matrix G and data matrix A, forms new point
Class device, and empty container;
Step S27: man-machine training terminates;Otherwise, return step S22.
In the present embodiment, mutual trust optimum seeking method described in step S24 comprises the steps of:
Step S41: according to hitting the mark, the spent time screens trial;With the corresponding consuming of trial all in container
Time one preliminary set of composition, finds out the minimum consuming time, other consuming times exist using the minimum consuming time as symmetry axis
Its symmetric position generates a virtual time, and all virtual times are added to preliminary set and form reference set, calculates reference set
The standard deviation of conjunction is chosen and expends the time less than the minimum trial for expending the sum of time and standard deviation;
Step S42: with the method Screening Samples of supporting vector;All sample standard deviations corresponding to the trial that step S41 chooses
Candidate samples collection is added, the training on candidate samples collection, chooses those samples for being confirmed as supporting vector with SVM;
Wherein, the trial indicates an experimental considerations unit in the man-machine training process of Mental imagery brain-computer interface;trial
When beginning, brain machine interface system gives a target at random;User's imagination of launching a campaign is tried hard to the mobile controll plant of target, brain
Machine interface system determines the direction of practical movement controll plant by identifying the type of Mental imagery;When controll plant hits mesh
Mark or time-out, trial terminate.
In the present embodiment, the method for construction described in step S12 and S25 or update data matrix A are as follows:
Data matrix A=[x1,x2,…,xn]=[A1,…,Ak]∈Rm×n, xi∈Rm×1I=1 ..., n indicates a m dimension
Sample point, n sample point is shared in A;M is determined by feature extracting method, is fixed and invariable in system operation;n
It is that dynamic increases in system operation;Each sample block matrixWhat is indicated is the i-th class
The set of all sample points shares k classification, niI=1 ..., k indicate the number of samples of the i-th class,
In the present embodiment, according to classification number k structural matrix E's described in step S12 and S25 method particularly includes:
MatrixWherein
In the present embodiment, the input of the LDA/QR algorithm is data matrix A ∈ Rm×nWith E ∈ Rn×k, export as transfer
Matrix G ∈ Rm×k;
Specifically includes the following steps:
Step S31: the economic QR for calculating A is decomposed, A=QR, Q ∈ Rm×n, R ∈ Rn×n, wherein Q is to arrange orthogonal, R right and wrong
Unusual;
Step S32: one lower triangular linear system R of solutionTH=E, solution obtain H;
Step S33: G, G=QH is calculated.
In the present embodiment, the input of the ILDA/QR algorithm is column orthogonal matrix Q, optimal transfer matrix G and newly arrives
Sampling feature vectors x and its classification l, export the column orthogonal matrix Q and transfer matrix G for update;
Specifically includes the following steps:
Step S41: r=Q is calculatedTX,Q=[Q (x-Qr)/α];
Step S42: r=-G is calculatedTX, r (l)=r (l)+1, r=r/ α, G=G+Q (:, n+1) rT。
In the present embodiment, the calculation method of the classification center vector set C are as follows: the data matrix of existing known class
A and transfer matrix G calculates P=ATG,Wherein pj∈R1×kJ=1 ..., n indicates data matrix A
In the corresponding projection result of each sample point, Pi∈R1×kI=1 ..., that k is indicated is all p for belonging to the i-th classjSet;
Calculate the center C of each classi∈R1×k,Obtaining class center vector collection is
In the present embodiment, the specific classification method of the classifier are as follows: sample to be determined is characterized vector x, calculates di
=| | xTG-Ci||2I=1 ..., k select the smallest di, feature vector x is determined as corresponding classification.
In the present embodiment, the Mental imagery experiment of user is to be made of multiple run, and each run is by multiple
Trial composition, each trial is made of the Windowslength of multiple regular lengths for having overlapping.Such as Fig. 4 institute
Show, trial indicates an experimental considerations unit in the man-machine training process of Mental imagery brain-computer interface, and the unit is from any given
Target start, hit the mark to controll plant or time-out.Specifically: occur Target Board generation first in 0s, on screen
Table wishes the target that user hits, and user can start to imagine corresponding movement at this time.The controll plant indicated after 2s with bead
The centre for appearing in screen, between 2s-10s later, bead differentiates that the imagination result of user carries out accordingly according to classifier
Movement.If bead hits the mark plate earlier than 10s, the trial is terminated in advance, into the rest period.When 10s without
Whether hit the mark plate by bead, bead stop motions, trial terminates and enters the rest period.In rest period bead and
Target Board disappears, duration 2s, starts a new trial again later.In the present embodiment, as shown in figure 4,
Using the data segment of 2s as the length of a fixed length Windows length, take a Windows length's long every 0.1s
Data are input in system using each collected Windows length as online signal data section x.
The foregoing is merely presently preferred embodiments of the present invention, all equivalent changes done according to scope of the present invention patent with
Modification, is all covered by the present invention.