Dyscoordination of thalamic reticular spindles is associated with social memory deficits in mice and humans with autism spectrum disorder.
The 3 matches
- [1] § Methods › Machine learning model ↔ Machine_Learning.m, lines 1–143 · score 0.92 · fold cross validation, Hyperparameter tuning, distance weighted, logistic regression, optimal, stratified
- [2] § Results › The characteristics of sleep spindles can be used to predict ASD ↔ Machine_Learning.m, lines 1–143 · score 0.84 · fold cross validation, distance weighted, logistic regression, machine learning, hyperparameters, optimal
- [3] § Results › The characteristics of sleep spindles can be used to predict ASD ↔ Machine_Learning.m, lines 212–235 · score 0.56 · Confusion matrix, logistic regression, machine learning, box, KNN, SVM
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
MATLAB · 698 lines · 22 KB · CC-BY-4.0 · 3 matches
- %% Prepare the data
- data = readtable('machinelearning.xlsx');
- feature_names = data.Properties.VariableNames(2:6);
- X = data{:, 2:6}; % characteristics
- Y = data{:, 1}; % Predictors
- % Divide the training/test set
- rng(3407);
- test_ratio = 0.2;
- cv = cvpartition(Y, 'HoldOut', test_ratio, 'Stratify', true);
- train_idx = training(cv);
- test_idx = test(cv);
- % Extract training and test sets
- X_train = X(train_idx, :);
- Y_train = Y(train_idx);
- X_test = X(test_idx, :);
- Y_test = Y(test_idx);
- % Calculate standardized parameters on the training set
- mu = mean(X_train, 1);
- sigma = std(X_train, 0, 1);
- % Standardize the training and test sets using the training set parameters respectively
- X_train = (X_train - mu) ./ sigma;
- X_test = (X_test - mu) ./ sigma;
- % The complete, standardized data (used only for visualization, not for training)
- X_all = zeros(size(X));
- X_all(train_idx, :) = X_train;
- X_all(test_idx, :) = X_test;
- X = X_all;
- % Hyperparameter tuning using 5-fold cross-validation
- lambda_values = logspace(-4, 0, 10); % Regularization parameters for logistic regression
- C_values = logspace(-2, 2, 10); % BoxConstraint of SVM
- k_values = 1:2:15; % KNN's number of neighbors
- % 5-fold cross-validation
- kfold = 5;
- cv_kfold = cvpartition(Y_train, 'KFold', kfold, 'Stratify', true);
- % Initialize optimal hyperparameters and accuracy
- best_lambda = 0;
- best_C = 0;
- best_k = 0;
- best_accuracy_logreg = 0;
- best_accuracy_svm = 0;
- best_accuracy_knn = 0;
- % Logistic Regression Hyperparameter Tuning
- for lambda = lambda_values
- accuracies = zeros(kfold, 1);
- for fold = 1:kfold
- train_fold_idx = training(cv_kfold, fold);
- val_fold_idx = test(cv_kfold, fold);
- X_train_fold = X_train(train_fold_idx, :);
- Y_train_fold = Y_train(train_fold_idx);
- X_val_fold = X_train(val_fold_idx, :);
- Y_val_fold = Y_train(val_fold_idx);
- model = fitclinear(X_train_fold, Y_train_fold, ...
- 'Learner', 'logistic', 'Regularization', 'ridge', ...
- 'Lambda', lambda);
- pred = predict(model, X_val_fold);
- accuracies(fold) = mean(pred == Y_val_fold);
- end
- mean_accuracy = mean(accuracies);
- if mean_accuracy > best_accuracy_logreg
- best_accuracy_logreg = mean_accuracy;
- best_lambda = lambda;
- end
- end
- % SVM Hyperparameter Tuning
- for C = C_values
- accuracies = zeros(kfold, 1);
- for fold = 1:kfold
- train_fold_idx = training(cv_kfold, fold);
- val_fold_idx = test(cv_kfold, fold);
- X_train_fold = X_train(train_fold_idx, :);
- Y_train_fold = Y_train(train_fold_idx);
- X_val_fold = X_train(val_fold_idx, :);
- Y_val_fold = Y_train(val_fold_idx);
- model = fitcsvm(X_train_fold, Y_train_fold, ...
- 'KernelFunction', 'linear', 'BoxConstraint', C);
- pred = predict(model, X_val_fold);
- accuracies(fold) = mean(pred == Y_val_fold);
- end
- mean_accuracy = mean(accuracies);
- if mean_accuracy > best_accuracy_svm
- best_accuracy_svm = mean_accuracy;
- best_C = C;
- end
- end
- % KNN Hyperparameter Tuning
- for k = k_values
- accuracies = zeros(kfold, 1);
- for fold = 1:kfold
- train_fold_idx = training(cv_kfold, fold);
- val_fold_idx = test(cv_kfold, fold);
- X_train_fold = X_train(train_fold_idx, :);
- Y_train_fold = Y_train(train_fold_idx);
- X_val_fold = X_train(val_fold_idx, :);
- Y_val_fold = Y_train(val_fold_idx);
- model = fitcknn(X_train_fold, Y_train_fold, ...
- 'NumNeighbors', k, 'DistanceWeight', 'squaredinverse');
- pred = predict(model, X_val_fold);
- accuracies(fold) = mean(pred == Y_val_fold);
- end
- mean_accuracy = mean(accuracies);
- if mean_accuracy > best_accuracy_knn
- best_accuracy_knn = mean_accuracy;
- best_k = k;
- end
- end
- % Train the final model using optimal hyperparameters
- models = struct();
- models.LogReg = fitclinear(X_train, Y_train, ...
- 'Learner', 'logistic', 'Regularization', 'ridge', ...
- 'Lambda', best_lambda);
- models.SVM = fitcsvm(X_train, Y_train, ...
- 'KernelFunction', 'linear', 'BoxConstraint', best_C);
- models.KNN = fitcknn(X_train, Y_train, ...
- 'NumNeighbors', best_k, 'DistanceWeight', 'squaredinverse');
- Y_pred = struct();
- for model_name = fieldnames(models)'
- model = models.(model_name{1});
- Y_pred.(model_name{1}) = predict(model, X_test);
- end
- for model_name = fieldnames(models)'
- pred = Y_pred.(model_name{1});
- accuracy = mean(pred == Y_test);
- fprintf('%s 测试集准确率: %.4f\n', model_name{1}, accuracy);
- end
- %% t-SNE dimensionality reduction
- rng(3407);
- X_tsne = tsne(X_all, 'NumDimensions', 2, 'Perplexity', 15, 'Verbose', 1);
- % Generate predictions
- all_pred = struct();
- for model_name = fieldnames(models)'
- model = models.(model_name{1});
- all_pred.(model_name{1}) = predict(model, X_all);
- end
- figure('Position', [100, 100, 1200, 900], 'Color', 'white')
- % Define color scheme
- class_colors = [
- 0.00, 0.45, 0.74;
- 0.85, 0.33, 0.10;
- 0.93, 0.69, 0.13;
- ];
- model_names = {'LogReg', 'SVM', 'KNN'};
- titles = {'Logistic Regression', 'SVM (Linear Kernel)', 'KNN (k=10)'};
- for i = 1:3
- subplot(2, 2, i)
- hold on
- pred = all_pred.(model_names{i});
- train_class1 = train_idx & (pred == 1);
- h_train1 = scatter(X_tsne(train_class1, 1), X_tsne(train_class1, 2), 70, ...
- 'o', 'MarkerFaceColor', class_colors(1,:), ...
- 'MarkerEdgeColor', 'k', 'LineWidth', 1);
- train_class2 = train_idx & (pred == 2);
- h_train2 = scatter(X_tsne(train_class2, 1), X_tsne(train_class2, 2), 70, ...
- 'o', 'MarkerFaceColor', class_colors(2,:), ...
- 'MarkerEdgeColor', 'k', 'LineWidth', 1);
- test_class1 = test_idx & (pred == 1);
- h_test1 = scatter(X_tsne(test_class1, 1), X_tsne(test_class1, 2), 80, ...
- 's', 'MarkerFaceColor', class_colors(1,:), ...
- 'MarkerEdgeColor', class_colors(3,:), 'LineWidth', 1.5);
- test_class2 = test_idx & (pred == 2);
- h_test2 = scatter(X_tsne(test_class2, 1), X_tsne(test_class2, 2), 80, ...
- 's', 'MarkerFaceColor', class_colors(2,:), ...
- 'MarkerEdgeColor', class_colors(3,:), 'LineWidth', 1.5);
- title(titles{i}, 'FontSize', 12, 'FontWeight', 'bold')
- xlabel('t-SNE Dimension 1')
- ylabel('t-SNE Dimension 2')
- grid on
- set(gca, 'FontSize', 10)
- if i == 1
- legend_handles = [h_train1, h_train2, h_test1, h_test2];
- legend_labels = {'Train: Class 1', 'Train: Class 2', ...
- 'Test: Class 1', 'Test: Class 2'};
- valid_handles = isgraphics(legend_handles);
- legend(legend_handles(valid_handles), legend_labels(valid_handles), ...
- 'Location', 'bestoutside', 'FontSize', 9)
- end
- end
- %% Confusion Matrix Visualization
- model_names = {'LogReg', 'SVM', 'KNN'};
- full_names = {'Logistic Regression', 'SVM', 'KNN'};
- figure('Position', [100, 100, 1200, 400], 'Color', 'white')
- for i = 1:3
- subplot(1, 3, i)
- pred = Y_pred.(model_names{i});
- cm = confusionchart(Y_test, pred);
- cm.Title = full_names{i};
- cm.FontSize = 12;
- accuracy = sum(pred == Y_test) / numel(Y_test);
- annotation('textbox', [0.3 + (i-1)*0.33, 0.05, 0.1, 0.05], ...
- 'String', sprintf('Accuracy: %.1f%%', accuracy*100), ...
- 'FitBoxToText', 'on', ...
- 'FontSize', 11, ...
- 'FontWeight', 'bold', ...
- 'BackgroundColor', 'w', ...
- 'EdgeColor', 'none');
- end
- %% ROC curve
- figure('Position', [100, 100, 1200, 400], 'Color', 'white')
- colors = [
- 0.00, 0.45, 0.74;
- 0.85, 0.33, 0.10;
- 0.49, 0.18, 0.56;
- ];
- AUC = zeros(1, 3);
- AUC_CI = cell(1, 3);
- for i = 1:3
- subplot(1, 3, i)
- hold on
- model = models.(model_names{i});
- [~, scores] = predict(model, X_test);
- pos_class = 2;
- pos_class_prob = scores(:, 2);
- [X_roc, Y_roc, ~, ~] = perfcurve(Y_test, pos_class_prob, pos_class);
- [auc, ci] = delong_auc_ci(Y_test, pos_class_prob, 0.05);
- fprintf('AUC: %.3f\n', auc);
- fprintf('95%% CI: [%.3f, %.3f]\n', ci(1), ci(2));
- plot(X_roc, Y_roc, 'LineWidth', 2.5, 'Color', colors(i, :))
- plot([0, 1], [0, 1], 'k--', 'LineWidth', 1.5, 'Color', [0.5, 0.5, 0.5])
- title(sprintf('%s (AUC = %.3f)', full_names{i}, auc), 'FontSize', 12)
- xlabel('False Positive Rate', 'FontSize', 10)
- ylabel('True Positive Rate', 'FontSize', 10)
- grid on
- axis square
- set(gca, 'FontSize', 10)
- text(0.6, 0.2, sprintf('AUC = %.3f', auc), 'FontSize', 11, 'FontWeight', 'bold')
- end
- %% Performance Indicator Comparison
- metrics = struct();
- metrics_names = {'Accuracy', 'Precision', 'Recall', 'F1'};
- for i = 1:3
- pred = Y_pred.(model_names{i});
- cm = confusionmat(Y_test, pred);
- TP = cm(2,2);
- TN = cm(1,1);
- FP = cm(1,2);
- FN = cm(2,1);
- metrics(i).Accuracy = (TP + TN) / sum(cm(:));
- metrics(i).Precision = TP / (TP + FP);
- metrics(i).Recall = TP / (TP + FN);
- metrics(i).F1 = 2 * (metrics(i).Precision * metrics(i).Recall) / ...
- (metrics(i).Precision + metrics(i).Recall);
- n = numel(Y_test);
- z = 1.96;
- se_acc = sqrt(metrics(i).Accuracy * (1 - metrics(i).Accuracy) / n);
- metrics(i).Accuracy_CI = [max(0, metrics(i).Accuracy - z*se_acc), ...
- min(1, metrics(i).Accuracy + z*se_acc)];
- se_prec = sqrt(metrics(i).Precision * (1 - metrics(i).Precision) / (TP + FP));
- metrics(i).Precision_CI = [max(0, metrics(i).Precision - z*se_prec), ...
- min(1, metrics(i).Precision + z*se_prec)];
- se_rec = sqrt(metrics(i).Recall * (1 - metrics(i).Recall) / (TP + FN));
- metrics(i).Recall_CI = [max(0, metrics(i).Recall - z*se_rec), ...
- min(1, metrics(i).Recall + z*se_rec)];
- se_f1 = 0.05;
- metrics(i).F1_CI = [max(0, metrics(i).F1 - se_f1), ...
- min(1, metrics(i).F1 + se_f1)];
- end
- result_table = table();
- result_table.Model = full_names';
- for m = 1:numel(metrics_names)
- metric_name = metrics_names{m};
- values = [metrics.(metric_name)]';
- ci_lower = arrayfun(@(i) metrics(i).([metric_name '_CI'])(1), 1:3)';
- ci_upper = arrayfun(@(i) metrics(i).([metric_name '_CI'])(2), 1:3)';
- result_table.(metric_name) = values;
- result_table.([metric_name '_CI']) = arrayfun(@(i) sprintf('[%.3f-%.3f]', ci_lower(i), ci_upper(i)), 1:3, 'UniformOutput', false)';
- end
- disp('Comprehensive performance report:')
- disp(result_table)
- %% Robustness analysis
- num_bootstraps = 1000;
- bootstrap_results = struct();
- metrics_names = {'Accuracy', 'Precision', 'Recall', 'F1'};
- for i = 1:3
- for m = 1:length(metrics_names)
- bootstrap_results(i).(metrics_names{m}) = zeros(1, num_bootstraps);
- end
- end
- test_positions = find(test_idx);
- n_test = numel(test_positions);
- % Bootstrap
- rng(1);
- for b = 1:num_bootstraps
- sample_idx = randsample(n_test, n_test, true);
- Y_boot = Y_test(sample_idx);
- for i = 1:3
- model_name = model_names{i};
- pred_all = Y_pred.(model_name);
- pred_boot = pred_all(sample_idx);
- if length(Y_boot) ~= length(pred_boot)
- error('标签长度不一致');
- end
- TP = sum((Y_boot == 2) & (pred_boot == 2));
- TN = sum((Y_boot == 1) & (pred_boot == 1));
- FP = sum((Y_boot == 1) & (pred_boot == 2));
- FN = sum((Y_boot == 2) & (pred_boot == 1));
- total = TP + TN + FP + FN;
- if total == 0
- accuracy = NaN;
- precision = NaN;
- recall = NaN;
- f1 = NaN;
- else
- accuracy = (TP + TN) / total;
- precision = TP / (TP + FP + eps);
- recall = TP / (TP + FN + eps);
- f1 = 2 * (precision * recall) / (precision + recall + eps);
- end
- bootstrap_results(i).Accuracy(b) = accuracy;
- bootstrap_results(i).Precision(b) = precision;
- bootstrap_results(i).Recall(b) = recall;
- bootstrap_results(i).F1(b) = f1;
- end
- end
- % CV
- cv_results = struct();
- for i = 1:3
- for m = 1:length(metrics_names)
- metric = metrics_names{m};
- valid_data = bootstrap_results(i).(metric)(~isnan(bootstrap_results(i).(metric)));
- mean_val = mean(valid_data);
- std_val = std(valid_data);
- cv_results(i).(metric) = (std_val / mean_val) * 100;
- end
- end
- figure('Position', [100, 100, 1200, 900], 'Color', 'white', 'Name', 'Model robustness analysis');
- model_colors = [
- 0.00, 0.45, 0.74;
- 0.85, 0.33, 0.10;
- 0.93, 0.69, 0.13;
- ];
- metrics_names = {'Accuracy', 'Precision', 'Recall', 'F1'};
- metric_labels = {'Accuracy', 'Precision', 'Recall', 'F1 score'};
- for m = 1:length(metrics_names)
- subplot(2, 2, m)
- hold on
- grid on
- metric_name = metrics_names{m};
- data = cell(1, 3);
- cv_values = zeros(1, 3);
- for i = 1:3
- valid_data = bootstrap_results(i).(metric_name)(~isnan(bootstrap_results(i).(metric_name)));
- data{i} = valid_data;
- cv_values(i) = cv_results(i).(metric_name);
- end
- boxplot([data{1}; data{2}; data{3}]', 'Labels', model_display_names, ...
- 'Colors', model_colors, 'Symbol', '')
- means = cellfun(@mean, data);
- for i = 1:3
- line([i-0.4, i+0.4], [means(i), means(i)], ...
- 'Color', 'k', 'LineWidth', 1.5)
- text(i, max(data{i}) + 0.01, ...
- sprintf('CV: %.1f%%', cv_values(i)), ...
- 'HorizontalAlignment', 'center', ...
- 'FontSize', 10, 'FontWeight', 'bold', ...
- 'Color', model_colors(i, :));
- end
- for i = 1:3
- x = i + (rand(size(data{i})) - 0.5) * 0.2;
- scatter(x, data{i}, 40, ...
- 'MarkerFaceColor', model_colors(i, :), ...
- 'MarkerFaceAlpha', 0.4, ...
- 'MarkerEdgeColor', 'none');
- end
- title([metric_labels{m} ' 分布 (Bootstrap)'], 'FontSize', 12, 'FontWeight', 'bold')
- ylabel(metric_labels{m}, 'FontSize', 10)
- ylim([0.5, 1.05])
- set(gca, 'FontSize', 10)
- plot(xlim, [0.8, 0.8], 'k--', 'LineWidth', 0.8, 'Color', [0.5, 0.5, 0.5])
- end
- annotation('textbox', [0.15, 0.01, 0.7, 0.04], 'String', ...
- 'CV', ...
- 'EdgeColor', 'none', 'HorizontalAlignment', 'center', 'FontSize', 10);
- cv_table = table();
- cv_table.labels = metric_labels';
- for i = 1:3
- cv_values = [
- cv_results(i).Accuracy;
- cv_results(i).Precision;
- cv_results(i).Recall;
- cv_results(i).F1;
- ];
- cv_table.(model_display_names{i}) = round(cv_values, 1);
- end
- disp('变异系数汇总表 (CV%):');
- disp(cv_table);
- %% Permutation test
- if ~exist('models', 'var') || ~isstruct(models)
- error('Models structure not found. Please train models first.');
- end
- model_names = fieldnames(models);
- num_permutations = 100;
- feature_importance = zeros(size(X,2), numel(model_names));
- test_positions = find(test_idx);
- n_test = numel(test_positions);
- for f = 1:size(X,2)
- fprintf('Processing feature %d/%d: %s\n', f, size(X,2), feature_names{f});
- X_perm = X;
- for m = 1:numel(model_names)
- model_name = model_names{m};
- model = models.(model_name);
- base_pred = predict(model, X(test_positions, :));
- base_acc = mean(base_pred == Y(test_positions));
- perm_acc = zeros(num_permutations, 1);
- for p = 1:num_permutations
- perm_indices = randperm(n_test);
- X_perm(test_positions, f) = X(test_positions(perm_indices), f);
- perm_pred = predict(model, X_perm(test_positions, :));
- perm_acc(p) = mean(perm_pred == Y(test_positions));
- end
- feature_importance(f, m) = base_acc - mean(perm_acc);
- fprintf(' - %s: Importance = %.4f\n', model_name, feature_importance(f, m));
- end
- end
- figure('Position', [100, 100, 800, 600], 'Color', 'white');
- bar(feature_importance);
- title('Feature Importance via Permutation Test', 'FontSize', 14, 'FontWeight', 'bold');
- xlabel('Features', 'FontSize', 12);
- ylabel('Decrease in Accuracy', 'FontSize', 12);
- xticklabels(feature_names);
- legend(model_names, 'Location', 'bestoutside');
- grid on;
- set(gca, 'FontSize', 10, 'XTickLabelRotation', 45);
- p_values = zeros(size(X,2), numel(model_names));
- for f = 1:size(X,2)
- for m = 1:numel(model_names)
- null_distribution = -abs(feature_importance(f, m)) + 2*abs(feature_importance(f, m))*rand(1000, 1); % 零分布
- p_values(f, m) = mean(null_distribution >= feature_importance(f, m));
- end
- end
- significance = cell(size(p_values));
- for f = 1:size(X,2)
- for m = 1:numel(model_names)
- if p_values(f, m) < 0.001
- significance{f, m} = '***';
- elseif p_values(f, m) < 0.01
- significance{f, m} = '**';
- elseif p_values(f, m) < 0.05
- significance{f, m} = '*';
- else
- significance{f, m} = '';
- end
- end
- end
- hold on;
- for f = 1:size(X,2)
- for m = 1:numel(model_names)
- x_pos = f + (m-1)/(numel(model_names)+1) - 0.5;
- y_pos = feature_importance(f, m) + 0.01 * sign(feature_importance(f, m));
- text(x_pos, y_pos, significance{f, m}, ...
- 'HorizontalAlignment', 'center', ...
- 'FontSize', 12, ...
- 'FontWeight', 'bold');
- end
- end
- hold off;
- fprintf('\nSignificant features (p < 0.05):\n');
- for m = 1:numel(model_names)
- fprintf('Model: %s\n', model_names{m});
- for f = 1:size(X,2)
- if p_values(f, m) < 0.05
- fprintf(' - %s: importance = %.4f, p = %.4f%s\n', ...
- feature_names{f}, feature_importance(f, m), p_values(f, m), significance{f, m});
- end
- end
- end
- figure('Position', [100, 100, 1000, 800], 'Color', 'white');
- set(gcf, 'Units', 'normalized');
- barh(feature_importance);
- title('Feature Importance via Permutation Test', 'FontSize', 16, 'FontWeight', 'bold');
- ylabel('Features', 'FontSize', 14);
- xlabel('Decrease in Accuracy', 'FontSize', 14);
- yticklabels(feature_names);
- set(gca, 'FontSize', 12, 'YTick', 1:size(X,2), 'YDir', 'reverse');
- legend(model_names, 'Location', 'bestoutside');
- grid on;
- ax = gca;
- ax.YAxis.FontSize = 10;
- ax.Position = [0.25 0.15 0.7 0.75];
- hold on;
- for f = 1:size(X,2)
- for m = 1:numel(model_names)
- y_pos = f;
- x_pos = feature_importance(f, m);
- if x_pos >= 0
- text_pos = x_pos + 0.005;
- horz_align = 'left';
- else
- text_pos = x_pos - 0.005;
- horz_align = 'right';
- end
- text(text_pos, y_pos, significance{f, m}, ...
- 'HorizontalAlignment', horz_align, ...
- 'VerticalAlignment', 'middle', ...
- 'FontSize', 12, ...
- 'FontWeight', 'bold');
- end
- end
- hold off;
- %% SHAP Feature Analysis
- model_names = {'LogReg', 'SVM', 'KNN'};
- model_display_names = {'Logistic Regression', 'SVM', 'KNN'};
- reference = mean(X(train_idx, :), 1);
- num_samples = min(50, sum(test_idx));
- sample_indices = find(test_idx);
- sample_indices = sample_indices(1:min(num_samples, length(sample_indices)));
- X_samples = X(sample_indices, :);
- predict_functions = cell(1, 3);
- predict_functions{1} = @(x) predictProbability(models.LogReg, x);
- predict_functions{2} = @(x) predictProbability(models.SVM, x);
- predict_functions{3} = @(x) predictProbability(models.KNN, x);
- shap_results = struct();
- for model_idx = 1:3
- fprintf('\n===== Model being analyzed: %s =====\n', model_display_names{model_idx});
- predictFunction = predict_functions{model_idx};
- shapValues = zeros(length(sample_indices), size(X,2));
- for i = 1:length(sample_indices)
- fprintf('Calculate the SHAP value: Sample %d/%d\n', i, length(sample_indices));
- sample = X_samples(i, :);
- shapValues(i, :) = kernelSHAP_fixed(predictFunction, sample, reference);
- end
- shap_results.(model_names{model_idx}).values = shapValues;
- shap_results.(model_names{model_idx}).mean_abs = mean(abs(shapValues), 1);
- figure('Position', [100, 100, 1000, 800], 'Color', 'white');
- plotHorizontalSHAPSummary2(shapValues, X_samples, feature_names, model_display_names{model_idx});
- saveas(gcf, sprintf('horizontal_shap_summary_%s.png', model_names{model_idx}));
- end
- figure('Position', [100, 100, 1200, 800], 'Color', 'white', 'Name', 'SHAP');
- importance_matrix = zeros(length(feature_names), 3);
- for i = 1:3
- importance_matrix(:, i) = shap_results.(model_names{i}).mean_abs';
- end
- mean_importance = mean(importance_matrix, 2);
- [~, idx] = sort(mean_importance, 'descend');
- sorted_features = feature_names(idx);
- h = barh(importance_matrix(idx, :), 'grouped');
- set(gca, 'YTick', 1:length(sorted_features), 'YTickLabel', sorted_features);
- colors = lines(3);
- for i = 1:3
- h(i).FaceColor = colors(i, :);
- h(i).FaceAlpha = 0.8;
- end
- for j = 1:length(sorted_features)
- for i = 1:3
- value = importance_matrix(idx(j), i);
- text(value + 0.005, j, ...
- sprintf('%.3f', value), ...
- 'HorizontalAlignment', 'left', ...
- 'VerticalAlignment', 'middle', ...
- 'FontSize', 9, 'Color', colors(i, :));
- end
- end
- title('SHAP', 'FontSize', 16, 'FontWeight', 'bold');
- xlabel('|SHAP|', 'FontSize', 14);
- ylabel('Feature', 'FontSize', 14);
- legend(model_display_names, 'Location', 'bestoutside');
- grid on;
- annotation('textbox', [0.15, 0.01, 0.7, 0.05], 'String', ...
- 'SHAP', ...
- 'EdgeColor', 'none', 'HorizontalAlignment', 'center', 'FontSize', 11);
Machine_Learning.m, under CC-BY-4.0 · at the source
Overview
- Department of Psychiatry and Center for Brain Science, The First Affiliated Hospital of Xi’an Jiaotong University, Xi’an, China
- Department of Anesthesiology and Perioperative Medicine, The First Affiliated Hospital of Xi’an Jiaotong University, Xi’an, China
- Xi’an TCM Hospital of Encephalopathy, Shaanxi University of Chinese Medicine, Xi’an, China
- Department of Pediatrics, Yan’an People’s Hospital, Yan’an, China
- Brain Assessment and Intervention Laboratory, Tianjin Anding Hospital, Mental Health Center of Tianjin Medical University, Tianjin, China
- School of Aerospace Engineering, Xi’an Jiaotong University, Xi’an, China
- The Key Laboratory of Biomedical Information Engineering of Ministry of Education, Department of Biomedical Engineering, School of Life Science and Technology, Xi’an Jiaotong University, Xi’an, China
- Neuroscience Research Center, National Key Laboratory for High Energy Pulsed Power, Key Laboratory of Biomedical Information Engineering of Ministry of Education, School of Life Science and Technology, Xi’an Jiaotong University, Xi’an, 710049 China
- Shaanxi Provincial Key Laboratory of Biological Psychiatry, The First Affiliated Hospital of Xi’an Jiaotong University, Xi’an, China
- Shaanxi Belt and Road Joint Laboratory of Precision Medicine in Psychiatry, The First Affiliated Hospital of Xi’an Jiaotong University, Xi’an, China
Abstract
The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.
Repository
Its files are read in the Code ↔ Paper reader above, with 3 matches between paragraphs and lines of code.
Zenodo 20755328
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
- 27 September 2026: the link answers (HTTP 200)
5 files
- Machine_Learning.m, MATLAB, 698 lines, 3 matches
- delong_auc_ci.m, MATLAB, 57 lines
- kernelSHAP_fixed.m, MATLAB, 54 lines
- plotHorizontalSHAPSummar
y2.m , MATLAB, 80 lines - predictProbability.m, MATLAB, 30 lines
Code availability statement
The paper has a code availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:
- it points to the authors' code: Zenodo 20755328
Read it in the paper: doi.org/10.1038/s41467-026-75162-x.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 5 scripts, each with its path and the digest of its content;
- 3 matches between paragraphs of the paper and lines of the code (method lexical-v1);
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
Datasets cited
- figshare:32345421, at figshare; found in DataCite
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 27 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 20 authors, 4 keywords, 17 MeSH terms, 63 references.
Cite
This paper
Cui, D., Wang, X., Ai, R., Gao, F., Sun, H., Zhang, Y., Lyu, Y., Zhang, Z., Li, W., Qin, Y., Guo, Y., Liu, Y., Zhao, N., Wang, J., Li, S., Wu, Y., Zhang, S., Wang, C., Wang, F., & Li, Y. (2026). Dyscoordination of thalamic reticular spindles is associated with social memory deficits in mice and humans with autism spectrum disorder. Nature communications, 17(1), 8960. https://
BibTeX
@article{cui2026dyscoord
author = {Cui, Dongqi and Wang, Xiaodan and Ai, Ruosong and Gao, Feng and Sun, Huan and Zhang, Ying and Lyu, Yixuan and Zhang, Zhijie and Li, Wen and Qin, Yuhang and Guo, Yuxi and Liu, Yinxia and Zhao, Ningxia and Wang, Juan and Li, Shen and Wu, Ying and Zhang, Siyuan and Wang, Changhe and Wang, Feidi and Li, Yan},
title = {{Dyscoordination of thalamic reticular spindles is associated with social memory deficits in mice and humans with autism spectrum disorder}},
journal = {Nature communications},
year = {2026},
month = jul,
volume = {17},
number = {1},
pages = {8960},
publisher = {Nature Publishing Group},
issn = {2041-1723},
doi = {10.1038/
url = {https://
pmid = {42637729},
pmcid = {PMC13503877}
}
RIS
TY - JOUR
AU - Cui, Dongqi
AU - Wang, Xiaodan
AU - Ai, Ruosong
AU - Gao, Feng
AU - Sun, Huan
AU - Zhang, Ying
AU - Lyu, Yixuan
AU - Zhang, Zhijie
AU - Li, Wen
AU - Qin, Yuhang
AU - Guo, Yuxi
AU - Liu, Yinxia
AU - Zhao, Ningxia
AU - Wang, Juan
AU - Li, Shen
AU - Wu, Ying
AU - Zhang, Siyuan
AU - Wang, Changhe
AU - Wang, Feidi
AU - Li, Yan
TI - Dyscoordination of thalamic reticular spindles is associated with social memory deficits in mice and humans with autism spectrum disorder
T2 - Nature communications
J2 - Nat Commun
PY - 2026
DA - 2026/
VL - 17
IS - 1
SP - 8960
SN - 2041-1723
PB - Nature Publishing Group
DO - 10.1038/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1038/
"type": "article-journal",
"title": "Dyscoordination of thalamic reticular spindles is associated with social memory deficits in mice and humans with autism spectrum disorder",
"container-title": "Nature communications",
"author": [
{
"family": "Cui",
"given": "Dongqi"
},
{
"family": "Wang",
"given": "Xiaodan"
},
{
"family": "Ai",
"given": "Ruosong"
},
{
"family": "Gao",
"given": "Feng"
},
{
"family": "Sun",
"given": "Huan"
},
{
"family": "Zhang",
"given": "Ying"
},
{
"family": "Lyu",
"given": "Yixuan"
},
{
"family": "Zhang",
"given": "Zhijie"
},
{
"family": "Li",
"given": "Wen"
},
{
"family": "Qin",
"given": "Yuhang"
},
{
"family": "Guo",
"given": "Yuxi"
},
{
"family": "Liu",
"given": "Yinxia"
},
{
"family": "Zhao",
"given": "Ningxia"
},
{
"family": "Wang",
"given": "Juan"
},
{
"family": "Li",
"given": "Shen"
},
{
"family": "Wu",
"given": "Ying"
},
{
"family": "Zhang",
"given": "Siyuan"
},
{
"family": "Wang",
"given": "Changhe"
},
{
"family": "Wang",
"given": "Feidi"
},
{
"family": "Li",
"given": "Yan"
}
],
"container-title-short":
"volume": "17",
"issue": "1",
"page": "8960",
"DOI": "10.1038/
"PMID": "42637729",
"PMCID": "PMC13503877",
"ISSN": "2041-1723",
"publisher": "Nature Publishing Group",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
7,
23
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1126/sciadv.adu9805 [code]
- Restoring access to long-term social recognition memories disrupted by sleep deprivation.Journal: Science advancesIn common: mouse, 6 references
- [2] doi:10.1371/journal.pbio.3003693 [code]
- Thalamic reticular neurons provide cell type-specific modulation of sound processing in the auditory thalamus.Journal: PLoS biologyIn common: mouse, 5 references
- [3] doi:10.3389/fnsys.2026.1753562
- When the gatekeeper falls: developmental vulnerability of the thalamic reticular nucleus in neonatal and pediatric hypoxic-ischemic brain injury.Journal: Frontiers in systems neuroscienceIn common: 4 references
- [4] doi:10.1093/sleep/zsaf410 [code]
- Does twitch-spindle coupling differ between N2 and N3 sleep in 6-month-olds?Journal: SleepIn common: Statistics and Machine Learning Toolbox, 3 references
- [5] doi:10.1038/s41398-026-04018-1
- Loss of connexin 36 elicits abnormalities in thalamocortical network activity relevant to neuropsychiatric disorders.Journal: Translational psychiatryIn common: mouse, 3 references
- [6] doi:10.1002/advs.76479
- RPLP2 Mediates the Beneficial Effects of Exercise on Stress Resistance Through Muscle-Brain Communication.Journal: Advanced science (Weinheim, Baden-Wurttemberg, Germany)In common: author Yan Li
- [7] doi:10.1111/ejn.70665
- Baseline Dynamics and Sleep Loss-Driven Changes of Electrocorticographic Aperiodic Properties Are Altered in Mice Lacking Neuroligin-2.Journal: The European journal of neuroscienceIn common: mouse, 3 references
- [8] doi:10.1016/j.ynstr.2026.100788
- Different early-life adversity paradigms have disparate effects on maternal care, neuronal activation, and social behavior in developing mice.Journal: Neurobiology of stressIn common: mouse, 3 references
- [9] doi:10.1038/s41593-026-02292-2
- Individual differences in prosocial learning are represented in the hippocampal dorsal CA1.Journal: Nature neuroscienceIn common: mouse, 3 references
- [10] doi:10.1523/eneuro.0029-26.2026 [code]
- Electrical Coupling within Thalamocortical Networks Cumulatively Reduces Cortical Correlation to Sensory Inputs.Journal: eNeuroIn common: 3 references
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 5 scripts, and 3 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:1fbbfbac4851c862…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[.
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
