dataesr/scientific-paragraphs-categorization huggingface dataset:
The biologists then try to match in-dividual frogs from the second group (set) to individuals caught during the previous visit (or all previous visits). Individuals from the second group are then classified as "new" or "recaptured", depending on whether they were captured during previous surveys. This visual matching approach works well for small sets of frogs, but becomes burdensome or even impossible as the number of frogs captured increases. The identification problem is to determine from the photograph if a captured frog is in the existing database of photographs or is a new frog. Humans can identify the frogs quite accurately based on the shape and location of spots or other features on their skin. For example, in  (Lama et al. , 2011)  the tree frog Scinax longilineus was successfully identified by researchers simply looking at the collected photographs and they found that photo-identification was as accurate as tagging the animals.
However, as databases of photographs become large, this visual matching approach is unrealistic. Instead, researchers are examining ways to automate this process through computeraided pattern recognition. One of the first steps in pattern recognition is to identify the area of an animal that will be used for pat-tern matching. To accomplish this we adopted an existing tool developed by a research team at Idaho State University  (Velásquez, 2006) ,  (Kelly, 2010 ). An example is shown in Figure  1   (Kelly, 2010 ) which shows the dorsal (i. e. , back) side of the captured frog and indicates the area of its backside which is cutout for use in the identification. The cutout portion follows natural contours of the frog's backside. This area (referred to as the region of interest) is then stretched to make a rectangular array of pixels as shown in Figure  2.
The details of this stretching procedure are given in  (Kelly, 2010). Ideally, one wants an automatic procedure to identify the frog, i. e. , determine whether or not it is in the current database. Here we use the terminology semiautomatic to mean identification of the frog based on user's manual selection of the region of interest as indicated in Figure  1. This manual intervention is quite easy in terms of the user's effort. In the recognition approach used in  (Kelly, 2010) , the cutouts were then manually segmented to identify the spots and then engineered features were developed for the identification procedures. However, the segmentation turned out to be a rather tedious task to perform on each photograph. Figure  1 : Cutout along natural contours of the frog  (Kelly, 2010). Figure  2 : The cutout is stretched to form a rectangle  (Kelly, 2010).
Work similar to that presented here was done by  Gamble et al. (Gamble et al. , 2008)  who used principal component analysis (PCA) on normalized images of marbled salamanders (Ambystoma opacum). Specifically, they used a cutout of the back of the salamander as a vector in R 640×480 and then went through a series of preprocessing steps to handle nui-sance variables to obtain M = 625 "new" images for each original image. Each of these images was then scaled 8 times (multi-scale in half-octaves from 1 to 8 √ 2) using a Gaussian filter and appended to the original image so that the feature vector was now in R 9×640×480. Their database consisted of 366 different salamanders and a total of 1008 images. In their closed-set experiments, they reported a 95% correct identification that the test image was in the top 10 matches.
In  (Azhar et al. , 2012)  a texture based image feature descriptor called the Local Binary Patterns (LBP) was used for the (semi) automatic identification of the Great Crested Newt salamander (Triturus cristatus). They tested on a database of 40 newts and 153 images. Similar to the frog cutout procedure described above, they used normalized images and manually extracted a part of the belly images as the source of biometric information. They considered both open and closed set test procedures. The goal of this paper is to provide a simple, fast, and efficient semi-automated pattern-recognition algorithm for a capture-recapture identification system for northern leopard frogs (Lithobates pipiens). Section 2 describes the databases of frog pictures we used in the experiments. Section 3 discusses how a PCA algorithm is used to do the animal recognition (identification), Section 4 describes the evaluation protocols, Section 5 presents the experimental results and Section 6 gives the conclusions.
ANIMAL DATABASE The database consisted of images of northern leopard frogs with 209 separate identities. The cutouts of the frogs described in the introductory section are all rectangular arrays of 256 × 128 pixels (see Figure  2 ) and converted to grayscale. This leopard frog database was provided by the research of Oksana Kelly  (Kelly, 2010). Kelly obtained 209 frogs bred in captivity and photographed them. A photographic light diffusing dome (Cloud Dome, www. clouddome. com) was used to take an average of 3 to 4 images per frog for all 209 identities, although some frogs had up to 11 images. The light diffusing dome reduced glare from sunlight, which helped improve image quality. Compare Figure  3  with Figure  4. We had 966 images taken with the dome (hereafter, referred to as Shade Dome images).
With Q c ∈ R d×N the first N columns of Q, the theory of PCA x -Q c h c 2 = λ 2 N+1 + • • • + λ 2 N t -1. (7) N is chosen so that λ 2 N+1 + • • • + λ 2 N t -1 is small. Thus, as far as the Euclidean norm in concerned, the PCA representation h c ∈ R N is a much lower dimensional representation of the data than the original data vector x ∈ R d yet provides an accurate reconstruction of the image. Let the feature vector be f = h A • • • h N T ∈ R N-A+1 (8) which indicates that we are representing the image by eigenvectors A through N. Our choice will turn out to be A = 3, N = 120, that is, we remove the first two components h 1 , h 2 from h c to obtain better identification accuracy in contrast to reconstruction accuracy. The basic test is as follows: Let x (k) , k = 1,. , N t be the N t images in the database and f (k) their corresponding feature vectors.
Let x be any test image (recapture) with its feature f computed as above. For k = 1,. , N t compute the (cosine of the) minimum angle between the new image and the existing images, that is, compute s (k) f T f (k) f f (k). ( 9 ) This value s (k) is referred to as the score between the test image and the k th image in the database. Let k * be defined by k * arg max k∈{1,. ,N t } {s (k) } (10) which we will refer to as the identified image. In a closed-set protocol the test image of the frog is assumed to be in the database, such as when a frog is recaptured during a second sampling event. One then identifies the test image x as the image x (k * ). In practice one typically finds the (say) 10 images in the database that score the highest with x and then checks which of the 10 match the test image.
In an open-set protocol the test image may or may not correspond to any frog from the reference database, which is a more realistic test when a frog is captured and its identity unknown. We again compute k * as just explained and, with γ some pre-determined threshold, we check if s (k) ≥ γ. (11) If this is true then x is identified as the image x (k * ) else we say x is a new identity. Again, in practice, one typically finds the (say) 10 images in the database that score closest to the test image and then visually checks if it matches these already known identities. Figure  5  shows the mean frog image x m and the first five eigenvectors (eigenfrog images) of the covariance matrix constructed using all of the 1386 frog images (shade dome and no shade dome). Note that the spots are quite blurred in the first two eigenfrog images hinting that the first two eigenvectors may not contribute much to differentiation among frog identities.
Closed Set Evaluation Protocol The closed set protocol assumes that a test frog is in the database. These frog images are in a file listed with the number of the frog and the number of its image. For example, R 001 01, R 001 02, R 001 03, R 001 04 are the 4 images we have of frog 1, R 002 01, R 002 02, R 002 03, R 002 04,. , R 002 11 are the 11 images we have of frog 2, etc. We then distributed the images into 5 bins as follows: We put R 001 1 into bin 1, R 001 2 into bin 2, R 001 3 into bin3, R 001 4 into bin 4, R 002 1 into bin 5, R 002 2 into bin 1, R 002 3 into bin 2, R 002 4, into bin 3, etc. This was done in order to mix the images of each frog identity well among the bins. This mixing results in the bin distribution given in Table  1. After putting all the frog images into the 5 bins as just described, we used the first four bins to compute the covariance matrix C (PCA subspace).
Open Set Evaluation Protocol The open set protocol refers to the situation where the test image (a frog) may or may not be in the database. In this case we take all 966 of the frog images (209 identities) and separate them into two groups: 804 known frog images with 151 identities and 162 unknown frog images with 58 identities. The identities in these two sets are disjoint. As in the closed-set protocol, the 804 known frog images are distributed into 5 bins of approximately the same size (804/5 giving 161 or 160 images per bin). See Table  3. The covariance matrix (PCA space) is computed using 4 of the 5 bins in the known group. Then the 5 th bin and the unknown or 6 th bin were used to test. This was repeated a total of five times by permuting bins 1 through 5 made up of images from the known group.
The threshold in (  11 ) was chosen to be γ = 0. 5. An error occurs in one of two ways: (k-known) the test image is in the database, but the identified image x (k * ) is not the correct one or (uunknown) the test image and its identified image x (k * ) satisfy the threshold, but the test image in not in the database. The results are given in Table  4  where u says the error was made on an unknown frog while k says that a known frog was misidentified.
5-fold testing on shade dome images Consider again the closed set evaluation with the captive frogs consisting of 209 identities, 966 total images all taken with the shade dome. We have already given the results of the first test. However, up to now we have considered the identified image to be that one in the database with the highest score [See equations (  9 ) and (  10 )]. We now will compare the test image with the database images with the n highest scores where we typically take n = 1, 5, or 10. In the present case we have For example, in subsection 4. 1 we reported the errors for each fold. There were a total of 22 errors in which the test image did not match the highest score. This results in average number of errors over the 5 folds given by 22/5 = 4. 4. In the case where n = 10, we see that there were 5 × 1.
5 it was found during the 5-fold testing that on average 1. 8 of the known frogs scored below this threshold and thus would be categorized as a unknown (new) frog. For the known frogs who met the threshold, Table  8  gives the error results. With the unknown frogs an error occurs when its score s (k) meets the threshold, i. e. , s (k) ≥ γ = 0. 5 because it is then taken to be in the database when of course it is not there. Our results are below. 9 , the second column (n = 1) means that on average there were 14. 4 unknown frog images whose top score with some known frog image was greater than 0. 5. The third column (n = 2) of this table means that on average there were 5. 2 unknown frog images whose top 2 scores with some known frog images were greater than 0. 5. Similarly for the remaining columns.
Then each identity in the remaining (test) bin had its score computed with images of the same identity in the other 4 bins. The highest score was kept. This was done five times each time using a different bin as the test bin. A histogram made of these scores was normalized to become the known frog pdf. From the pdfs of Figure  7  the probability of detection of a known/unknown frog and the probability of a false alarm of a known/unknown frog were computed and are given in Table  10. For example, the area under the "unknown" frogs pdf from -∞ to γ = 0. 5 is 0. 9836 which is the probability that the score of an unknown frog with a known frog is less than 0. 5. The area under the "known" frogs pdf from 0. 5 to ∞ is 0. 9838 which is the probability that the score of a known frog with a known frog is greater  Of course one should have a separate database for an evaluation to determine a threshold.
CONCLUSIONS This work was originally motivated by the previous work of Velásquez  (Velásquez, 2006)  and Kelly  (Kelly, 2010). Here we have reported in Table  5  quite good closed set results which we surmise is due to the quality of the images. However, table 6 shows that when "training" (i. e. , constructing the PCA space) on high quality (shade dome) images and then testing on lower quality (no dome) images the identification accuracy deteriorates. Though the open set results given in Table  4  are not nearly as good as the closed set results given in Table  2 , Table  9  shows that the biologist needs to visually check less than five images in the database to determine if the captured frog is a new identity or not. We are in the process of collecting more data to have enough for both development and evaluation databases.
Spatiotemporal distributed source solutions, like minimum-norm estimate (MNE), of MEG/EEG have been proposed to overcome this non-triviality  (Dale and Sereno, 1993; Hämäläinen and Ilmoniemi, 1994). The resulting current distribution incorporates the anatomical information for each individual brain from the magnetic resonance imaging (MRI), and calculates the time-course of source distributions usually constrained to the cortex. These MNE solvers leads to spatiotemporal linear solutions, and have been extensively used in the neuroimaging community for their relatively accurate source localizations and robustness to the noise levels normally present in MEG/EEG data sets. This type of analysis leads to a huge amount of highdimensional data containing large information in both time and space.
Lastly, the application of HHD on simulated and human MEG data will be presented. The methods discussed in this paper are implemented in MatLab and are available for download as plugin to Brainstorm (MEG/EEG data processing software)  (Tadel et al. , 2011)  at http://neuroimage. usc. edu/brainstorm. These methods will also soon be available for MNE-Python framework  (Gramfort et al. , 2014).
RESULTS We will now present the application of HHD on one simulated and two actual MEG datasets. In Section 3. 1 under a simulated scenario, HHD is used to track and encode cortical activity as it emerges from the somatosensory cortex, traveling along the central sulcus, and receding in the inferior frontal gyrus. The first MEG dataset presented in Section 3. 2 is obtained from a median nerve stimulation paradigm that consists of a train of electrical stimuli applied on the wrist of a healthy adult individual. It is a typical experimental paradigm to elicit activity within the primary somatosensory cortex. The second MEG dataset shown in Section 3. 3 is from a pediatric epilepsy patient with tuberous sclerosis complex. In this dataset, we track the propagation of the epileptogenic activity within the irritative zone.
Analysis We first applied the optical flow on this simulated activity. Optical flow transformed the dynamics of the source's evolution in terms of the motion vector fields that were emerging, traversing, and receding. This optical flow computation was performed in the MNE-Python framework and took 10. 75 s to compute. We then applied HHD to the optical flow at each time step, which detects three main features corresponding to the three stages of the simulation. HHD took 30. 36 s to decompose optical flow in the discrete feature set. The simulation was performed on a workstation having a Dual Octa Core Xeon CPUs (32 Threads) with 64 GB of RAM.
Experiment MEG data was recorded from a 28-year-old healthy female individual at the MEG laboratory of the Center for Mind/Brain Sciences (CIMeC), University of Trento, Italy. During the experiment, the median nerves of her right and left wrists were electrically stimulated transcutaneously. Approval was obtained from the University of Trento Ethics Committee, Italy, and the subject gave her written informed consent before the experiment. Constant current stimuli with a duration of 0. 2 ms, and a pseudo-randomized inter-stimulus interval of 250 ± 50 ms were applied to the subject. Before the start of the experiment, we measured two basic intensity thresholds for each of the subject's wrists. The two parameters were the motor threshold (MTH), defined as the minimal stimulus intensity needed to produce thumb twitching, and the sensory threshold (STH), defined as the minimal stimulus intensity at which the subject was just able to feel a train of stimulus pulses.
The stimuli were delivered either to the right or to the left wrist with two intensity levels of M = MTH + 0. 25 and S = STH + 0. 25 , where = MTH -STH. Here, we used only the data from the right median nerve stimulation and the M intensity level. More details about the experimental design can be found in  Papadelis et al. (2012). Somatosensory evoked fields (SEFs) were recorded at a sampling rate of 5 kHz by using a 306-channel (204 first order planar gradiometers, 102 magnetometers) VectorView MEG system (Elekta-Neuromag Ltd. , Helsinki, Finland) placed inside a magnetically shielded room (AK3B, Vacuumschmelze, Hanau, Germany). Hardware filters were adjusted to band-pass the MEG signal in the frequency range of 0. 01-1000 Hz. Data from 200 trials were used in this study.
Data analysis To compensate for head movements during the measurements and suppressing external magnetic disturbances, the signal space separation (SSS) algorithm  (Taulu and Simola, 2006) , as implemented with the MaxFilter software (Elekta-Neuromag), was performed offline on the raw MEG data. The corrected MEG data were then filtered offline in the band of 0. 1-150 Hz and epoched from -50 to 200 ms relative to the stimulus onset. Trials contaminated with artifacts were excluded from further processing. In total, 160 trials survived the rejection criteria. These trials were baseline corrected and then averaged. The subject's MRI was processed using FreeSurfer; cortical and head surfaces were extracted. Cortical surface was downgraded to 50,003 points and elementary current dipoles were positioned at the surface of the cortex of the subject.
The multi-sphere forward model was computed and the standard minimum-norm was used to estimate cortical currents. The preprocessing and generation of both the forward and inverse solution was done in Brainstorm  (Tadel et al. , 2011). The MNE solution was computed at every point within the time window that represents the N20 component (from 15 to 25 ms) (see Figure  2 , upper panel). The N20 component represents the first cortical response to the electrical stimulation of the median nerve. Optical flow was estimated from the minimum-norm data. HHD was then applied on this optical flow to detect sparse features in cortical dynamics. The computation of optical flow took 50. 33 s whereas HHD took 123. 73 s on the workstation mentioned in Section 3. 1. 2. This application was done in the MatLab implementation of the HHD.
Epileptic data The data was recorded from a 20-month-old boy, who presented his first seizure at the age of 3 months, with refractory epilepsy as a result of TSC. The patient had multiple subcortical tubers identified on his MRI as patchy areas of T2 prolongation, stable over time (see Figure  3 ). Long-term monitoring revealed 54 seizures in total (46 electroclinical and 8 electrographic seizures) with duration of 10-44 s. The seizure onset was localized at the right posterior quadrant (electrodes P8, O2, P4, T8, and C4). Routine and ambulatory EEG has indicated frequent interictal sharp waves at electrodes C4, Pz, P4, and P8, as well as slowing at the right posterior quadrant. MEG data were recorded for 45 min during sleep at the BabyMEG facility located at the Radiology Suite of Boston's Children Hospital (Waltham, MA, USA).
MEG recordings were performed using a 74-sensor MEG system especially designed for pediatric use ("babySQUID" -Tristan Technologies Inc. , San Diego, CA, USA). The babySQUID system is accommodated in a single-layer magnetically shielded room (MSR). MEG data was sampled at 1024 samples per second. The sensor array of MEG was covering the right posterior quadrant. T1weighted high-resolution magnetization-prepared rapid gradient echo (MPRAGE) structural images were acquired on a 3. 0-T Siemens Trio whole body MR scanner (Siemens Medical Systems, Erlangen, Germany) using a 32 channel head coil. Details about the experimental procedure can be found elsewhere (Papadelis et al. , 2013). Research MEG and MRI data were acquired and analyzed after explicit parental consent under a protocol approval by the Boston's Children Hospital institutional review board.
DISCUSSION In this paper, we present the applicability of HHD to highdimensional neuroimaging data. The HHD-based sparse feature encoding technique works in three steps. First, MNE is computed to estimate cortical current activity. Optical flow is then used to estimate the motion field of distributed cortical dynamics. Finally, the optical flow is decomposed into sparse and compact features using HHD and the neuroimaging feature extraction simplifies to the problem of finding critical points in the scalar potential U and by the highest norm vector of H. The method has been optimized for running in multi-core CPUs in order to decompose high-dimensional MEG/EEG data (~GB) in few seconds on a highly dense (~50,000 vertices) cortical mesh. The method provides a compact representation of the cortical dynamics.
The method also allows to track the cortical activity as it appears, disappears, or travels on the cortical manifold. Moreover, HHD can also infer the information flow between cortical regions over short distances and times. Here, we present the application of our method on both simulated and actual MEG data sets. In the simulated scenario, we generated synthetic cortical activity from the heat vector field and the advection equation. We then applied optical flow and HHD on this simulated data compacting the different stages of these dynamics in three sparse features. These results were in absolute accordance with our generated data. In the cognitive neuroscience application, we encoded spatiotemporal time varying maps of cortical activity during electrical stimulation of the median nerve.
We strongly believe that there are much more applications of our method in both neuroscience as well as clinical research. Further improvements of our method include: the discretization to higher-order finite element analysis, statistical analysis of the detected features, and the further reduction of the algorithm computational complexity. HHD is freely available as a plugin for major MEG processing suites (i. e. , Brainstorm and MNE-Python) and readers are encouraged to use and extend the proposed method.
ACKNOWLEDGMENTS This work was supported by the  Nancy Lurie Marks Family Foundation  ( Sheraz Khan ,  Manfred G. Kitzbichler ,  Tal Kenet ),  Simons Foundation  ( Tal Kenet ),  NIBIB : 5R01EB009048  ( Matti S. Hämäläinen ),  P41RR014075  ( Matti S. Hämäläinen ),  Senior-Scientist Salary Award  from the  Quebec Fund for Health Research (Sylvain Baillet) ,  NIH   2R01EB009048-05  ( Sylvain Baillet ) and a  Discovery Grant  from the  Natural Sciences and Engineering Research Council of Canada (Sylvain Baillet ).