FormalPara Key Summary Points

1. Repeat transcranial magnetic stimulation’s efficacy varies due to the complexity of patient conditions and disease progression

2. Unsupervised machine learning was employed to investigate the clinical characteristics of stroke patients suitable for repeat Transcranial Magnetic Stimulation (rTMS) treatment

3. Hierarchical clustering methods indicated that stroke patients with a better prognosis under rTMS treatment were more likely to be taking statins

4. The cohort study validated that among stroke patients undergoing rTMS treatment, those using statins were found to have a better prognosis

Introduction

Repetitive transcranial magnetic stimulation (rTMS) represents a principal non-invasive approach to post-stroke rehabilitation. rTMS has been shown to improve motor impairments, swallowing difficulties, cognitive impairments, and other neurological symptoms in stroke patients [1]. Low-frequency stimulation of the transcranial magnetic field inhibits excitability in the healthy hemisphere’s corresponding area, whereas high-frequency stimulation activates excitability in the affected hemisphere’s corresponding area. This modulation of hemispheric excitability restores the balance between the hemispheres in stroke patients [2]. The effects of transcranial magnetic stimulation, while time-limited, can be practical throughout the entire course of a stroke [3].

Despite its beneficial effects on neuro recovery throughout the stroke course, transcranial magnetic stimulation lacks standardized treatment parameters due to the complexity of its effects [4]. The complexity of determining an optimal transcranial magnetic stimulation treatment plan increases at different stroke stages, compounded by the absence of guidelines for a unified approach [4]. Further research is essential to elucidate how to maximize transcranial magnetic stimulation’s therapeutic effects and optimize treatment outcomes for target patients.

The complex spatiotemporal characteristics of patients’ clinical conditions and transcranial magnetic stimulation treatment processes challenge traditional statistical methods of analyzing data with intricate interactions. Consequently, machine learning methods have emerged as effective tools for addressing this issue [5, 6]. Machine learning methods can manage data with complex interactions and precisely analyze their impact on outcomes. Unsupervised machine learning enables the classification of complex disease features in patients and the individualized adjustment of treatment plans to optimize outcomes [5, 6].

This study employed unsupervised machine learning methods to identify clinical characteristics of patients suitable for transcranial magnetic stimulation and to validate the correlation between these characteristics and the therapeutic effects in a prospective cohort. This study aimed to optimize transcranial magnetic stimulation treatment plans for stroke rehabilitation through unsupervised machine learning methods.

Methods

Cohort 1: Explored Cohort

Patients

The cohort under study was a retrospective observational cohort. The cohort comprised consecutive patients with ischemic stroke who underwent rTMS treatment. Patients were recruited from the Rehabilitation Department of the Affiliated Hospital of Youjiang Medical University for Nationalities between June 1, 2020, and May 30, 2021.

Inclusion criteria included patients aged 18 years or older, undergoing rTMS within 1 month of stroke onset, and receipt of conventional medicine and rehabilitation therapy post-admission.

Exclusion criteria encompassed mortality within 1 month of stroke onset, contraindications for rTMS, presence of other neurological diseases, such as Parkinson’s disease, dementia, or epilepsy, and withdrawal from the study or inability to provide outcome data.

The study was conducted in accordance with the Declaration of Helsinki and adhered to the ethical standards of institutional and national research committees. The study was approved by the Ethics Committee of the Affiliated Hospital of Youjiang Medical University for Nationalities (KY-2018-03). Informed consent was secured from all participants included in the study.

Data Collected

Data on demographic characteristics (age, gender, etc.), medical history (history of stroke, hypertension, smoking, etc.), clinical characteristics (treatment methods, etc.), and laboratory findings (platelet count, blood glucose levels, serum lipid profiles, etc.) were collected from electronic clinical records. The patients’ National Institutes of Health Stroke Scale (NIHSS) and Modified Rankin Scale (mRS) scores were collected at admission and after rTMS treatment.

All patients underwent rTMS therapy for 2 weeks, with five sessions each week, totaling ten sessions of rTMS therapy. TMS was administered to the motor cortex of the healthy hemisphere at a frequency of 1 Hz for 15 min. The presence of motor-evoked potentials (MEPs) in response to transcranial magnetic stimulation (TMS) in the affected hemisphere was recorded.

Classify Data by Unsupervised Machine Learning

We used Python 3.8. For cluster analysis, after standardizing all data using the StandardScaler module from the sklearn library, we classified the data using two types of cluster analysis models: the K-means method (K-Means module, sklearn library) and Hierarchical Clustering methods (AgglomerativeClustering module, sklearn library). The Silhouette score could suggest the optimal number of groups for the K-means method, while the heatmap could suggest the optimal number for Hierarchical Clustering methods.

We compared outcome events across the different groups identified above. Grouping can yield clinical significance if it clarifies differences in outcomes or prognoses among the patient groups. We then applied chi-square tests, t-tests, or variance analysis to the different groups to analyze the characteristics of factors by the selected groups further. We found significant differences in statin use and MEPs across the prognosis groups. We then validated the impact of statin use on the relationship between rTMS and prognosis.

Cohort 2: Validated Cohort

Patients

The validated cohort was a prospective observational study. The validated cohort included consecutive patients with ischemic stroke undergoing rTMS. Patients were recruited from the Rehabilitation Department of the Affiliated Hospital of Youjiang Medical University for Nationalities between August 1, 2021, and June 30, 2023, with follow-up extending to December 31, 2023. Patients taking statins after onset were assigned to the statin group, while those not were assigned to the control group. Patients in the statin group continued to use statins throughout the follow-up period. The dosage and type of statins used are determined by the clinical doctors based on the patient’s condition and guidelines. Patients are regularly monitored for liver function and other potential side effects after using statins. If serious side effects occur, patients discontinue statin use and exit the study. Anticipating a 10% loss to follow-up, we initially recruited over 140 patients, guided by a previous study [7].

The inclusion criteria were the same as those for the exploratory cohort. The exclusion criteria were the same as the exploratory cohort and included patients who withdrew from the study or could not provide detailed information on statin use or outcome events.

Data Collected and Outcome

We collected clinical and electrophysiological data identical to those of the exploratory cohort. Outcome events encompassed the presence of MEP, favorable functional outcomes (FFO), and changes in the Fugl-Meyer Assessment (FMA) at 3- and 6-months post-onset. A FFO was defined as a Modified Rankin Scale (mRS) score of 2 or less. Scores for clinical scales and outcome events were assessed by experienced rehabilitation physicians blinded to the patients’ group assignments.

Statistical Analysis

Statistical analyses were conducted using SPSS 23.0 for Windows. For baseline data comparison, continuous variables with normal distribution were analyzed using a t-test, while those with abnormal distribution were assessed using non-parametric tests. Categorical and ranked data were analyzed using chi-square tests.

Chi-square tests were employed to compare MEP and FFO across different groups, while t-tests were used to assess changes in FMA. Subsequently, multifactor logistic regression was applied for FFO, and multifactor linear regression for changes in FMA. Forward and backward stepwise methods were utilized in the regression analyses. Data were stratified into subgroups based on gender (male, female), severity of illness (mild, severe), statin dosage (low, moderate, high), statin type (lipophilic, hydrophilic), and statin continuity (continuous, non-continuous). Mild severity of illness was defined as an mRS score of 0–2 at admission and severe as 3–5. Continuity of statin use was defined as consistent statin intake for 6 months post-discharge. The relationship between statin uses and prognosis was further analyzed in these subgroups. A p-value of < 0.05 was considered statistically significant.

Results

Cohort 1: Explored Cohort

The explored cohort included 115 patients. Forty-two were female (36.5%), and the mean age was 62.57 ± 14.001 years. Among the various stroke subtypes, there were 76 patients with large artery atherosclerosis stroke, 28 patients with cardioembolic stroke, and 11 patients with lacunar stroke and other subtypes.

The Silhouette score line for K-means methods suggested that three groups were recommended for grouping (Supplementary Material-Supplementary-Figure 1). The scatter plots of the three K-means groups showed that the data for each group did not have a clear distinction in the plot (Supplementary Material-Supplementary-Figure 2). The analysis of the three groups also showed no significant difference in prognosis. Therefore, the K-means method was not a better choice for the explored cohort.

The heatmap suggested that two groups (HCgroup1, HCgroup2) were better for hierarchical clustering methods (Fig. 1). The heatmap also indicated significant distinctions between MEP and statins in the figure (Fig. 1). Comparing the FFO after rTMS therapy between the two groups, HCgroup1 (77.8%) had a higher rate of FFO (p < 0.001) than HCgroup2 (44.2%). Thus, Hierarchical Clustering was a better choice for the explored cohort.

Fig. 1
figure 1

The heatmap of hierarchical clustering methods

When comparing data between HCgroup1 and HCgroup2, it was found that HCgroup1 had more patients with MEP (90.5% vs. 25.5%, p < 0.001), more patients taking statins (96.9% vs. 39.2%, p < 0.001), fewer patients experienced hemorrhage events (3.2% vs. 17.6%, p = 0.012), and lower NIHSS scores at admission (6.06 vs. 13.29, p < 0.001). The results were similar to another study in those patients with lower NIHSS scores at admission, fewer hemorrhage events, and the presence of MEP had a better prognosis [8]. However, the relationship between a higher rate of taking statins and a better prognosis for stroke patients undergoing rTMS therapy needs further validation.

Cohort 2: Validated Cohort

Patients

The cohort initially recruited 412 participants. Twenty-three patients withdrew from the study or were lost to follow-up, 13 were excluded according to the exclusion criteria, and 15 died within 1 month after onset. Ultimately, the validated cohort consisted of 361 eligible patients. The statin group included 290 patients, while the control group comprised 71. Among the various stroke subtypes, there were 291 patients with large artery atherosclerosis stroke, 87 patients with cardioembolic stroke, and 34 patients with lacunar stroke and other subtypes.

The mean age of the validated cohort was 64.76 ± 13.746 years. The cohort included 126 female patients (34.9%). To compare baseline data between the two groups, the statin group had higher diastolic blood pressure values at admission and more patients with infectious diseases. Other data between the two groups showed no significant difference (Table 1).

Table 1 Baseline characteristic and outcome data by univariate analysis

Outcome

(1) The MEP and FFO

The outcomes showed that the statin group had a higher MEP rate (57.1% vs. 38.9%, p = 0.006) than the control group (Table 1). Similarly, the statin group exhibited a higher FFO rate (70.9% vs. 52.8%, p = 0.003) at 3 months post-onset and (74.7% vs. 61.1%, p = 0.021) at 6 months post-onset compared to the control group (Table 1).

In multivariable logistic regression analysis, for FFO at 3 months, statin use (OR = 3.952, p = 0.001) and the presence of MEP (OR = 3.221, p = 0.004) were significantly associated with the outcomes. In contrast, a higher mRS score (OR = 0.312, p < 0.001) and complications from infectious diseases (OR = 0.264, p < 0.001) at admission were negatively associated with the outcomes (Table 2). For FFO at 6 months, statin use (OR = 2.740, p = 0.022), the presence of MEP (OR = 2.513, p < 0.001), a higher mRS score at admission (OR = 0.521, p = 0.004), and complications from infectious diseases (OR = 0.293, p = 0.001) at admission were all significant predictors of the outcomes (Table 2).

Table 2 Multivariate logistic regression for FFO

(2) The change in FMA

The statin group demonstrated a more significant change in FMA (p < 0.001) than the control group at 3 months post-onset (Table 1). Similarly, the statin group showed a more significant change in FMA (p < 0.001) at 6 months post-onset compared to the control group (Table 1).

In multivariable linear regression analysis, for the change in FMA at 3 months, statin use (B = 2.217, p < 0.001) was significantly associated with the outcomes, as was the presence of MEP (B = 1.105, p = 0.001), a higher INR (international normalized ratio) value (B = 2.835, p = 0.006), and a higher statin dosage (B = 0.864, p = 0.026). Conversely, a higher heart rate (B = − 0.021, p = 0.038) was negatively associated with the outcomes (Table 3). For the change in FMA at 6 months, statin use (B = 2.539, p < 0.001), the presence of MEP (B = 1.559, p < 0.001), and a higher INR value (B = 2.900, p = 0.007) were related to the outcomes (Table 3).

Table 3 Multivariate linear regression for change in FMA

Subgroup

In subgroup analysis, statin use remained significantly associated with changes in FMA at 3 months and 6 months across various subgroups: both male and female (p < 0.001), mild and severe (p < 0.001), across low, moderate, and high dosage groups (p < 0.001), and in both lipophilic and hydrophilic subgroups (p < 0.001), as well as the continuous and non-continuous subgroups (p < 0.001). Statin use continued to be significantly associated with FFO at 3 months (Fig. 2) in the male (p = 0.040) and female subgroups (p = 0.047), the low dose (p = 0.003), lipophilic (p = 0.047), hydrophilic (p = 0.040), continuous (p = 0.003), and non-continuous subgroups (p = 0.031). Statin use was also significantly associated with FFO at 6 months (Fig. 3) in the low dose (p = 0.021), lipophilic (p = 0.035), and continuous subgroups (p = 0.015).

Fig. 2
figure 2

The forest plot for subgroup analysis of statins and favorable functional outcome at 3 months

Fig. 3
figure 3

The forest plot for subgroup analysis of statins and favorable functional outcome at 6 months

Discussion

Unsupervised machine learning methods indicated that the group with a better prognosis for stroke under rTMS therapy had a higher number of patients taking statins. The validated cohort analysis revealed that the statins group exhibited a higher prevalence of MEP and FFO at 3- and 6-months post-onset, along with more significant improvements in FMA at these time points. Across different genders, illness severities, statin dosages, types of statins, and statin usage continuity, statin use continued to be associated with more significant improvements in FMA. Furthermore, statin use remained associated with FFO at 3 months for different genders, types of statins, statin usage continuity, and the low-dose statins subgroup. Statin use was also associated with FFO in the low-dose, lipophilic, and continuous subgroups at 6 months.

Stroke is characterized by complex pathological processes, with the neuroinflammatory response playing a crucial role in post-stroke damage and repair processes, considered a potentially effective target for stroke treatment [9, 10]. By modulating immune cells and inflammatory cytokines, transcranial magnetic stimulation can enhance damage repair and facilitate recovery in patients at various stages of stroke [11]. Statins and repetitive transcranial magnetic stimulation enhance stroke recovery through modulation of neuroimmune inflammatory responses [12, 13]. However, these interventions modulate neuroimmune inflammatory responses through distinct mechanisms.

For instance, statins inhibit lymphocyte migration and proliferation, while transcranial magnetic stimulation encourages the conversion of immune cells into an anti-inflammatory phenotype [11, 14,15,16]. Hence, statins and rTMS can collaboratively exert anti-neuroimmune inflammatory effects through distinct pathways. In the acute and subacute phases of stroke, when the damaging impact of neuroinflammation is more pronounced, hospitalized patients may receive combined rTMS and statin therapy to enhance neuroimmune inflammatory regulation, thereby mitigating stroke damage [14,15,16,17,18]. In the chronic phase, the convenience of statin use enables long-term inflammatory response regulation for stroke damage repair [14,15,16,17,18]. Consequently, this combination therapy can more accurately and effectively modulate neuroinflammatory responses at various stages of stroke, reducing neural damage and facilitating damage repair.

Unsupervised machine learning is a statistical approach to discovering some underlying structures in unlabeled data [19]. It is increasingly utilized in medical research to identify new potential classification methods or risk factors [20]. When the optimal number of clusters is uncertain, hierarchical clustering is better, generating a nested, tree-like classification structure [19]. An advantage includes its flexibility for clusters of varying shapes and sizes without predetermining cluster numbers. Additionally, this algorithm generates a hierarchical cluster structure, facilitating analysis and visualization [17]. This study’s hierarchical clustering outperformed K-means clustering in classification results.

Subgroup analysis results confirm that gender, disease severity, and statin characteristics do not influence the significant FMA changes in patients using statins after receiving repeated transcranial magnetic stimulation therapy, with these benefits observed at both 3 and 6 months. This indicates benefits across the subacute and chronic phases when using statins [21]. Nevertheless, statin benefits were not apparent in FFO. The lipophilic statins subgroup showed benefits at 3 and 6 months, whereas the hydrophilic statins subgroup only showed benefits at 3 months. This suggests that statin action duration and benefits may vary by type [22]. Dosage influence stems from a lower proportion of patients on medium to high doses of statins, leading to inadequate statistical power but sufficiently indicating low-dose statin benefits. For less lacunar stroke patients in cohort, we did not analysis the lacunar stroke patient’s subgroup. The further study about effect of combination therapy for lacunar stroke was necessary for these patients could had a better prognosis with rTMS [23].

Our study had several limitations. First, the number of patients in the medium to high-dose statins subgroup was smaller because low-dose statins are commonly used in Asian patients. However, the observed benefits from low-dose statin use suggest that patients might benefit more from medium to high doses of statins, given the properties of statins. Second, with the study’s population primarily consisting of Chinese patients, further validation in other regions is necessitated. Finally, the combination effects of rTMS at different frequencies and locations vary [4]. rTMS treatment requires various stimulation frequencies and locations, complicating the treatment plan and hindering standardization [4]. Therefore, further research is needed to explore whether the benefits of statin use during rTMS treatment are influenced by different treatment protocols.

Conclusion

In summary, the findings from unsupervised machine learning indicated that rTMS treatment had a more favorable outcome for ischemic stroke patients using statins. Analysis of the validated cohort revealed that stroke patients receiving rTMS treatment experienced enhanced FMA scores at 3 and 6 months when using statins. Individuals taking statins demonstrated a higher incidence of MEP.

Statin users, particularly in the low-dose and different types of statins subgroups, showed increased FFO at 3 months. In the low-dose, lipophilic, and continuous subgroups, statin users also demonstrated increased FFO at 6 months. Statin use was associated with a better prognosis in stroke patients undergoing rTMS treatment.