dataesr/scientific-paragraphs-categorization huggingface dataset:
Introduction In this paper we provide the numerical details involved in a generalized fast marching solver, able to compute the distance from a point within a domain, and the related minimal paths. Path length is measured w. r. t. a given metric which may take a variety of forms and involve data-driven parameters. For instance the metric may be Isotropic (locally proportional to the Euclidean norm), or Riemannian. Combining a dimension lifting trick with the choice of an adequate singular metric, we are also able to penalize path curvature, according to the Reeds-Shepp  [RS90, DMMP16] , Euler-Mumford  [Mum94] , or Dubins  [Dub57]  models. Our software is referred to as the Hamiltonian Fast Marching (HFM) library 1 , because it relies on an original and specific representation of Hamiltonian of the addressed problems (13), and uses the fast marching method (a generalization of Dijkstra's algorithm) to solve eikonal-type equations in a single pass.
See  [DMMP16]  Appendix C. We discuss in §1. 2 possible choices of metric F that can be addressed with the HFM library, and in particular the singular metrics used to encode curvature penalization. The design choices underlying our numerical method for solving the PDE (3) are then presented in §1. 3. Applications of minimal path methods to image processing and motion planning are briefly surveyed in §1. 4, where we also present the outline of the paper.
Finsler metrics  [ZSN09, CMC16c] , i. e. non-Riemannian anisotropic metrics, are presently not supported by the HFM software. For these we refer to the earlier open source library  [Mir15] , due to the first author, which implements the (two-dimensional) FM-ASR scheme  [Mir13]. Non-Holonomic control models forbid, at some points in space p ∈ Ω, some directions of motion ṗ ∈ E. The corresponding metrics are singular, in that they associate infinite costs F p ( ṗ) = +∞ to these forbidden directions. Sub-Riemannian metrics are the simplest instances of non-holonomic metrics, and can be regarded as generalized Riemannian metrics having some infinite eigenvalues. The HFM software is able to handle strongly anisotropic Riemannian metrics, with condition numbers 10, which can approximate sub-Riemannian metrics convincingly enough for many applications.
Incorrect obstacles Figure  6 : Obstacles are specified to the HFM software as boolean images. They must be "water tight": contiguous obstacle voxels must share a full (d -1)-dimensional face. Otherwise the numerical scheme will leak through, and the extracted minimal paths may jump across walls. The numerical cost of constructing the stencils and the reversed stencils can be neglected in models for which these sets are independent of the current point (e. g. isotropic metrics §2. 2), or depend only on a strict subset of its coordinates (e. g. the angular coordinate for curvature penalized models §2. 4), by exploiting redundancy as discussed in §3. 1. 3 below. In other cases (e. g. Riemannian metrics §2. 3), the construction of the direct stencils V(p) has complexity 4  O(I) for each p ∈ X, thus O(N I) overall.
Memory usage The memory footprint of our algorithm is linear w. r. t. the number N of discretization points. The proportionality constant does matter however, since the image resolution of e. g. dMRI medical data is often huge. In addition, several applications introduce extra domain dimensions, accounting for e. g. the orientation, grayscale, or radius of the extracted tubular structure [CMC16a, PKP09], which multiplies the number of discretization points. For this reason, the HFM software implements several memory optimizations, discussed in this paragraph. We use the O(•) notation 6  to denote space complexity, counted in Bytes. Our generalized fast marching solver uses wide stencils, which weights and offsets take significant memory space if stored indiscriminately. By default 7  we use weights α i ∈ R of "double" type, hence occupying 8 Bytes 8  , and offsets ėi ∈ Z d with "signed char" components, hence occupying d Bytes, where d is the domain dimension, and where 1 ≤ i ≤ I.
Inputs and outputs of the differentiation methods The Hamiltonian appearing in the eikonal equation is represented internally in the HFM software in a sum of squares form (32), involving weights and offsets, denoted by α i (p) ≥ 0 and ėi (p) ∈ Z d , where p ∈ X and 1 ≤ i ≤ I. Our differentiation techniques assume that the offsets remain constant, but that the weights are proportional to (the inverse square of) one or several 12  user provided cost functions c(p, l), 1 ≤ l ≤ L, which themselves are subject to a linear perturbation εξ(p, l). See the discussion (37) on the shared stencil data structure. We also assume a linear perturbation εζ(q) of the boundary conditions σ(q), q ∈ ∂X. Summarizing, the perturbed cost functions and boundary conditions read c ε (p, l) := c(p, l) + εξ(p, l), σ ε (q) := σ(q) + εζ(q), for all p ∈ X, all q ∈ ∂X, and all 1 ≤ l ≤ L.
Therefore (43) at the parameter ε = 0 can be rewritten in the form µ = Lµ + Aξ + Bζ, where L is a strictly upper triangular matrix (in view of (43) and recalling that ω ε (p, q) > 0 requires U ε (p) > U ε (q)), and A and B are known matrices. Forward automatic differentiation computes µ := (Id -L) -1 (Aξ + Bζ), given ξ and ζ. Reverse automatic differentiation is the adjoint procedure, computing ρ := φ(Id -L) -1 A and π := φ(Id -L) -1 B, given φ : X ∪ ∂X → R. The triangular structure of Id -L is of course leveraged for fast inversion, by recursive substitution, and actually the matrices A, B and L are never explicitly assembled by the HFM software.
Numerical experiments This section is devoted to numerical experiments, which are reproducible using the series of notebooks that come alongside this publication. Part of these are Jupyter notebooks written in the Python R language 13  , while others are designed for the Mathematica R software 14. The original source code 15  also features additional examples. We illustrate the different metric models introduced in §2, such as isotropic, Riemannian, or non-holonomic metrics, as well as the algorithmic techniques presented in §3, such as forward and reverse automatic differentiation. The numerical examples discussed in this section were designed with the intent to illustrate the functionalities of the HFM library. In contrast, section §5 shifts the focus from algorithmics to modeling, and involves examples and test cases coming from applications.
Base functionalities, with an isotropic metric This paragraph serves as an introduction to using the HFM library, on a problem involving a basic Isotropic metric, and that could thus be addressed using a variety of other software packages. Features more specific to our software are considered in the next subsections. We address here a two-dimensional shortest path problem involving an isotropic metric on a domain Ω ⊂ R 2 , with the following value function u(p) := min γ(1)=p γ(0)∈∂Ω σ(γ(0)) + 1 0 c(γ(t)) γ (t) dt (44) Such optimization problems are specified to the HFM library using a dictionary, which entries are in this paper denoted by key:value. The exact syntax for constructing such an object depends in practice on the language used for interfacing, e. g. Python, Matlab R or Mathematica R.
This dictionnary is then fed to the adequate executable, for instance MatlabHFM Isotropic2, where the prefix denotes the external interface ("Matlab" could be replaced with "Python", "Mathematica", or "File" for the the stand-alone file based executable), and the suffix denotes the metric model, here an isotropic metric on a two-dimensional domain, as decided for (44). The next step is to define a cartesian grid, in our example of size 2n × n where n = 100, and a box domain Ω 0 = [-1, 1] × [0, 1], enclosing the PDE domain Ω, and containing the seed points where finite boundary conditions are imposed, and possibly some obstacles. For that purpose we provide the keys dims:(2n, n), origin:(-1, 0) (the bottom left corner), and gridscale:h, where h := 1/n. A few adjustments to this construction might unfortunately be necessary, depending on the visualization software, see the technical discussion in §D.
Riemannian metrics Riemannian metrics are the most widely occurring class of non-isotropic metrics in applications. Extending the fast marching algorithm to this context is a non-trivial task, which has been the subject of a continued line of research since the 2000's. Many of the proposed approaches have significant drawbacks, such as the use of excessively large stencils [KS98, SV01, AM11], the pre-condition that the condition number of the metric tensors be mild [JBT + 08], or the fact that they give up on the causality property  [BR06]. The author has introduced efficient and specific techniques for discretizing Riemannian eikonal PDEs on cartesian grids. Two flavors were developed, in the semi-Lagrangian and Eulerian framework respectively, referred to as 17  the FM-LBR and FM-VR1. They are introduced in  [Mir14]  and  [Mir17a]  respectively, with open source code distribution and reproducible experiments in  [Mir15]  and the present manuscript respectively.
For those readers who may hesitate between the two approaches, let us say that the FM-VR1 is faster, especially in dimension 3, and more accurate if the second order enhancement of the numerical scheme is activated, but slightly less accurate otherwise, see  [Mir17a]  for a more in-depth comparison. From a practical point of view, the FM-VR1 code is more feature packed, and has interfaces to more scripting languages, while the FM-LBR is tightly integrated within the Insight ToolKit (ITK R ) library. We repeat in this subsection the numerical experiments presented in  [Mir14, Mir17a] , which can now be easily reproduced using the provided Python and Mathematica R notebooks. The test cases are all synthetic, but are inspired from problems arising in geometry processing, seismic imaging and tubular segmentation.
In practice, instructing the HFM software to numerically solve a Riemmanian eikonal equation is done by selecting the appropriate executable, ending with 'Riemann2' or 'Riemann3', depending on the dimension 18  , and providing the key-value pair metric:arrTensors, where "arrTensors" is an array containing the Riemannian metric tensors. (Alternatively, the inverse tensors may be supplied as dualMetric:arrTensors. ) A series of two dimensional test cases, considered in [SV01, Mir14, Mir17a], are described below. Level sets of each example are displayed in Figure  17. We recall that the condition number of a symmetric tensor is defined by Cond(M ) := M M -1. The numerical techniques implemented in the HFM library are primarily intended Riemannian metrics which tensors have condition number 10, although more degenerate instances are often handled successfully.
Tubular structure segmentation Tubular structure segmentation in medical images is one of the main applications intended for the HFM library. Early versions, and related software of the first author, are used for that purpose in [CCM14, SBD + 15, CMC16a, DMMP16, CMC16b, MDS + 17, BCP17]. Vessel extraction in images of the retina is illustrated in Figure  25 , using two popular models involving respectively radius and orientation lifting. Let us briefly recall the principles underlying this approach. Consider an image, e. g. in grayscale and represented by a function I : U → [0, 1], displaying a family of possibly overlaid tubular structures. Segmentation methods based on minimal paths attempt to extract the centerlines of these tubular structures as geodesics w. r. t. a suitable metric, joining endpoints which are either prescribed by the user or automatically detected by another method.
Segmentation in 3D DMRI data We illustrate three dimensional tubular structure segmentation in (simulated) dMRI data. This medical imaging technique measures diffusivity at each point x ∈ R 3 , and in each direction n ∈ S 2. The input data is therefore intrinsically defined over the configuration space R 3 × S 2 , in contrast with §5. 3 where dimension lifting was an artificially introduced image processing technique. We use a digital phantom dataset that was constructed, using the dMRI simulation method [CDD + 14], for the ISBI 2013 reconstruction challenge, where it was used as a benchmark for tracking methods [DCRD + 14]. The dataset itself consists of a fairly challenging configuration of 27 simulated white matter bundles, inside a spherical volume. The entire volume has a size of 50 × 50 × 50 voxels.
In the same volume, there are three spherical regions with isotropic diffusion. We use a constrained spherical deconvolution approach  [TCC07]  to estimate from the raw simulated dMRI data a fiber orientation distribution (FOD), that in each voxel indicates the probability of having a fiber in that direction. The density of this FOD is denoted by f : R 3 × S 2 → R +. Then following the approach in  [DMMP16] , we use the FOD to construct the cost function as follows: for any p = (x, n) ∈ R 3 × S 2 c(p) = 1 + σ f (p) ||f || ∞ p -1 , σ, p ≥ 1. (46) The parameter σ influences how strongly the data should affect the optimal path, and the exponent p influences how 'sharp' the FOD profiles are. As a proof-of-concept experiment on this dataset, we consider the case where the seed point and end point of a bundle are given and we compute the shortest path connecting the two.
Conclusion In this paper, we introduced the Hamiltonian Fast Marching (HFM) library, a state-of-the-art software for global path optimization with respect to non-isotropic metrics. Our numerical methods apply in particular to Riemannian metrics in dimensions two and three, possibly strongly anisotropic, using an adaptive discretization scheme based on lattice geometry techniques. We also globally optimize second order energies depending on the path curvature, by introducing a dimension lifted space equipped with a non-holonomic metric, suitably relaxed in the implementation. The classical models due to Reeds-Shepp, Euler-Mumford, and Dubins, are implemented, as well as numerous generalizations and variants which all have specific qualitative properties and use cases. A number of transversal methods are provided, such as backward algorithmic differentiation which is novel in this context.
This software is provided in the form of a unified, optimized, and open source c++ code, with convenient interfaces for several major scripting languages. The HFM library has already found several applications in the study of visual illusions, motion planning, and image segmentation. We hope that this publication, and the series of introductory notebooks that are provided alongside, will help popularize these techniques and their present and future applications. The HFM library is part of an ongoing research effort and will continue to evolve. Considered additions include higher dimensional Riemannian metrics and a better enforcement of non-holonomy constraints.
C Norm of the geodesic flow This section is devoted to the proof of Proposition 3. 1. Our first step is to rewrite the announced result in a more abstract framework, keeping only the minimal assumptions. Pixel area. The HFM library assumes, as shown above and in dimension two for simplicity, that the "pixel" of coordinates (i, j) occupies the square with corners (i, j)h and (i + 1, j + 1)h. However, some visualization software use define the "pixel" of index (i, j) as the square of side h centered at (i, j)h or at (i+1, j +1)h. This raises (minor) issues when geodesic paths are overlaid on images, and can be adjusted for by shifting the origin by (-0. 5, -0. 5)h or (0. 5, 0. 5)h. Array ordering. When displaying the data contained in a two or three-dimensional array, some software choose to assign the array indices (i, j, k) to the coordinate axes (X, Y, Z) in a transposed manner: i → Y, j → X, k → Z.
The recipes were selected from five categories: 'Appetizers and Snacks', 'Breakfast and Lunch', 'Dessert', 'Dinner' and 'Drinks'. Semantic tags used for annotating food entities were selected from the Hansard corpus. To extract and annotate food entities, we applied a rule-based food NER method called FoodIE. Since FoodIE provides a weakly annotated corpus, by manually evaluating the obtained results on 1000 recipes, we created a gold standard of FoodBase. It consists of 12 844 food entity annotations describing 2105 unique food entities. Additionally, we provided a weakly annotated corpus on an additional 21 790 recipes. It consists of 274 053 food entity annotations, 13 079 of which are unique. The FoodBase corpus is necessary for developing corpus-based NER models for food science, as a new benchmark dataset for machine learning tasks such as multi-class classification, multi-label classification and hierarchical multi-label classification.
However, in 2019, Lancer Planetary Health published that 2019 is the year of nutrition, where the focus should be on discovering relations between food systems, human health, and the environment. Contrary to the large number of available annotated corpora with entities from the biomedical domain, in the food domain there are a limited number of resources that could be used for research. Today, there are a vast number of recipes published on the internet, which carry valuable information about food and nutrition. However, to the best of our knowledge, there are only two existing corpora of annotated recipes: (i) the r-FG (recipe flow graph) corpus (  14 ) and (ii) the CURD (Carnegie Mellon University Recipe Database) corpus  (15). The r-FG corpus consists of 266 Japanese recipes annotated using eight tags related to food, tool, duration, quantity, action by the chef , action by foods, state of foods and state of tools.
The CURD corpus consists of 300 annotated recipes and 350 unannotated ones, for which the Minimal Instruction Language for the Kitchen language (MILK) is used for annotation  (15). Let us mention the UCREL semantic analysis system (USAS), which is a framework for automated semantic analysis of text. It distinguishes between 21 major categories, one of which is also 'food and farming' (F)  (16). Further, it provides additional semantic tag information that is used in the Hansard corpus (17). The Hansard corpus was recently created as part of the SAMUELS (Semantic Annotation and Mark-Up for Enhancing Lexical Searches) project  (18) , with the aim to extract speeches (i. e. digitised debates) given in the British Parliament from 1803 to 2005. As part of our previous work  (19) (20) , we developed drNER, which is a rule-based NER system used for IE from evidence-based dietary recommendations, where beside entities related to nutrition and dietary recommendations, food entities were also of our interest.
Text POS-tagging and post-processing the tag dataset: this step consists of acquiring the textual data with Part of Speech tags, as well as ensembling both taggers' data to increase robustness. 3. Semantic annotation of food tokens in the text: this is the main rule engine of FoodIE, which utilizes a small number of rules and performs semantic annotation of the tokens in the text, classifying it in one of four classes which are further used to perform NER. 4. Food name-entity recognition: this step is concerned with chaining the semantically annotated tokens into food chunks that represent a single food concept. For the aims of creating the FoodBase corpus, we added an additional step to the end of the FoodIE pipeline: 5. Semantic annotation of the extracted food entities: here, the Hansard semantic tags are grouped within each token for each food chunk, with the goal of representing the food concept in its entirety.
Second trial. Once the effectiveness of the concept was evaluated on 200 recipes, the complete set of 1000 recipes was processed and evaluated, and predictions for them are presented in  (21). Comparing the evaluation metrics for 200 and 1000 recipes presented in  (21) , we can conclude that FoodIE behaves consistently. Evaluating the dataset with 200 recipes, which consists of 100 recipes that were analysed to build the rule engine and 100 new recipes that were not analysed beforehand, we obtained a precision of 0. 9761, a recall of 0. 9430 and a F 1 score of 0. 9593. Furthermore, by evaluating it on the dataset of 1000 new recipes, we obtained 0. 9780 for precision, 0. 9437 for recall and 0. 9605 for the F 1 score. From these results, we can conclude that FoodIE gives very promising and consistent results.
Examples include the following:  Manual evaluation. Semantic annotations obtained by FoodIE were manually evaluated. Food entities reported as FPs were manually excluded from the corpus, while the food entities reported as FNs were included in the corpus. This was done in order to obtain a good benchmarking dataset, which contains all food entities that are present in the dataset of 1000 randomly selected recipes from five main dish categories. Furthermore, apart from excluding FPs and including FNs, the annotated semantic tags were double-checked. During this process, all the incorrect semantic tags were removed, while all the missing semantic tags were added to specific food entities. Annotation format. We decided to annotate the extracted information using the BioC format  (23) , which has been originally proposed by biomedical NLP and text mining tools.
Justification of using semantic tags from Hansard corpus. Before we decided which semantic tags will be used to describe the extracted food entities, we tried several other knowledge resources for identifying food entities. We did this by using the set of 1000 recipes. To extract and describe the food entities, we used two approaches: FoodIE and NCBO annotator  (24). The NCBO Annotator is a web service that annotates text provided by the user by using relevant ontology concepts. It is available as part of the BioPortal software services  (28). The annotation workflow is based on an efficient syntactic concept recognition engine (which utilizes concept names and synonyms), as well as on a set of semantic expansion algorithms that leverage the semantic information found in ontologies. The methodology relies on ontologies to create annotations for textual data and presents them by using semantic web standards.
It can be also used for named-entity extraction from food ontologies that are part of the BioPortal software services. FoodIE annotates the food entities using the semantic tags from the Hansard corpus, while the NCBO annotator was used for annotation in a combination with three food ontologies that are available in the BioPortal (i. e. FoodOn  (25) , OntoFood and SNOMED CT (  26 )). We should mention here that SNOMED CT is also part of the Unified Medical Language Systems (UMLS)  (27). Each version of the NCBO annotator working with a different ontology was assumed to be as a different NER method (i. e. NCBO (SNOMED CT), NCBO (OF), NCBO (FoodOn)). Finally, a total of four different NER methods (FoodIE, NCBO (SNOMED CT), NCBO (OF) and NCBO (FoodOn)) that can be used for food information extraction were compared.
Food ontologies alignment. To align food concepts in different food ontologies, we have created a resource, named FoodOntoMap, that consists of food concepts extracted from recipes. For each food concept, semantic tags from four food ontologies are assigned. With this, we create a resource that provides a link between different food ontologies, which can further be reused to develop applications for understanding the relation between food systems, human health and the environment. The results from FoodOntoMap are four different datasets and one data set mapping. Each dataset consists of an artificial ID for each unique food concept that is extracted by using each approach, the name of the extracted food concept and the semantic tags assigned to it. Each dataset corresponds to one of the four semantic resources: Hansard corpus, FoodOn, OntoFood and SNOMED CT.