A bluetooth positioning method and system based on greedy sparse inverse covariance causal inference
By constructing a training fingerprint database and correcting RSSI vectors using a greedy sparse inverse covariance causal reasoning method, the problem of insufficient accuracy and robustness in Bluetooth positioning is solved, and high-precision positioning in complex environments is achieved.
Patent Information
- Application Number
- CN202611285824.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-24
- Publication Date
- 2026-11-17
AI Technical Summary
Existing Bluetooth positioning methods suffer from problems such as signal multipath effect, environmental noise interference and device hardware drift in indoor positioning, resulting in low positioning accuracy and poor robustness, especially when dealing with dirty data and environmental changes.
A greedy sparse inverse covariance causal inference method is adopted. In the offline stage, a training fingerprint database is constructed and a sparse precision matrix is estimated. In the online stage, the sparse residual structure is used to correct the RSSI vector. Combined with KNN fingerprint matching, sub-meter level positioning accuracy is achieved.
It maintains high accuracy and robustness in complex environments, reduces positioning error by 17.1%, and can still achieve stable positioning even with 30% dirty data injection, meeting real-time requirements.
Smart Images

Figure CN123123822A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of Bluetooth positioning technology, and in particular to a Bluetooth positioning method and system based on greedy sparse inverse covariance causal reasoning. Background Technology
[0002] With the rapid development of the Internet of Things (IoT) and smart devices, indoor positioning technology plays a crucial role in modern life. Among them, Bluetooth technology is often used for indoor positioning due to its advantages such as low power consumption, high compatibility, and wide availability. However, Bluetooth positioning suffers from problems such as signal multipath effect, environmental noise interference, and device hardware drift in actual deployment, which seriously restricts positioning accuracy and system robustness.
[0003] Current mainstream BLE indoor positioning methods include: RSSI-based trilateration (highly affected by multipath propagation, accuracy is typically ≥3m); RSSI fingerprint + KNN / WKNN matching method (sensitive to environmental changes); angle of arrival (AoA) based array antenna method (requires special hardware, unsuitable for general-purpose MCUs); and UWB-based high-precision positioning (high cost, incompatible with BLE).
[0004] The common drawbacks of existing methods are that they treat RSSI as an independent observation and do not model the causal dependence between signals; they are not robust to dirty data (short-term pulses, equipment drift); and it is difficult to achieve both database construction cost and accuracy. Summary of the Invention
[0005] To address the shortcomings of existing technologies, this invention provides a Bluetooth positioning method and system based on greedy sparse inverse covariance causal reasoning. It uses the inverse of the covariance matrix under the multivariate Gaussian assumption to encode the conditional independence between RSSIs. During the training phase, the GSS algorithm is used to estimate sparse precision from the empirical covariance. In the online phase, the sparse residual structure of the sparse precision is used to estimate the environmental offset between test and training and to correct the RSSI vector accordingly. Finally, KNN fingerprint matching is used to obtain sub-meter level positioning accuracy, thus maintaining high precision and robustness in complex scenarios with interference and dirty data.
[0006] The objective of this invention is achieved as follows: a Bluetooth positioning method based on greedy sparse inverse covariance causal reasoning, comprising the following steps:
[0007] Step 1) Offline fingerprint acquisition and covariance estimation: Collect the Bluetooth Low Energy Beacon Received Signal Strength Indication (RSSI) vectors of each reference point in the positioning area, construct a training fingerprint database, and calculate the covariance matrix of the centralized samples;
[0008] Step 2) Greedy sparse estimation and orientation discrimination: Based on the sample covariance matrix, a sparse precision matrix is obtained through greedy sparse estimation, and causal orientation discrimination is performed on the non-zero off-diagonal elements in the sparse precision matrix to obtain a directed sparse skeleton.
[0009] Step 3) Residual Statistics and Model Consolidation: Based on the directed sparse skeleton and sparse precision matrix, the conditional residual distribution of the training samples is statistically analyzed, and the sparse precision matrix, directed sparse skeleton, residual statistical parameters and training fingerprint database are consolidated into online model parameters.
[0010] Step 4) Online anomaly diagnosis and offset repair: Obtain the online RSSI frame of the target device, and based on the online model parameters, use the causal direction of the directed sparse skeleton to perform anomaly diagnosis on the online RSSI frame, estimate the environmental offset vector to perform offset correction, and perform hard replacement on the anomaly dimension to obtain the repaired RSSI vector.
[0011] Step 5) KNN matching and coordinate output: Perform KNN fingerprint matching between the repaired RSSI vector and the training fingerprint database, and output the positioning coordinates.
[0012] Furthermore, before constructing the training fingerprint database as described in step 1), preprocessing is also included: performing median filtering and exponential moving average on the RSSI time series of each beacon, and marking observations that deviate from the median by more than a preset decibel threshold within a single frame as suspicious values.
[0013] Furthermore, the greedy sparse estimation described in step 2) includes: using the pseudo-inverse of the positive definite covariance input matrix as the initial precision matrix; calculating the log-likelihood gradient, selecting the symmetric element with the largest gradient magnitude outside the current support set and adding it to the support set; updating the precision matrix along the normalized gradient direction, and performing symmetry, hard thresholding, and positive definiteness verification on the updated matrix; if the log-likelihood does not increase, deleting the edge with the smallest contribution in the support set and recalculating until the convergence condition is met.
[0014] Furthermore, the causal direction determination in step 2) specifically includes: for each undirected edge in the sparse precision matrix, fitting the causal relationship between the two directions using a finite impulse response model; calculating the conditional residual variance of each direction; calculating the direction score according to the direction score formula, wherein the direction score is half of the logarithmic difference between the conditional residual variances of the two directions; when the direction score is greater than zero, orienting the edge to the corresponding direction, otherwise orienting it to the opposite direction.
[0015] Furthermore, the conditional residual distribution of the statistical training samples described in step 3) includes: calculating the conditional regression coefficients based on the off-diagonal and diagonal elements of the sparse precision matrix; for each training sample, calculating the conditional predicted value based on the beacon observations in its parent node set and the conditional regression coefficients; taking the difference between the actual observations and the conditional predicted values as the residuals; and calculating the mean and standard deviation of the residuals in each dimension.
[0016] Furthermore, step 4) describes using the causal direction of the directed sparse skeleton to perform anomaly diagnosis on the online RSSI frame, which includes: calculating the conditional residual and standardized statistic for each dimension of the online RSSI frame; calculating the conditional residual based on the conditional regression coefficient and the set of parent nodes; subtracting the mean of the conditional residual from the mean of the training residual, and then dividing by the sum of the standard deviation of the training residual and the regularization term to obtain the standardized statistic; setting a residual threshold, and marking the corresponding beacon as an anomaly candidate when the absolute value of the standardized statistic exceeds the residual threshold; and propagating the anomaly label only to downstream beacons based on the causal direction of the directed sparse skeleton.
[0017] Furthermore, step 4) involves estimating the environment offset vector and performing offset correction, which includes: constructing a sparse residual operator based on the sparse precision matrix, using the set of dimensions that are not judged as anomalous as constraints, estimating the environment offset vector through weighted least squares iteration, and subtracting the environment offset vector from the online RSSI frame; and performing hard replacement on dimensions that still meet the anomalous conditions after offset correction, based on the conditional expectation of the parent node set.
[0018] Furthermore, the KNN fingerprint matching in step 5) includes: calculating the Euclidean distance between the repaired RSSI vector and each training sample in the training fingerprint database, selecting a preset number of neighbor samples with the smallest distance, setting a weight inversely proportional to the distance for each neighbor sample, and performing a normalized weighted average on the coordinates of each neighbor sample to obtain the positioning coordinates.
[0019] Another aspect of the objective of this invention is achieved as follows: a Bluetooth positioning system based on greedy sparse inverse covariance causal reasoning, comprising a BLE beacon group, a BLE scanning module, a data preprocessing module, a causal reasoning engine module, and a host computer monitoring terminal.
[0020] The BLE beacon group is used to periodically broadcast Bluetooth signals;
[0021] The BLE scanning module is used to receive the broadcast signal of the BLE beacon group and buffer the RSSI timing;
[0022] The data preprocessing module is used to perform median filtering, exponential moving average, and outlier marking on the RSSI time series.
[0023] The causal inference engine module is used to learn a sparse precision matrix from RSSI training data and determine the causal direction in the offline stage, and construct a directed sparse skeleton; in the online stage, based on the skeleton, anomaly diagnosis, environmental offset estimation and causal guided repair are performed on real-time RSSI frames to provide a clean input after denoising for KNN fingerprint matching.
[0024] The causal reasoning engine module includes an offline training unit, a likelihood score direction discrimination unit, an online diagnosis unit, and an online repair unit;
[0025] The offline training unit is used to calculate the covariance matrix of the centered sample based on the training fingerprint database, call the greedy sparse algorithm to estimate the sparse precision matrix, and learn the conditional independence structure between BLE beacon RSSIs from the data.
[0026] The likelihood fraction direction discrimination unit is used to fit the causal relationship between two directions for each undirected edge in the sparse skeleton using a finite impulse response model. The causal direction is determined by comparing the log-likelihood fraction of the conditional residual variance, and the undirected skeleton is transformed into a directed sparse skeleton for determining the direction of anomaly propagation during subsequent online repair.
[0027] The online diagnostic unit is used to calculate the conditional residuals dimension by dimension of the online RSSI frames, perform standardized tests to identify abnormal beacons, and simultaneously use a sparse precision matrix to back-estimate the environmental offset vector, so that the online RSSI distribution is aligned with the training set, thereby realizing dirty data diagnosis and environmental offset detection.
[0028] The online repair unit is used to first perform overall offset correction on the RSSI frame using the environmental offset vector based on the diagnostic results; for abnormal beacons whose residuals still exceed the limit, hard replacement is performed using conditional expectation based on the causal structure of the directed sparse skeleton; finally, the repaired RSSI vector is output to the KNN fingerprint matching module to complete the localization.
[0029] The host computer monitoring terminal is used to monitor training status, positioning accuracy, and model upgrades.
[0030] Furthermore, the data preprocessing module includes a median filtering submodule, a moving average submodule, and an outlier removal submodule;
[0031] The median filtering submodule is used to perform median filtering on the RSSI timing of each beacon to remove short-time pulse interference;
[0032] The moving average submodule is used to perform an exponential moving average with a preset decay factor within a preset time window.
[0033] The outlier removal submodule is used to mark samples that deviate from the median by more than a preset decibel threshold within a single frame as suspicious values.
[0034] Compared with the prior art, the beneficial effects of the present invention are as follows: The present invention extracts the conditional independence between signals by using the inverse covariance matrix, and explicitly models the causal relationship between signals, avoiding the accumulation of positioning errors caused by ignoring the causal structure in traditional methods; after introducing the inverse covariance matrix and causal inference, the relationship between signals and positions can be modeled more accurately, thereby significantly reducing positioning errors (17.1% relative improvement in actual measurements).
[0035] This invention identifies anomalous beacons / abnormal time-series frames based on the learned inverse covariance skeleton and guides repair according to the causal direction; it maintains stable positioning accuracy even with 30% dirty data injection.
[0036] This invention uses Gaussian likelihood direction discrimination to ensure that the learned skeleton direction is consistent with the real physical causality, making the repair offset interpretable and traceable; it also ensures the consistency between offline training and online localization.
[0037] All algorithms in this invention (offline training / online diagnosis / positioning correction) have achieved a single online positioning time of < 50 ms in actual tests on a Cortex-M4 (120 MHz), meeting the real-time requirements of vehicle / IoT applications. Attached Figure Description
[0038] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0039] Figure 1 System structure block diagram of the present invention.
[0040] Figure 2 A flowchart of the present invention.
[0041] Figure 3 This is a comparison chart of the structural recovery capabilities of the causal discovery algorithm of this invention.
[0042] Figure 4 This is a comparison chart of the online dirty data diagnostic capabilities of this invention.
[0043] Figure 5 This is a comparison chart of training time and direction discrimination accuracy of the present invention.
[0044] Figure 6 This is a comparison chart of the positioning errors of the five repair strategies of this invention.
[0045] Figure 7 A comparison chart showing the accuracy of localization using the traditional WKNN fingerprinting method and the method described in this invention for each seed.
[0046] Among them, 100 BLE beacon group, 101 BLE scanning module, 102 data preprocessing module, 103 causal inference engine module, 201 offline training unit, 202 online diagnosis unit, 203 online repair unit, 204 likelihood score direction discrimination unit; 301 fingerprint database, 302 host computer monitoring terminal. Detailed Implementation
[0047] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0048] like Figure 1 The Bluetooth positioning system shown includes a greedy sparse inverse covariance causal reasoning system, comprising a BLE beacon group 100, a BLE scanning module 101, a data preprocessing module 102, a causal reasoning engine module 103, and a host computer monitoring terminal 302.
[0049] The BLE beacon group 100 is used for periodically broadcasting Bluetooth signals. The BLE beacon group 100 consists of eight Bluetooth signal nodes (model nRF52811 / nRF52832, TX power -59 dBm), deployed in three concentric circles (radius 4 m / 8 m / 12.5 m) within a 30 m × 30 m rectangular area. Each Bluetooth signal node broadcasts ADV frames at 100 ms / 200 ms periods, and target devices scan and acquire 8-dimensional RSSI vectors at a frequency of 1 Hz.
[0050] BLE scanning module 101 is used to receive the broadcast signal of the BLE beacon group 100 and buffer the 8-dimensional RSSI timing; and send it to component data preprocessing module 102 via SPI / SDIO;
[0051] The data preprocessing module 102 is used to perform median filtering, exponential moving average, and outlier marking on the RSSI time series.
[0052] The data preprocessing module 102 includes a median filtering submodule, a moving average submodule, and an outlier removal submodule;
[0053] The median filtering submodule is used to perform median filtering on the RSSI timing of each Bluetooth signal node to eliminate short-time pulse interference;
[0054] The moving average submodule is used to perform an exponential moving average with a preset decay factor within a preset time window; and to perform an exponential moving average with a decay factor of 0.6 within a 1-second window.
[0055] The outlier removal submodule is used to mark samples that deviate from the median by more than a preset decibel threshold within a single frame as suspicious values; samples that deviate from the median by more than 10 dB within a single frame are marked as suspicious and are then decided by the subsequent diagnostic module.
[0056] The causal inference engine module 103 is used to learn a sparse precision matrix from RSSI training data and determine the causal direction in the offline stage, and construct a directed sparse skeleton; in the online stage, based on the skeleton, anomaly diagnosis, environmental offset estimation and causal guided repair are performed on real-time RSSI frames to provide a clean input after denoising for KNN fingerprint matching.
[0057] The causal reasoning engine module includes an offline training unit 201, a likelihood score direction discrimination unit 204, an online diagnosis unit 202, and an online repair unit 203;
[0058] The offline training unit 201 is used to calculate the covariance matrix of the centered samples based on the training fingerprint database, call the greedy sparse algorithm to estimate the sparse precision matrix, and learn the conditional independence structure between BLE beacon RSSIs from the data;
[0059] Calculate the covariance of centered samples based on the training fingerprint database (4000 frames × 8 dimensions) Then, the GSS algorithm is called to estimate the sparse precision matrix. The objective function of GSS is:
[0060]
[0061]
[0062] The solution employs a forward-backward greedy loop, updating X at each step based on the log-likelihood gradient and following the GSS algorithm flow.
[0063] The likelihood fraction direction discrimination unit 204 is used to fit the causal relationship between two directions for each undirected edge in the sparse skeleton using a finite impulse response model. The causal direction is determined by comparing the log-likelihood fraction of the conditional residual variance, and the undirected skeleton is transformed into a directed sparse skeleton for determining the direction of anomaly propagation during subsequent online repair.
[0064] Likelihood fraction direction determination: For each undirected edge (X, Y) in the skeleton, compare the differential entropy h(X|Y) with h(Y|X):
[0065]
[0066] When s > 0, X is the cause and Y is the effect. The prediction model selected is FIR (Linear Finite Impulse Response), which has good adaptability to dynamic data.
[0067] The online diagnostic unit 202 is used to calculate the conditional residuals of the online RSSI frames dimension by dimension, perform standardized tests to identify abnormal beacons, and at the same time use the sparse precision matrix to back estimate the environmental offset vector, so that the online RSSI distribution is aligned with the training set, thereby realizing dirty data diagnosis and environmental offset detection.
[0068] The RSSI residual for each frame is defined as:
[0069]
[0070] The residual z-test is Threshold z th = 2.0; This invention also utilizes in each frame The environmental offset vector o is estimated in reverse to align the RSSI of this frame with the distribution of the training set.
[0071] The online repair unit 203 is used to first perform overall offset correction on the RSSI frame using the environmental offset vector based on the diagnostic results; for abnormal beacons whose residuals still exceed the limit, hard replacement is performed using conditional expectation based on the causal structure of the directed sparse skeleton; finally, the repaired RSSI vector is output to the KNN fingerprint matching module to complete the localization.
[0072] After subtracting the environmental offset vector o, KNN matching is performed (k=7, distance weight 1 / (d+ε)); for beacons with particularly large residuals, a... The given conditions are expected to result in a hard replacement.
[0073] The host computer monitoring terminal 302 is used to monitor training status, positioning accuracy, and model upgrades; and to monitor GSS training status. Sparsity curves, positioning accuracy statistics, and model OTA upgrades; this module communicates with the target device via UART / USB / CAN.
[0074] like Figure 2 The Bluetooth positioning method shown includes the following steps: (The method is based on greedy sparse inverse covariance causal reasoning)
[0075] Step 1) Offline fingerprint acquisition and covariance estimation: Collect the Bluetooth Low Energy Beacon Received Signal Strength Indication (RSSI) vectors of each reference point in the positioning site, construct a training fingerprint database, and calculate the centered sample covariance matrix; before constructing the training fingerprint database, preprocessing is also included: perform median filtering and exponential moving average on the RSSI time series of each beacon, and mark observations that deviate from the median by more than a preset decibel threshold in a single frame as suspicious values;
[0076] Offline RSSI fingerprinting: Multiple reference points with known coordinates are pre-set within a 30m × 30m field. Eight BLE beacons are deployed in a three-ring structure with radii of 4m, 8m, and 12.5m. The target device scans the beacons at each reference point at a frequency of 1 Hz, arranging them according to a fixed Beacon ID sequence. The timing data of each beacon were sequentially subjected to median filtering and a 1-second exponential moving average with an attenuation factor of 0.6. Observations with a relative deviation from the median of a single frame greater than 10 dB were marked as suspicious. The preprocessed RSSI vector was then compared with the coordinates q of the reference point. (n) Binding, accumulating to form an N = 4000-frame training fingerprint database (X) train Q train ).
[0077] Sample covariance estimation: Calculate the mean dimension by dimension of the training fingerprint database. We obtain the mean vector μ; let the center matrix X c The nth line is x (n) -μ, calculate sample covariance To ensure the numerical stability of the subsequent inversion, εI is added to the diagonal; in this embodiment, ε = 10. -2 Thus, the positive definite covariance input is obtained. .
[0078] Step 2) Greedy sparse estimation and orientation discrimination: Based on the sample covariance matrix, a sparse precision matrix is obtained through greedy sparse estimation, and causal orientation discrimination is performed on the non-zero off-diagonal elements in the sparse precision matrix to obtain a directed sparse skeleton.
[0079] Greedy sparse estimation includes: using the pseudo-inverse of the positive definite covariance input matrix as the initial precision matrix; calculating the log-likelihood gradient, selecting the symmetric element with the largest gradient magnitude outside the current support set and adding it to the support set; updating the precision matrix along the normalized gradient direction, and performing symmetry, hard thresholding, and positive definiteness verification on the updated matrix; if the log-likelihood does not increase, deleting the edge with the smallest contribution in the support set and recalculating until the convergence condition is met;
[0080] GSS estimates the sparse precision matrix: using the pseudo-inverse of S as the initial value. Solve And satisfy The gradient is calculated first in each round. Select |G from outside the current support set ij The largest symmetric element is added to the support set, and Θ is updated along the normalized gradient. If the likelihood does not increase, the edge with the smallest contribution in the support set is removed and recalculated. After the update, the matrix is symmetricized, hard-thresholded, and positive definiteness checked. In this embodiment, k is taken as k. sparsity= 16. Learning rate η = 5 × 10 -3 Maximum number of iterations: 400; output sparse precision matrix. .
[0081] The causal direction determination specifically includes: for each undirected edge in the sparse precision matrix, fitting the causal relationship between the two directions using a finite impulse response model; calculating the variance of the conditional residuals for each direction; calculating the direction score according to the direction score formula, wherein the direction score is half of the logarithmic difference between the variances of the conditional residuals of the two directions; when the direction score is greater than zero, orienting the edge to the corresponding direction, otherwise orienting it to the opposite direction.
[0082] Likelihood fraction direction determination: China satisfies and The elements are interpreted as undirected conditional dependencies between beacon i and beacon j. For each undirected edge (X... i , X j The FIR model was used to fit the data. and Calculate the conditional residual variance in two directions. and And calculate the direction fraction. When s > 0, the edge will be oriented as... Otherwise, the orientation is This yields a directed sparse skeleton for online repair.
[0083] Step 3) Residual Statistics and Model Consolidation: Based on the directed sparse skeleton and sparse precision matrix, the conditional residual distribution of the training samples is statistically analyzed, and the sparse precision matrix, directed sparse skeleton, residual statistical parameters and training fingerprint database are consolidated into online model parameters.
[0084] The distribution of the conditional residuals of the training samples includes: calculating the conditional regression coefficients based on the off-diagonal and diagonal elements of the sparse precision matrix; for each training sample, calculating the conditional predicted value based on the beacon observations in its parent node set and the conditional regression coefficients; using the difference between the actual observations and the conditional predicted values as the residuals; and calculating the mean and standard deviation of the residuals in each dimension.
[0085] Training residual distribution statistics: For each beacon i, calculate the conditional regression coefficients based on the accuracy matrix. Calculate the conditional prediction value for the nth training sample. and residuals , where pa(i) is the set of parent nodes of beacon i obtained in the likelihood score direction determination. The mean μ of the residual in each dimension is calculated. r,i and standard deviation σ r,i and μ, , directed skeleton, μr σ r The training fingerprint database with coordinate labels is also fixed into the online model parameters.
[0086] Online RSSI frame reading: The target device reads the BLE broadcasts within the current scan period at the location to be located and forms online frames according to the same Beacon ID order as offline training. The online data is preprocessed using the same median filtering, exponential moving average, and suspicious value labeling rules as those used in offline RSSI fingerprint sampling to ensure that the dimensions, order, and units of the online data are consistent with those of the training fingerprints.
[0087] Step 4) Online anomaly diagnosis and offset repair: Obtain the online RSSI frame of the target device, and based on the online model parameters, use the causal direction of the directed sparse skeleton to perform anomaly diagnosis on the online RSSI frame, estimate the environmental offset vector to perform offset correction, and perform hard replacement on the anomaly dimension to obtain the repaired RSSI vector.
[0088] Anomaly diagnosis of the online RSSI frame using the causal direction of the directed sparse skeleton includes: calculating the conditional residual and standardized statistic for each dimension of the online RSSI frame; calculating the conditional residual based on the conditional regression coefficients and the set of parent nodes; subtracting the conditional residual from the mean of the training residuals and dividing by the sum of the standard deviation of the training residuals and the regularization term to obtain the standardized statistic; setting a residual threshold, and marking the corresponding beacon as an anomaly candidate when the absolute value of the standardized statistic exceeds the residual threshold; and propagating the anomaly marker only downstream beacons based on the causal direction of the directed sparse skeleton.
[0089] Sparse residual z-test: Calculate the conditional residual in the i-th dimension of an online frame. Then calculate the standardized statistic. In this embodiment, z is set. th = 2.0; when |z i | > z th When the i-th beacon is marked as an anomalous candidate, and the causal direction obtained from the likelihood score direction discrimination is combined, the anomalous label is only propagated downstream to avoid making unfounded corrections to the upstream healthy beacons.
[0090] The process of estimating the environmental offset vector and performing offset correction includes: constructing a sparse residual operator based on the sparse precision matrix; using the set of dimensions that have not been judged as anomalies as constraints; estimating the environmental offset vector through weighted least squares iteration; and subtracting the environmental offset vector from the online RSSI frame; and performing hard replacement on dimensions that still meet the anomalous conditions after offset correction, based on the conditional expectation of the parent node set.
[0091] Environmental Migration Estimation and Hard Replacement: By β ijConstruct a sparse residual operator B, whose Using the set of dimensions H that are not judged as anomalous as constraints, the environmental offset o is estimated by weighted least squares, so that... Approaching μ r,H Preferred method ,in γ = 10 -6 After each estimation, the z-test is re-executed and H is updated, with a maximum of 12 iterations. Let... ; for those that still satisfy |z i | > z th The dimension of conditional expectation Hard replacement The repaired RSSI vector is obtained. .
[0092] Step 5) KNN matching and coordinate output: Perform KNN fingerprint matching between the repaired RSSI vector and the training fingerprint database, and output the positioning coordinates.
[0093] KNN fingerprint matching includes: calculating the Euclidean distance between the repaired RSSI vector and each training sample in the training fingerprint database, selecting a preset number of neighbor samples with the smallest distance, setting a weight inversely proportional to the distance for each neighbor sample, and performing a normalized weighted average of the coordinates of each neighbor sample to obtain the positioning coordinates.
[0094] KNN fingerprint matching: calculate separately With training fingerprints Euclidean distance between Select the neighbors with the smallest distance k = 7. For the th Set weights for each neighbor and its coordinates Normalized weighting is performed to obtain the positioning coordinates. .
[0095] Location result output: The two components are output as the final coordinates (x, y), and the abnormal beacon index, z value, and environmental offset vector o can also be output for the host computer to monitor and maintain the model. In the embodiment with 7 random seeds, 4000 frames of training and 2000 frames of testing per seed, compared with the traditional WKNN fingerprint matching method, the proportion of ≤2m positioning frames in this process is increased from 31.5% to 44.4%, an absolute increase of 12.9 percentage points; the positioning RMSE is reduced from 7.50 m to 6.27 m, an absolute decrease of 1.24 m.
[0096] To further demonstrate the method, this invention independently ran each algorithm / repair strategy 7 times (seed = 8, 15, 22, 29, 36, 43, 50) and took the mean and variance. All figures given in this invention are from the actual test results of the E:\Git_PJ\BLE_PJ project.
[0097] like Figure 3 The comparison chart of the structural recovery capabilities of causal discovery algorithms shows that GSS (greedy sparse, this invention) has a skeleton F1 score of 0.419±0.130 and a training time of 23 ms; PC algorithm (Fisher-z) has a skeleton F1 score of 0.448±0.140 and a training time of 52 ms; LiNGAM (ICA) has a skeleton F1 score of 0.525±0.120, but its skeleton is too dense, and its training time is 6 ms; NOTEARS (continuous DAG) has a skeleton F1 score of 0.248±0.092 and a training time of 155 ms. In comparison, LiNGAM has the highest skeleton F1 score, but its dense skeleton increases the complexity of subsequent diagnosis; NOTEARS has the longest training time and the weakest structural recovery capability. Although GSS's skeleton F1 score is slightly lower than PC and LiNGAM, its training time is significantly lower than PC and NOTEARS, and it maintains a relatively sparse structure. Therefore, it achieves a more balanced performance in terms of structural recovery effect, sparsity, and computational efficiency.
[0098] like Figure 4 As shown in the comparison chart of online dirty data diagnostic capabilities, GSS (this invention): diagnostic F1 = 0.385 ± 0.180; PC, LiNGAM, and NOTEARS: all diagnostic F1 values are 0. The comparison reveals that only GSS achieved a non-zero diagnostic result. While other algorithms could recover the causal structure to varying degrees, they failed to establish effective online anomaly detection capabilities. This indicates that the sparse causal structure learned by GSS can not only describe the dependencies between beacons but is also more suitable for supporting subsequent dirty data diagnostics.
[0099] like Figure 5 The comparison chart showing training time and orientation accuracy, after applying the same likelihood score for orientation discrimination to the skeletons of each algorithm, shows: GSS: orientation accuracy 0.89; PC: orientation accuracy 0.83; LiNGAM: orientation accuracy 0.80; NOTEARS: orientation accuracy 0.90. GSS's orientation accuracy is only 0.01 lower than NOTEARS, yet it reduces training time from 155 ms to 23 ms. Compared to PC, GSS improves orientation accuracy by 0.06 while having shorter training time. Although LiNGAM has the fastest training speed, it has the lowest orientation accuracy. Therefore, considering both accuracy and computational cost, GSS offers a better balance.
[0100] like Figure 6 The comparison chart of localization errors for the five repair strategies shown indicates that the localization RMSEs for traditional WKNN, median filtering, moving average, and residual elimination are 2.49 m, 2.41 m, 2.35 m, and 2.25 m, respectively. The GSS-offset of this invention further reduces this to 2.06 m. Compared to traditional WKNN, the localization RMSE of this invention is reduced by 0.43 m, a relative decrease of 17.3%; even compared to the aforementioned best-performing residual elimination strategy, it is still reduced by 0.19 m. This demonstrates that conventional filtering and residual processing can gradually improve localization results, while offset repair based on sparse causal structures achieves a more significant error reduction.
[0101] like Figure 7 The chart shows a comparison of the localization accuracy of the traditional WKNN fingerprinting method and the method of this invention on each seed. Under seven random seeds, the localization RMSE of this invention is consistently lower than that of the traditional WKNN, with each group's error decreasing by approximately 0.4 m, and the average RMSE decreasing from 2.49 m to 2.06 m. A consistent downward trend is observed under different random seeds, and the improvement magnitude is similar across groups. This comparison demonstrates that the improved localization accuracy of this invention exhibits good repeatability and stability, and is not due to isolated random experiments.
[0102] As shown in Table 1, the cumulative positioning accuracy of this invention is higher than that of traditional WKNN across all error thresholds. Specifically, when the error is no more than 1.0 m, the positioning accuracy increases from 12.2% to 19.9%, a relative improvement of 63%; when the error is no more than 2.5 m, the positioning accuracy increases from 40.2% to 53.6%, an absolute improvement of 13.4 percentage points. The invention maintains a stable advantage as the error threshold increases, indicating that it can concentrate more positioning results within a smaller error range, with particularly significant improvement in near-range positioning accuracy.
[0103] Table 1
[0104]
[0105] This invention provides a Bluetooth positioning method and system based on greedy sparse inverse covariance causal reasoning. The inverse matrix of the covariance matrix under the multivariate Gaussian assumption is used to encode the conditional independence between RSSIs. During the training phase, the GSS algorithm is used to estimate the sparse accuracy from the empirical covariance. In the online phase, the sparse residual structure of the sparse accuracy is used to estimate the environmental offset between test and training and correct the RSSI vector accordingly. Then, KNN fingerprint matching is used to obtain sub-meter level positioning accuracy, thereby maintaining high accuracy and high robustness in complex scenarios with interference and dirty data.
[0106] The above description of the embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. It should be noted that those skilled in the art can make several improvements and modifications to the present invention without departing from the principles of the present invention, and these improvements and modifications also fall within the protection scope of the claims of the present invention.
Claims
1. A Bluetooth positioning method based on greedy sparse inverse covariance causal reasoning, characterized in that, Includes the following steps: Step 1) Offline fingerprint acquisition and covariance estimation: Collect the Bluetooth Low Energy Beacon Received Signal Strength Indication (RSSI) vectors of each reference point in the positioning area, construct a training fingerprint database, and calculate the covariance matrix of the centralized samples; Step 2) Greedy sparse estimation and orientation discrimination: Based on the sample covariance matrix, a sparse precision matrix is obtained through greedy sparse estimation, and causal orientation discrimination is performed on the non-zero off-diagonal elements in the sparse precision matrix to obtain a directed sparse skeleton. Step 3) Residual Statistics and Model Consolidation: Based on the directed sparse skeleton and sparse precision matrix, the conditional residual distribution of the training samples is statistically analyzed, and the sparse precision matrix, directed sparse skeleton, residual statistical parameters and training fingerprint database are consolidated into online model parameters. Step 4) Online anomaly diagnosis and offset repair: Obtain the online RSSI frame of the target device, and based on the online model parameters, use the causal direction of the directed sparse skeleton to perform anomaly diagnosis on the online RSSI frame, estimate the environmental offset vector to perform offset correction, and perform hard replacement on the anomaly dimension to obtain the repaired RSSI vector. Step 5) KNN matching and coordinate output: Perform KNN fingerprint matching between the repaired RSSI vector and the training fingerprint database, and output the positioning coordinates.
2. The Bluetooth positioning method based on greedy sparse inverse covariance causal reasoning according to claim 1, characterized in that, Before constructing the training fingerprint database as described in step 1), preprocessing is also included: median filtering and exponential moving average are applied to the RSSI time series of each beacon, and observations that deviate from the median by more than a preset decibel threshold within a single frame are marked as suspicious values.
3. The Bluetooth positioning method based on greedy sparse inverse covariance causal reasoning according to claim 1, characterized in that, The greedy sparse estimation described in step 2) includes: using the pseudo-inverse of the positive definite covariance input matrix as the initial precision matrix; calculating the log-likelihood gradient, selecting the symmetric element with the largest gradient magnitude outside the current support set and adding it to the support set; updating the precision matrix along the normalized gradient direction, and performing symmetry, hard thresholding, and positive definiteness verification on the updated matrix; if the log-likelihood does not increase, deleting the edge with the smallest contribution in the support set and recalculating until the convergence condition is met.
4. The Bluetooth positioning method based on greedy sparse inverse covariance causal reasoning according to claim 1, characterized in that, The causal direction determination in step 2) specifically includes: for each undirected edge in the sparse precision matrix, fitting the causal relationship between the two directions using a finite impulse response model; calculating the conditional residual variance of each direction; calculating the direction score according to the direction score formula, wherein the direction score is half of the logarithmic difference between the conditional residual variances of the two directions; when the direction score is greater than zero, orienting the edge to the corresponding direction, otherwise orienting it to the opposite direction.
5. The Bluetooth positioning method based on greedy sparse inverse covariance causal reasoning according to claim 1, characterized in that, Step 3) describes the distribution of conditional residuals for the training samples, which includes: calculating conditional regression coefficients based on the off-diagonal and diagonal elements of the sparse precision matrix; for each training sample, calculating conditional predicted values based on the beacon observations in its parent node set and the conditional regression coefficients; using the difference between the actual observations and the conditional predicted values as residuals; and calculating the mean and standard deviation of the residuals in each dimension.
6. The Bluetooth positioning method based on greedy sparse inverse covariance causal reasoning according to claim 1, characterized in that, Step 4) describes using the causal direction of the directed sparse skeleton to perform anomaly diagnosis on the online RSSI frame, which includes: calculating the conditional residual and standardized statistic for each dimension of the online RSSI frame; calculating the conditional residual based on the conditional regression coefficient and the set of parent nodes; subtracting the conditional residual from the mean of the training residual and dividing it by the sum of the standard deviation of the training residual and the regularization term to obtain the standardized statistic; setting a residual threshold, and marking the corresponding beacon as an anomaly candidate when the absolute value of the standardized statistic exceeds the residual threshold; and propagating the anomaly label only to downstream beacons based on the causal direction of the directed sparse skeleton.
7. The Bluetooth positioning method based on greedy sparse inverse covariance causal reasoning according to claim 1, characterized in that, Step 4) involves estimating the environment offset vector and performing offset correction, which includes: constructing a sparse residual operator based on the sparse precision matrix, using the set of dimensions that are not judged as anomalous as constraints, estimating the environment offset vector through weighted least squares iteration, and subtracting the environment offset vector from the online RSSI frame; and performing hard replacement on dimensions that still meet the anomalous conditions after offset correction, based on the conditional expectation of the parent node set.
8. The Bluetooth positioning method based on greedy sparse inverse covariance causal reasoning according to claim 1, characterized in that, Step 5) of the KNN fingerprint matching includes: calculating the Euclidean distance between the repaired RSSI vector and each training sample in the training fingerprint database, selecting a preset number of neighbor samples with the smallest distance, setting a weight inversely proportional to the distance for each neighbor sample, and performing a normalized weighted average of the coordinates of each neighbor sample to obtain the positioning coordinates.
9. A Bluetooth positioning system based on greedy sparse inverse covariance causal reasoning, characterized in that, It includes BLE beacon groups, BLE scanning modules, data preprocessing modules, causal inference engine modules, and host computer monitoring terminals; The BLE beacon group is used to periodically broadcast Bluetooth signals; The BLE scanning module is used to receive the broadcast signal of the BLE beacon group and buffer the RSSI timing; The data preprocessing module is used to perform median filtering, exponential moving average, and outlier marking on the RSSI time series. The causal inference engine module is used to learn a sparse precision matrix from RSSI training data and determine the causal direction in the offline stage, and to construct a directed sparse skeleton. In the online phase, based on this skeleton, anomaly diagnosis, environmental offset estimation, and causal-guided repair are performed on real-time RSSI frames to provide a denoised and clean input for KNN fingerprint matching. The causal reasoning engine module includes an offline training unit, a likelihood score direction discrimination unit, an online diagnosis unit, and an online repair unit; The offline training unit is used to calculate the covariance matrix of the centered sample based on the training fingerprint database, call the greedy sparse algorithm to estimate the sparse precision matrix, and learn the conditional independence structure between BLE beacon RSSIs from the data. The likelihood fraction direction discrimination unit is used to fit the causal relationship between two directions for each undirected edge in the sparse skeleton using a finite impulse response model. The causal direction is determined by comparing the log-likelihood fraction of the conditional residual variance, and the undirected skeleton is transformed into a directed sparse skeleton for determining the direction of anomaly propagation during subsequent online repair. The online diagnostic unit is used to calculate the conditional residuals dimension by dimension of the online RSSI frames, perform standardized tests to identify abnormal beacons, and simultaneously use a sparse precision matrix to back-estimate the environmental offset vector, so that the online RSSI distribution is aligned with the training set, thereby realizing dirty data diagnosis and environmental offset detection. The online repair unit is used to first perform overall offset correction on the RSSI frame using the environmental offset vector based on the diagnostic results; for abnormal beacons whose residuals still exceed the limit, hard replacement is performed using conditional expectation based on the causal structure of the directed sparse skeleton; finally, the repaired RSSI vector is output to the KNN fingerprint matching module to complete the localization. The host computer monitoring terminal is used to monitor training status, positioning accuracy, and model upgrades.
10. A Bluetooth positioning system based on greedy sparse inverse covariance causal reasoning according to claim 9, characterized in that, The data preprocessing module includes a median filtering submodule, a moving average submodule, and an outlier removal submodule; The median filtering submodule is used to perform median filtering on the RSSI timing of each beacon to remove short-time pulse interference; The moving average submodule is used to perform an exponential moving average with a preset decay factor within a preset time window. The outlier removal submodule is used to mark samples that deviate from the median by more than a preset decibel threshold within a single frame as suspicious values.
