Summary of the invention
Based on this, it is necessary in view of the above-mentioned problems, providing a kind of mask method of sleep state sample data type and beingSystem effectively improves the accuracy of sleep state classification device identification.
A kind of mask method of sleep state sample data type, comprising:
The EEG signals that acquisition user generates in sleep state analysis, obtain sample data;
Cluster center made of the feature vector and feature vector aggregation of the sample data of a variety of sleep state types is constructed,Objective function is established according to described eigenvector and its cluster center;Wherein, the objective function characterization minimizes same typeSample data is at a distance from dictionary atom, and the distance between different types of atom of maximization;
Select several feature vectors as the initial value of atom from the sample data of a variety of sleep state types respectively,Each sample data is distributed to the atom and solves the objective function, obtains classifying dictionary;
Sample data is inputted into classifying dictionary, compares the type and distance of the atom nearest with sample data, if apart from smallIn preset threshold value, then the type of the sample data is labeled as consistent with the type of the atom.
A kind of labeling system of sleep state sample data type, comprising:
Sample collection module, the EEG signals generated in sleep state analysis for acquiring user, obtains sample data;
Dictionary constructs module, the feature vector and feature vector of the sample data for constructing a variety of sleep state typesObjective function is established according to described eigenvector and its cluster center in cluster center made of aggregation;Wherein, the objective function characterizationThe distance between the sample data of same type is minimized at a distance from dictionary atom, and maximizes different types of atom;
Dictionary training module, for selecting several feature vectors from the sample data of a variety of sleep state types respectivelyAs the initial value of atom, each sample data is distributed to the atom and solves the objective function, obtains classifying dictionary;
Sample labeling module compares the class of the atom nearest with sample data for sample data to be inputted classifying dictionaryThe type of the sample data is labeled as consistent with the type of the atom by type and distance if distance is less than preset threshold value.
The mask method and system of above-mentioned sleep state sample data type, based on the clustering algorithm with classification capacity comeTraining dictionary, atom respectively corresponds a kind of sleep state in dictionary, using the number of atom as the parameter of algorithm, by most when trainingThe sample of smallization same type is at a distance from dictionary atom, while the mode for the distance between maximizing different types of atom,To train corresponding atom for every kind of sleep state, then utilizes and correspond to different types of atom and distance to sampleType is judged, so as to accurately mark the type of sample data, so that being subsequently used for oneself of sleep state classification deviceMore accurate sleep state classification device can be trained in learning process, promote the accuracy of sleep state detection.
Specific embodiment
The mask method of sleep state sample data type of the invention and the embodiment of system are illustrated with reference to the accompanying drawing.
Refering to what is shown in Fig. 1, Fig. 1 is the flow chart of the mask method of the sleep state sample data type of one embodiment,Include:
Step S101, the EEG signals that acquisition user generates in sleep state analysis, obtains sample data;
In this step, when carrying out assisting sleep analysis to user, related transducer equipment is worn by user, detects userEEG signals, when acquiring EEG signals, can with 30s be a frame be acquired.
The carrying out sleep state identification as needed of the task, determines feature data types, extracts therewith from EEG signalsCorresponding sample data;For example, to identify 1~N kind sleep state, the sample data for carrying out this N kind state recognition is extracted.
Step S102, the feature vector and feature vector for constructing the sample data of a variety of sleep state types are assembledCluster center, objective function is established according to described eigenvector and its cluster center;Wherein, the objective function characterization minimizes phaseThe sample data of same type is at a distance from dictionary atom, and the distance between different types of atom of maximization;
In this step, on the basis of KMeans (K mean value) and KNN (K is closest) algorithm, designing has classification capacityClustering algorithm carrys out training dictionary, and atom respectively corresponds a kind of sleep state (such as waking state, sleep state etc.), atom in dictionaryNumber be algorithm parameter.
When input sample is sufficiently small at a distance from atom (when similarity is sufficiently large), it may be considered that the type of sample and originalThe type of son is consistent;Establish objective function, training when by minimize same type sample and dictionary atom away fromFrom, while the mode for the distance between maximizing different types of atom, all to be trained accordingly for every kind of particular stateAtom.
If it is more classification problems, the sample equipped with a shared t seed type,Be characterized toAmount,For cluster center made of feature vector aggregation, the common version of objective function can be expressed asFollowing form:
In formula, the sample data equipped with t kind sleep state type,For feature vector,For cluster center made of feature vector aggregation.
By taking waking state and dormant two classes problem as an example, ifFor waking state type (wake)Feature vector,Cluster center made of feature vector aggregation for waking state type,ForThe feature vector of sleep state type (sleep),Cluster made of feature vector aggregation for sleep state typeCenter, objective function can be expressed as form:
The objective function are as follows:
In formula,For regain consciousness type feature vector,For the spy for type of regaining consciousnessCluster center made of vector aggregation is levied,For the feature vector of sleep pattern,To sleepCluster center made of the feature vector aggregation of dormancy type, wake indicate awake type, and sleep indicates sleep pattern.
Step S103 selects several feature vectors as atom from the sample data of a variety of sleep state types respectivelyInitial value, each sample data is distributed to the atom and solves the objective function, obtains classifying dictionary;
In this step, it is based on the objective function, training classifying dictionary, in training, this programme is in classical KMeansIt is improved on the basis of algorithm, by taking waking state and dormant two classification problem as an example, training process be can be such that
(1) when initializing, if being set at random from the sample data of awake type and the sample data of sleep pattern respectivelyDry feature vector is as atom;Each sample data is distributed to away from nearest atom;
(2) atom is updated, if it (is waking state that all sample datas for belonging to this atom are consistent with the type of atomType is sleep state type), then the mean value for belonging to all sample datas of the atom is calculated, and in this, as newAtom;
The sample data inconsistent with atomic type if it exists then calculates separately the sample data and sleep class of awake typeThe mean value of the sample data of type, calculating process may include following formula:
In formula, c'wakeFor the mean value of the sample data for type of regaining consciousness, c'sleepFor the mean value of the sample data of sleep pattern;
According to the quantity of the sample data (negative sample) inconsistent with atomic type and its position of position correction atom,By the location updating of atom in the farther position apart from negative sample data, calculating process may include following formula:
In formula, c is the position of atom after amendment, and g is discriminant function, and w is weighted value;
Further, the calculation formula of the weighted value w can be such that
In formula, wwakeFor the weighted value for type of regaining consciousness, wsleepFor the weighted value of sleep pattern.
As another embodiment, the calculation formula of the weighted value w also be can be such that
(3) if belong to this atom all sample datas and atom type it is inconsistent, change the class of the atomType, and the mean value for belonging to all sample datas of the atom is calculated, and using the mean value as new atom;
(4) it repeats step (2) and (3) is iterated, the difference of the atom before and after iteration is less than setting range (footIt is enough small), or be assigned without sample data and store current classifying dictionary to the new atomic time and exit training.
Sample data is inputted classifying dictionary by step S104, compares the type and distance of the atom nearest with sample data,If distance is less than preset threshold value, the type of the sample data is labeled as consistent with the type of the atom.
In this step, classifying dictionary is tested using sample data, by comparing the atom nearest with sample dataType and distance carry out the types of judgement sample data, if distance is less than threshold value, then it is assumed that the type of sample data and the atomType it is consistent, export the judgement of "true", the type of the sample data is labeled as it is consistent with the type of the atom, it is on the contrary then refuseJudgement absolutely.
The type that sample data is marked using above scheme.It can be used for training classifier, for example, svm is selected (to supportVector machine) classifier, neural metwork training disaggregated model.
Refering to what is shown in Fig. 2, Fig. 2 is the labeling system structural representation of the sleep state sample data type of one embodimentFigure, comprising:
Sample collection module 101, the EEG signals generated in sleep state analysis for acquiring user, obtains sample numberAccording to;
Dictionary constructs module 102, the feature vector and feature of the sample data for constructing a variety of sleep state typesCluster center made of vector aggregation, establishes objective function according to described eigenvector and its cluster center;Wherein, the objective functionCharacterization minimizes the sample data of same type with dictionary atom at a distance from, and between the different types of atom of maximization away fromFrom;
Dictionary training module 103, for selecting several features from the sample data of a variety of sleep state types respectivelyEach sample data is distributed to the atom and solves the objective function, classified by initial value of the vector as atomDictionary;
Sample labeling module 104 compares the atom nearest with sample data for sample data to be inputted classifying dictionaryThe type of the sample data is labeled as consistent with the type of the atom by type and distance if distance is less than preset threshold value.
The labeling system of sleep state sample data type of the invention and sleep state sample data type of the inventionMask method correspond, above-mentioned sleep state sample data type mask method embodiment illustrate technical characteristicAnd its advantages are suitable for the embodiment of the labeling system of sleep state sample data type, hereby give notice that.
Each technical characteristic of embodiment described above can be combined arbitrarily, for simplicity of description, not to above-mentioned realityIt applies all possible combination of each technical characteristic in example to be all described, as long as however, the combination of these technical characteristics is not depositedIn contradiction, all should be considered as described in this specification.
The embodiments described above only express several embodiments of the present invention, and the description thereof is more specific and detailed, but simultaneouslyIt cannot therefore be construed as limiting the scope of the patent.It should be pointed out that coming for those of ordinary skill in the artIt says, without departing from the inventive concept of the premise, various modifications and improvements can be made, these belong to protection of the inventionRange.Therefore, the scope of protection of the patent of the invention shall be subject to the appended claims.