DOI: 10.5281/zenodo.16364096
title: Machine learning predictions from unpredictable chaos

description: Code Description

The code has five parts, including B-factor prediction, EEG data, image classification, RS Plot, and SingleCellDataProcess. Each part has several routines wrote by Python. Please make sure to modify the file paths in the routines to the reader's own paths, and install the Python packages mentioned at the beginning of the routine. Readers can remove the numbers at the beginning of the code when running the program. The details of main purpose of all routines are as following:





B-factor prediction(1) PDB_data_process.py: Loads the three-dimensional coordinates and B-factors for each protein.(2) plot_B_prediction.py: Plots the 3D structure of a specific protein, colored by both experimental B-factors and predicted B-factors from different methods.(3) slurm_364_B_3_1.py + multi_slurm_364.py: The first code simulates synchronization behavior in a system based on the Lorenz model, updating the state (x, y, z) of atoms by solving dynamic equations, calculating the synchronization index, and analyzing the relationship between the protein's B-factor and the simulation results using a multiple linear regression model. The second code, when updated with the pdbID, can traverse 364 protein datasets and generate job scripts for submission on a Slurm-managed high-performance computing cluster, enabling large-scale simulations and distributed computing analysis.




EEG data(1) cang_lorenz.py: Feature extraction from EEG data using Lorenz system.(2) cang_rossler.py: Feature extraction from EEG data using Rossler system.(3) KNN.py: Classification prediction by features using machine learning algorithms.(4) LSTM.py: Using LSTM model for classification prediction from time series.(5) RNN.py: Using RNN model for classification prediction from time series.




image classification(1) allaml_classification_pca.py: use PCA method to do the classification prediction of image data.(2) allaml_classification_tsne.py: use t-SNE method to do the classification prediction of image data.(3) allaml_classification_umap.py: use Umap method to do the classification prediction of image data.(4) win_Lorentz_allaml_feature.py: use Lorentz oscillators to generate the features of image data.(5) win_rossler_allaml_feature.py: use Rossler oscillators to generate the features of image data.(6) win_allaml_feature_CHEN.py: use Chen oscillators to generate the features of image data.




RS Plot(1) rs_plot.py:implement the residue-similarity (R-S) analysis for the clustering visualization of classification performance on single cell RNA sequencing (scRNA-seq) data sets.(2) rs_score.py: calculate the residue score and the similarity score, which are introduced to evaluate and visualize dimensionality reduction, clustering, and classification algorithms.(3) rs_Umap_heatmap_plot.py: R-S plot, Umap, and confusion marix of RS plots of scRNA-seq data sets.(4) u-map.py: Umap plots for scRNA-seq data sets.




SingleCellDataProcess(1) classification_DBZ_GBDT.py: classification prediction for single cell RNA sequencing with GradientBoostingClassifier and five-fold cross validation.(2) classification_DBZ_RF.py: classification prediction for single cell RNA sequencing with RandomForestClassifier and five-fold cross validation.(3) classification_DBZ_SVM.py: classification prediction for single cell RNA sequencing with svm algorithm and five-fold cross validation.(4) slurm_GSE_feature_4_runge.py: generate features with four-order Runge Kuta algorithm for single cell RNA sequencing data.(5) slurm_GSE_feature.py: generate features with one-order forward Euler algorithm for single cell RNA sequencing data.



Data Description





EEG data of the normal category, preictal category, and seizure categoryAnother EEG datasets used in Fig.3a of main text is the publicly available EEG dataset collected and curated by Andrzejak et al. from the University of Bonn, Germany. This dataset can be accessed from the official website of the Epileptology Department at the University of Bonn. The normal category (o.zip) comprises single-channel EEG segments recorded from healthy individuals with no history of epilepsy. The preictal category (f.zip) consists of EEG signals collected from epilepsy patients during non-seizure periods. Meanwhile, the seizure category (s.zip) includes EEG signals recorded from the same patients during epileptic seizures. SET B corresponds to o.zip, SET D corresponds to f.zip, and SET E corresponds to s.zip. Each category contains 100 single-channel EEG signals, with each signal having a duration of 23.6 seconds. The sampling frequency of the recordings is 173.61 Hz, resulting in a total of 4097 data points per signal.




ImageThe Columbia Object Image Library (COIL-20) is a well-known image dataset created for machine learning and computer vision research, especially in object classification. Compiled at Columbia University in 1996, it contains images of 20 different objects, each photographed from various angles. Specifically, each object is captured at 5-degree intervals as it rotates a full 360 degrees, resulting in 72 images per object and a total of 1,440 images. The dataset includes a variety of everyday items like toys, household goods, and tools, which offer a wide range of shapes, textures, and colors. This diversity makes COIL-20 highly useful for developing and testing algorithms that need to generalize across different types of objects and their appearances.




ProteinB-factor describes how much an atom fluctuate around its mean position in crystal structures. Protein B-factors quantitatively measure the relative thermal motion of each atom and reflects atomic flexibility and dynamics. Though B-factor is also affected by factors such as the refinement methods, it is still a relatively robust measurement of atomic flexibility in proteins.




Single Cell RNA SequencingSingle cell RNA sequencing (scRNA-seq) reveals heterogeneity within cell types, leading to an understanding of cell−cell communication, cell differentiation, and differential gene expression. With current technology and protocols, more than 20,000 genes can be identified. Numerous data analysis pipelines have been developed to help analyze such complex data.



Demonstration





Figure 2In this section, the code and files we used are all stored in figures/Figure 2.

(1)We obtained Figure 2a by running the persistent_homology_visualizer.py. Each of the sixteen nodes in the regular hexadecagon is injected with a Lorentz oscillator. The coupling or connectivity between these nodes is provided by the radius filtration of the persistent Laplace operator. The three plots display three typical filtration patterns.

(2) Figures 2e-g show the visualizations of atom_coordinates_1.txt, atom_coordinates_2.txt, and atom_coordinates_3.txt, respectively. The point cloud images were created using PowerPoint, while the dynamic plots were generated by running the MND_filtration_eeg_cat018.py script. Panel e: Folding geometry and synchronized dynamics of a 120-element point cloud. Panel f: Partial folding geometry and partial synchronized dynamics of a 120-element point cloud. Panel g: Unfolded geometry and chaotic dynamics of a 120-element point cloud.




Figure 4In this section, the code and files we used are all stored in figures/Figure 4. We saved the three-dimensional coordinates of the data points in topologicaldynamics.xyz and obtained Figures 4d-e by running the rips.py script. Panel d illustrates the filtration process of the point cloud, generating a sequence of simplicial complexes. Panel e shows the variation of the persistent Betti numbers as the filtration radius increases.
description: Chaos is omnipresent in nature, and its understanding provides enormous social and economic benefits. However, the unpredictability of chaotic systems is a textbook concept due to their sensitivity to initial conditions, aperiodic behavior, fractal dimensions, nonlinearity, and strange attractors. In this work, we introduce, for the first time, chaotic learning, a novel multiscale topological paradigm that enables accurate predictions from chaotic systems. We show that seemingly random and unpredictable chaotic dynamics counterintuitively offer unprecedented quantitative predictions. Specifically, we devise multiscale topological Laplacians to embed real-world data into a family of interactive chaotic dynamical systems, modulate their dynamical behaviors, and enable the accurate prediction of the input data. As a proof of concept, we consider 28 datasets from four categories of realistic problems: 10 brain waves, four benchmark protein datasets, 13 single-cell RNA sequencing datasets, and an image dataset, as well as two distinct chaotic dynamical systems, namely the Lorenz and Rossler attractors. We demonstrate chaotic learning predictions of the physical properties from chaos. Our new chaotic learning paradigm profoundly changes the textbook perception of chaos and bridges topology, chaos, and learning for the first time.