dataesr/scientific-paragraphs-categorization huggingface dataset:
We then computed the standard Simpson diversity index on a per-patient basis, according to the repartition of all cells from a patient into the relevant categories in both subsets. We found that it correlated very significantly with our divergence-based phenotypic heterogeneity score in both non-malignant cells from melanoma samples and malignant glioma cells (Figures 6E and 6F, Spearman's rho = 0. 73 and rho = 0. 49; p = 0. 001 and p = 0. 009, respectively). This suggests that this approach, although not relying on cell classification, can accurately capture the diversity of populations whose structure is known, both for malignant and normal cells from different tissues. Similar observations were reported using cluster-based distances (Figure  S18 ). Using the average activity-based divergence between malignant cells, we quantified intra-tumor phenotypic heterogeneity in all samples from the six datasets with metadata and compared them (Figure  7A ).
The mean phenotypic divergence of colorectal cancers  (Li et al. )  was significantly higher than other datasets, whereas melanoma heterogeneity was significantly lower (Wilcoxon test, Benjamini-Hochberg (BH) correction, p < 0. 001 and p = 0. 004, respectively). We furthermore report that between-samples variation in phenotypic diversity was the highest in melanoma (i. e. , most heterogeneous in heterogeneity levels) and the lowest in oligodendroglioma (Figures  7B  and 7C ).
Phenotypic Diversity Evolution We finally took advantage of cancer samples paired with normal tissue in the colorectal dataset to investigate the evolution of phenotypic diversity. In the five patients with colorectal cancer from Li et al. for which we could find paired tumor-normal data, diversity stayed at similar levels in three cases (CRC04, CRC06, CRC10), whereas it decreased very significantly in the tumor material in two cases (Figure  7D , CRC05, CRC08, p < 0. 001, Wilcoxon test). Such decrease in diversity was not observed in other cell types in these patients (Figure  S19 ). This fits a scenario in which cells go through a phenotypic bottleneck at tumor initiation, followed by the expansion of few selected clones.
, 2014; Ferrall-Fairbanks et al. , 2019; Zhang et al. , 2019) , such an approach does not rely on classifying cells into putative, static identities that cancer cells drift away from in patient-specific fashion. It furthermore encompasses the temporal variability inherent to populations of cells replicating asynchronously and exhibiting stochastic differences in gene expression, which can itself foster resistance  (Shaffer et al. , 2017). In addition, such a method is not tissue-type specific and was relevant in all investigated datasets. We first performed in vitro analyses, which revealed that it was possible to reliably predict in which cells a given activity had been induced, using targeted panels based on the MSigDB hallmark gene sets and the literature. This was done using single-cell RT-qPCR technology, which is more precise than RNA-seq on specific genes of interest  (Mojtahedi et al.
, 2016). Our analysis, however, revealed that some of the best markers for activity detection were absent from the hallmark gene sets. Although this is likely to be attenuated when using entire gene sets rather than targeted panels, it exemplifies the need for more reliable gene signatures, particularly ones taking into account single-cell level specificities  (Hwang et al. , 2018; Larsson et al. , 2019). We then scored 50 hallmark activity signatures in 28,513 cells from eight publicly available datasets using the AUCell software. AUCell is based on a ranking procedure, which efficiently deals with normalization and is not affected by the dissimilarity in using either FPKM or TPM units across the datasets  (Aibar et al. , 2017). This was illustrated by cells not clustering according to their dataset of origin in the meta-dataset.
This is particularly relevant for cancer cells that broke free of homeostatic control and differentiation hierarchies, in which lineage markers inherited from ancestors may no longer correlate with phenotype and behavior. We applied such an activity-based approach to investigate the divergence between and among cell types in six datasets with available metadata. We found that cells of the same type were less divergent than cells of different types. This can be explained by the fact that most reported cell types are non-malignant, with cells from the same type thus likely to partake in similar activities. We also observed that activity profiles recapitulated normal cell types better than malignant subtypes, although with very limited data (n = 1 in both cases). Furthermore, we could identify distinct clusters of malignant cells showing marked differences in their activity profiles in all datasets.
Therefore, although same cell identity often implied similar activities, it was not always the case, especially in cancer cells for which our activity-based approach was aimed. This also indicated that this approach could reflect the divergence between cells similarly considered malignant using a blanket classification, but which appeared to engage in different activities. Interestingly, the divergence between malignant cells was not recurrently higher or lower than that between normal subtypes, and patterns varied according to tumor type. In the two datasets with high numbers of both patients and cell type sub-classifications, the mean cell-cell divergence correlated significantly with standard diversity indices based on the repartition of individuals into subpopulations. These results suggest that avoiding the use of known lineage markers did not hamper the relevance of this approach across the investigated tissue types.
At each bootstrapping iteration, we build a matrix containing the expression value of each gene combination in 100 of the top 50% scoring samples and 100 of the bottom 50% ones. The expression values are then normalised into Z-scores in this bootstrapped matrix. We then attribute a per-sample score to the combination as follows by summing the Z-scores multiplied by the sign of the expected fold change of each gene. Based on these persample scores, we compute the AUC in predicting if a sample belongs to the top or bottom sample set using the pROC R library. The AUCs and Spearman correlations are recorded for each bootstrapping iteration for each combination (Supplementary Figure  21 ). Finally, a cross-validation analysis was performed on the TCGA metadataset for each activity. We merged the best 5 genes based on AUC and the best 5 genes based on Spearman's correlation in the CCLE data.
We assessed their performance by calculating correlations and AUCs for the top/bottom 50% scoring samples using whole-set signature in the TCGA dataset. We selected 7 EMT genes (NNMT, COL4A1, SNAI2, FBN1, CTGF, FSTL1, FN1), 7 DNA repair genes (POLR2F, RFC5, POLR2E, CLP1, SF3A3, POLD1, DUT) and 6 Glycolysis genes (EXT1, AGRN, SLC16A3, PYGB, PYGL, IL13RA1). We furthermore included additional genes according to the literature: 6 additional EMT genes (CDH1, COL5A1, HTRA1, ITGAV, ZEB1, ZEB2), 6 additional DNA repair genes (DDB2, FEN1, LIG1, XPC, PMS1, POLQ) and 3 additional Glycolysis genes (HK2, PFKM, LDHA). 4 genes from the Myc targets hallmark (BYSL, DCTPP1, GNL3, TCOF1) and 7 stably expressed "housekeeping" genes (CIAO1, CNOT4, HNRNPK, RAB1A, TIAL1, UBE2D3, YTHDC1, Supplementary Figure  22 ) added as internal controls, as well as two RNA spikes from the manufacturer (spikes 1 and 4).
Inferring cellular activities 4-parameter Beta-Poisson (BP) distributions and differential expression were estimated using the BPSC R package  (Vu et al. , 2016). Significantly differentially expressed genes were identified comparing the activity-specific cells to all other ones (including cells with another activity induction). BP distributions were used to calculate the probability that an expression value (in number of transcripts) observed for a marker gene came from a cell in which the related activity was induced. For each gene in each cell, the likelihood that the observed value originated from a population in which the related activity had been induced was calculated. Two BP distributions were first estimated in leave-one-out fashion (removing the cell under scrutiny): one using cells in which the related activity had been induced, and another one in cells in which this activity had not been induced.
Only genes reported as significantly differentially expressed were included in multi-gene glm analyses. Single-cell isolation and RT-qPCR data 96 cells were isolated from 4 populations (control, EMT, DNA repair, Glycolysis) using the Fluidigm C1 technology. 12 cells from each population were then analysed using a 48. 48 chip on the BiomarkHD hardware with our designed 48-genes panel, using 18 pre-amplification cycles and maximum 30 amplification cycles for quantification. Single-cell isolation and RT-qPCR experiments were performed by the ProfilExpert platform (Université Claude Bernard Lyon 1, France). We filtered out genes and cells for which >30% of the 48 wells involved did not meet the BiomarkHD PASS criterion. For each spike (1 and 4), cells corresponding to the most distant outliers Ct values were filtered out (either side), until the Ct distribution was deemed normal (p>0.
Datasets We downloaded 8 cancer-related single-cell RNA (sc-RNA) datasets, through the Single Cell Portal (https://portals. broadinstitute. org/single_cell) and publications: Fan et al. multiple myeloma  (Fan et al. , 2018)  ; Filbin et al. H3 lysine27-to-methionine mutated H3K27M-glioma  (Filbin et al. , 2018) ;  Li et al. colorectal cancer (Li et al. , 2017) ;  Neftel et al. glioblastoma (Neftel et al. , 2019) ;  Patel et al. glioblastoma (Patel et al. , 2014) ;  Tirosh et al. melanoma (Tirosh, Izar, et al. , 2016)  and oligodendroglioma  (Tirosh, Venteicher, et al. , 2016) ;  Venteicher et al. astrocytoma (Venteicher et al. , 2017). The Li et al. dataset included both a tumour set and a normal set of sc-RNA data. All 8 sets were used to create a meta-dataset on which to investigate hallmark activity signatures, although only the 6 for which we could find cell type information were used for detailed analyses  (Filbin, Li, Neftel, Tirosh x2 and Venteicher).
Activity scores The AUCell software  (Aibar et al. , 2017)  was used to score the enrichment of each MSigDB hallmark signatures, considered as activities, in all cells. In addition, the cyclone software  (Scialdone et al. , 2015)  was used to predict the cell cycle phase status of all cells (G1/S/G2M). The meta-dataset including all cells from the 8 sets was constructed by normalising the scores for each of the 50 activities on a perset and per-activity basis. This was achieved by first subtracting the minimal score observed for the activity and then dividing by the maximum score for this activity. Thus, the distribution of scores for each activity had a minimum of 0 and a maximum of 1 in each of the 8 sets prior to merging.
Redundancy reduction and phenotypic distances We developed two approaches to reduce redundancy among the 50 activities, respectively based on Principal Component Analysis (PCA) and clustering. The first approach relied on determining the PCA coefficients of each activity so as to transform the 50 activity scores of each cell into PCA coordinates, using linear combinations of the scores and coefficients thanks to the FactoMineR R package  (Lê, Josse and Husson, 2008). We used the ConsensusClusterPlus R package  (Wilkerson and Hayes, 2010)  to identify the optimal number of clusters and their composition, with 100 bootstrapping replicates. The scores of all activities in a given cluster were then averaged to create a score for each cluster in each cell. As a result, phenotypic profiles were represented by vectors of PCA component scores or cluster scores per cell.
To ensure reproducibility, PCA coefficients and cluster composition were calculated using a leave-one-out procedure: the cells from each of the 8 sets were removed from the metadataset to calculate coefficients and assign activities to clusters, before using this information to calculate the PCA and cluster scores for the cells of the absent set. Phenotypic distances were then calculated as the Euclidean distance between the profiles of two cells, with the average distance accounting for the phenotypic diversity for a given sample / group of cells. For comparison against standard indices, we used the Simpson index rather than the Shannon one, as it is normalised and thus more stable when the number of individuals (i. e. cells) vary between populations (i. e. patient samples).
Recurrent malignant cell clusters We used the pvclust  (Suzuki and Shimodaira, 2006)  software on the PCA-based profiles of malignant cells only in the 6 datasets with available metadata, using Euclidean distances, Ward clustering and 500 bootstrap replicates. The pvpick function was used to identify groups of cells that were significantly associated to each other across bootstrap replicates. For display, only these significant clusters were selected but their display order in the cluster including all malignant cells was kept.
Cell reclassification We determined the average profiles of non-malignant cell types from the Tirosh (melanoma) dataset and malignant subtypes from the Neftel glioblastoma dataset, using the mean of each PC score for all cells from each (sub)type. All 50 principal components were included in the calculation, yielding a vector of 50 items per (sub)type. Each cell was then re-classified as belonging to the (sub)type whose average profile it was less distant to, using Euclidean distances on all PC scores.
00875, respectively, for all controller simulations in the conductance-based model. A key difference with (  7 ) is that the DBS in (  9 ) is delivered as a positive feedback on the biomarker [as indicated by the positive sign in µ(t)]. This difference is due to the implementation of DBS in the conductance-based model, whereby increasing DBS amplitude results in a stronger suppression of pathological oscillations. The model was simulated in the NEURON simulation environment  (Hines and Carnevale, 1997)  and implemented in Python using the PyNN API package  (Davison et al. , 2009). The model was numerically integrated using the Crank-Nicholson method with a 0. 01 ms timestep for all simulations. Simulations were run on the UCD Sonic high-performance computing cluster.
In practice, the controller parameters could also be obtained through an optimization process, such as the dual-loop framework outlined in  Grado et al. (2018) , though an optimization approach would itself also require the identification of appropriate objective functions which may be non-trivial. In summary, the proposed self-tuning DBS controller offers increased robustness to variations in system properties including changes in the strength of beta oscillations and or the electrode-tissue interface, and can accommodate alterations in the desired beta level. Compared to fixedgain proportional control, it provides a better compromise between power consumption and efficient attenuation of beta oscillations, with little additional computational complexity or technological requirements. is available to download from GitHub (https://github.
Beyond visualization of the data  [1] , a histogram or a density plot is not a sufficient tool for quantifying observations, as simultaneously, the number of customers and the amount of money they spend is being investigated. Thus, there is more than one dimension in the observed data. Also, other cases inwhich a regular histogram is not sufficient could be relevant, for instance, if data is categorical. If Coffeetime wants to know whether more female or male customers arrive at different times of the day, or their age, their time sparsity and concentration makes traditional methods, such as a histogram, not adequate. Formally, let the i-th observation (customer) arrive at time ti in the week (a continuous number between 0, let us say which represents Monday at 0:00, and 168, which represents Sunday night) and let xi be the corresponding value of their purchase, which is potentially a vector for each observation (in the case of Coffeetime, their receipt could cover the cost of food or just drink or the number of people at that table and more), with i between 1 and n recorded data (customers).
Available code The code for obtaining is available here: https://github. com/rafaelprietocuriel/SmoothConcen-tratedObservations It is possible to compile the code using R and based on different functions, f(bj). Although further instructions are included in the code, here we briefly explain its usage. The other parameters of the function are: bw, which is the number of observations which the function will return (with 256 by default); part, a number between 0 and 1, which is the maximum length of the partition for refinement (with a default of 0. 2); iter, which is the number of iterations which will run (with a default value of 100 steps); and extra, which is a value which is the number of times that the interval of t will be extended on both sides of the spectrum. The function f returns an object, containing the following vectors:.
because the stimulus is actually replaced by the question. We trained a ridge regression model to predict the subject's confidence report based on the pre-stimulus power (average between -500 and 0 ms with respect to the omitted stimulus) in frequencies ranging from 6 to 40 Hz, and evaluated its predictive accuracy in a cross-validated manner (see Methods). Out-of-sample predictions co-varied weakly but significantly with subject's confidence (Pearson ρ = 0. 06 ± 0. 02 s. e. m. , 95% CI = [0. 019 0. 101], Cohen's d = 0. 50, t 23 = 2. 43, p = 0. 023, Fig 3E). To explore the frequencies contributing to this predictive power, we estimated the ridge regression weights on the full dataset of each subject (see Fig  3F ). Those weights must be interpreted with caution because they depend on the covariance of the data, and may be different across subjects; nevertheless they suggest a positive effect of (low) beta range power (15-20 Hz) similar to the effect of Bayes-optimal confidence during the no-question trials.
Participants Twenty-four participants (16 women) aged between 20 and 34 (mean: 25. 4, SD: 3. 7) were recruited by public advertisement. They gave their written inform consent prior to participating; the study was approved by the Ethics Committee Ile de France VII (CPP 08-021). For one subject, one of the four sessions was unavailable due to a technical problem. Due to technical errors in saving files, the pupil diameter data is available only for 18 of the 24 subjects; analyses involving pupil size are restricted to those 18 subjects; all other analyses are performed on the 24 subjects.
Task This task and minor variants have been used previously  [8, 15, 19]. The task was run using Matlab and Psychtoolbox. The experiment was divided into one training session, performed outside the MEG room, and four sessions in the MEG (lasting approximately one hour and a half with pauses). Each session presented a sequence of 380 auditory tones (one every 1. 4 s), denoted A and B, corresponding to chords (350, 700 and 1400 Hz vs. 500, 1000 and 2000 Hz) that were perceived without ambiguity. Tones were presented in both ears, lasted 50 ms including 7 ms rise and fall times. The sequences were generated based on transition probabilities between successive tones; those probabilities were fixed only for a limited period of time delineated by change points. The change point probability was fixed on each trial, equal to 1/ 75; when a change point occurred, both transition probabilities were re-sampled within the interval 0.
Bayes-optimal learning model The Bayes-optimal model used here is described elsewhere  [8, 15, 111]  and the corresponding Matlab code is available online: https://github. com/florentmeyniel/ MinimalTransitionProbsModel. We used it with the following options: the learned quantities are "transitions", the estimation type is "HMM", the probability grid used for numeric integration has 20 � 20 values and the prior about transition probabilities is flat. Below, we summarize the main aspects of this model. The model uses Bayes rule to infer optimally the posterior distribution of transition probabilities at any given trial, denoted θ t (which is a pair of transition probabilities) given a set of assumptions M and previous observations y 1:t : pðy t jy 1:t ; MÞ / pðy 1:t jy t ; MÞpðy t ; MÞ Those assumptions closely correspond to the actual generative process: the change point probability p c = 1/75 is given, and the model assumes that when a change point occurs, both transition probabilities are simultaneously re-sampled uniformly in the range 0 to 1 (it was not aware of additional constraints).
MEG recording and pre-processing We recorded brain activity using a whole-head MEG system (Neuromag Elekta LTD, Helsinki), sampled at 1 kHz with hardware bandpass filtering between 0. 1 and 330 Hz. This systems has 102 triplets of sensors (1 magnetometer and two orthogonal planar gradiometers); we report results for the magnetometers only, but we used all sensor types for source reconstruction. We digitized the head shape (FASTRAK, Polhemus) including the nasion, pre-auricular points and various points on the scalp, and we measured head position within the MEG system at the beginning of each session with four head position indicator coils placed on the subject's head. Electro-oculograms, electrocardiogram and pupilometry were recorded simultaneously with MEG. Raw MEG signals were first pre-processed with the constructor software MaxFilter, in order to correct for between-session head movement (recordings realigned on the first session), removing nearby magnetic interference and correcting for noisy sensors by means of Source Space Separation  [112].
The data was further pre-processed with FieldTrip  [113]. The signal was epoched from -1. 4 s to 1. 4 s relative to stimulus onsets, and -1. 2 s to 0. 5 s relative to question onsets. Epochs were visually inspected to reject those with abrupt jumps, spikes or muscular artifacts, and line filtered (50, 100, 150 Hz). Epochs were then decomposed with ICA; components were visually inspected and those resembling artifacts corresponding to eye blinks and heart beats were removed. Outlier epochs were rejected based on the signal variance and kurtosis. The mean number of trials finally included was 1335. 8 ± 127 SD for stimuli and 90. 2 ± 7. 9 SD for questions. In order to analyze evoked responses, the signals were low-passed filtered (30 Hz) and down-sampled to 200 Hz. In order to analyze the spectral components, the signals was decomposed into peri-stimulus times (every 50 ms) and frequencies (every frequency between 7 and 40 Hz) with Morlet wavelets (using a f/σ f ratio of 7, where f is the frequency and σ f is the spectral standard deviation of the wavelet).
Source reconstruction We acquired anatomical T1-weighted magnetic resonance images (3T Prisma Siemens scanner) for 18 of our 24 subjects with 1 mm resolution. This anatomical image was segmented to extract the cortical surface and head shape with FreeSurfer  [114, 115]  and segmented tissues were imported into BrainStorm  [116]  to perform source reconstruction. For subjects without a personalized anatomical image, we used BrainStorm's default template (ICBM152). MEG and MRI data were co-registered using the digitized anatomical markers. All cortical meshes comprised ~15 000 vertices. For stimulus-evoked responses, we estimated at the subject-level the sources corresponding to the signal averaged within 155-230 ms (relative to stimulus onset) and across trials with high and low Bayes-optimal surprise, and high and low Bayes-optimal confidence (using median split for both).