SciPy is an open-source scientific computing library for the Python programming language. Since its initial release in 2001, SciPy has become a de facto standard for leveraging scientific algorithms in Python, with over 600 unique code contributors, thousands of dependent packages, over 100,000 dependent repositories and millions of downloads per year. In this work, we provide an overview of the capabilities and development practices of SciPy 1.0 and highlight some recent technical developments. This Perspective describes the development and capabilities of SciPy 1.0, an open source scientific computing library for the Python programming language. SciPy is built on top of NumPy2, which provides array data structures and related fast numerical routines, and SciPy is itself the foundation upon which higher level scientific libraries, including scikit-learn3 and scikit-image4, are built. Scientists, engineers and others around the world rely on SciPy. For example, published scripts6 used in the analysis of gravitational waves8 import several subpackages of SciPy, and the M87 black hole imaging project cites SciPy9.SciPy is a library of numerical routines for the Python programming language that provides fundamental building blocks for modeling and solving scientific problems. SciPy includes algorithms for optimization, integration, interpolation, eigenvalue problems, algebraic equations, differential equations and many other classes of problems; it also provides specialized data structures, such as sparse matrices and Recently, SciPy released version 1.0, a milestone that traditionally signals a library’s API (application programming interface) being mature enough to be trusted in production pipelines. This version numbering convention, however, belies the history of a project that has become the standard others follow and has seen extensive adoption in research and industry.12—was preposterous.SciPy’s arrival at this point is surprising and somewhat anomalous. When started in 2001, the library had little funding and was written mainly by graduate students—many of them without a computer science education and often without the blessing of their advisors. To even imagine that a small group of ‘rogue’ student programmers could upend the already well-established ecosystem of research software—backed by millions in funding and many hundreds of highly qualified engineershttps://wiki.python.org/moin/NumericAndScientific) and a variety of social activities centered around them (https://wiki.python.org/moin/PythonConferences). The packages in the SciPy ecosystem share high standards of implementation, documentation and testing, and a culture eager to learn and adopt better practices—both for community management and software development.Yet the philosophical motivations behind a fully open tool stack, combined with an excited, friendly community with a singular focus, have proven auspicious in the long run. They led not only to the library described in this paper, but also to an entire ecosystem of related packages . As a general-purpose programming language, it had no special support for scientific data structures or algorithms, unlike many of the other established computation platforms of the time. Yet scientists soon discovered the language’s virtues, such as its ability to wrap C and Fortran libraries, and to then drive those libraries interactively. Scientists could thereby gain access to a wide variety of existing computational libraries without concerning themselves with low-level programming concepts such as memory management.Python is an interpreted, high-level, general-purpose computer programming language, designed by Guido van Rossum in the late 1980s, with a dynamic type system and an emphasis on readability and rapid prototyping14:“There seems to be a fair amount of interest in the Python community concerning the addition of numeric operations to Python. My own desire is to have as large a library of matrix based functions available as possible . In order to ensure that all of these libraries interoperate, there needs to be agreement on a basic matrix object that can be used to represent arrays of numbers.”In 1995, Jim Hugunin, a graduate student at the Massachusetts Institute of Technology, wrote the first message in a new Python Matrix Special Interest Group (Matrix-SIG) mailing list15:“I’ve used almost all of the available numerical languages at one time or another over the past 8 years. One thing I’ve noticed is that over time, the designers of these languages are steadily adding more of the features that one would expect to find in a general-purpose programming language.”Over the next several months, conversations on that mailing list by, among others, Jim Fulton, Jim Hugunin, Paul Dubois, Konrad Hinsen and Guido van Rossum led to the creation of a package called Numeric with an array object that supported a high number of dimensions. Jim Hugunin explained the utility of Python for numerical computationThis remains a distinguishing feature of Python for science and one of the reasons why it has been so successful in the realm of data science: instead of adding general features to a language designed for numerical and scientific computing, here scientific features are added to a general-purpose language. This broadens the scope of problems that can be addressed easily, expands the sources of data that are readily accessible and increases the size of the community that develops code for the platform.16. Travis Oliphant, a PhD student at the Mayo Clinic, released a number of packages18 that built on top of the Numeric array package, and provided algorithms for signal processing, special functions, sparse matrices, quadrature, optimization, fast Fourier transforms and more. One of these packages, Multipack (http://pylab.sourceforge.net/multipack.html), was a set of extension modules that wrapped Fortran and C libraries to solve nonlinear equations and least-squares problems, integrate differential equations and fit splines. Robert Kern, then an undergraduate student (and currently a SciPy core developer), provided compilation instructions under Windows. Around the same time, Pearu Peterson, a PhD student from Estonia, released F2PY19, a command line tool for binding Python and Fortran codes, and wrote modules for linear algebra and interpolation. Eric Jones, while a graduate student at Duke University, wrote packages to support his dissertation, including a parallel job scheduler and genetic optimizer. Gary Strangman, a postdoctoral fellow at Harvard Medical School, published several descriptive and inferential statistical routines20.By the late 1990s, discussions appeared on Matrix-SIG expressing a desire for a complete scientific data analysis environment21 appearing in February, and a mailing list announced22 in June 2001. By August 2001, a first release was announced23, an excerpt of which is shown in Box 24. The first SciPy workshop25 was held in September 2002 at Caltech—a single track, two-day event with 50 participants, many of them developers of SciPy and surrounding libraries.With a rich programming environment and a numerical array object in place, the time was ripe for the development of a full scientific software stack. In 2001, Eric Jones and Travis Vaught founded Enthought Scientific Computing Solutions  in Austin, Texas, USA. To simplify the tool stack, they created the SciPy project, centered around the SciPy library, which would subsume all the above-mentioned packages. The new project quickly gained momentum, with a website and code repository26, and the Space Telescope Science Institute (STScI), which was in charge of Hubble Space Telescope science operations, decided to replace their custom scripting language and analysis pipeline with Python27. As STScI continued to use Python for an increasingly large portion of the Hubble Space Telescope data analysis pipeline, they encountered problems with the Python numerical array container. Numeric, the original array package, was suitable for small arrays, but not for the large images processed by STScI. With the Numeric maintainer’s blessing, the decision was made to write NumArray28, a library that could handle data on a larger scale. Unfortunately, NumArray proved inefficient for small arrays, presenting the community with a rather unfortunate choice. In 2005, Travis Oliphant combined the best elements of Numeric and NumArray, thereby solving the dilemma. NumPy 1.0 was released29 in October 2006, paving the way for the reunified scientific Python community to mature.At this point, scientific Python started attracting more serious attention; code that started as side projects by graduate students had grown into essential infrastructure at national laboratories and research institutes. For example, Paul Dubois at Lawrence Livermore National Laboratory (LLNL) took over the maintenance of Numeric and funded the writing of its manualhttps://www.scipy.org/scikits.html), a complementary library developed outside SciPy, allowing for more rapid exploration of experimental ideas while maintaining familiar style and development methodology. In SciPy itself, tooling, development, documentation and release processes became more professional. The library was expanded carefully, with the patience affordable in open-source projects and via best practices, which are increasingly common in the scientific Python ecosystem and industry30.By the middle to late 2000s, SciPy was starting to mature after a long phase of significant growth and adoption. The scope of the SciPy library narrowed, while the breadth of the ecosystem grew through a new type of auxiliary package: the scikit  interspersed with Python code, and in 2008, pydocweb32 enabled collaborative documentation development in a wiki-like fashion. The SciPy Documentation Project34 used these tools to complete documentation of SciPy’s user-facing functionality: offering t-shirts to contributors from around the world in exchange for high-quality text, it collected contributions from over 75 people to produce an 884-page manual35. Since then, SciPy has remained committed to maintaining high-quality documentation as part of the normal development cycle.Early versions of SciPy had minimal documentation, but this began to change with the 2006 release of a SIAM News36.In the early SciPy workshops, recurrent topics reflected the state of development, with emphasis being placed on the underlying array package, plotting, parallel processing, acceleration/wrapping and user interfaces. By 2004, presentations about the application of SciPy to scientific problems began to appear. The event also started to draw in more keynote speakers from outside the community, such as Guido van Rossum , Ivan Krstić , Alex Martelli  and Peter Norvig . The informal workshop grew from a small gathering of core developers into an international conference with hundreds of attendees, increased funding, a published proceedings and scholarships for attending students. By 2010, the US SciPy conference had multiple tracks, and satellite conferences were being organized by volunteers elsewhere, such as EuroSciPy (since 2008) and SciPy India (since 2009). Special sessions and minisymposia dedicated to scientific Python began appearing at many other events. For example, a three-part minisymposium organized for International Conferences on Computational Science and Engineering (CSE) 2009 was featured in IEEE Computing in Science and Engineering solicited a special issue about Python in science37, edited by Paul Dubois. However, Python was still sufficiently niche that the average reader would need additional information to decide whether it would be useful in their own work. The follow-up March/April 2011 Python for Scientists and Engineers special issue38 focused more on the core parts of the scientific Python ecosystem39 including NumPy2, Cython40 and Mayavi41. Python became so pervasive that journals began publishing domain-specific special issues. For example, in 2015, Frontiers in Neuroinformatics published a collection of 25 articles—covering topics including modeling and simulation, data collection, electrophysiology, visualization as well as stimulus generation and presentation—called Python in Neuroscience42.In 2007, Python had a strong enough presence in science and engineering that the editors of 43. Some of the major feature highlights from the three years preceding SciPy 1.0 are discussed in the “Key technical improvements” section below, and milestones in its history are highlighted in Fig. As of February 2019, the SciPy library consists of nearly 600,000 lines of open-source code organized in 16 subpackages summarized in Box Box 1 Excerpt from the SciPy 0.1 release announcement (typos corrected), posted 20 August 2001 on the Python-list mailing listSpecial functions Signal/image processing2D plotting capabilitiesIntegrationODE solversOptimization Genetic algorithmsNumeric to C++ expression compilerParallel programming toolsSplines and interpolationOther itemsSciPy is an open-source package that builds on the strengths of Python and Numeric, providing a wide range of fast scientific and numeric functionality. SciPy’s current module set includes the following:Box 2 Package organizationk-D trees), algorithms  and higher-level data analysis functionality .The SciPy library is organized as a collection of subpackages. The 16 subpackages include mathematical building blocks , data structures  and API reference (https://docs.scipy.org/doc/scipy/reference/index.html#api-reference).Here we summarize the scope and capabilities of each subpackage. Additional information is available in the SciPy tutorial  interpolation classes, Lagrange and Taylor polynomial interpolators, and wrappers for FITPACKiohttps://www.mathworks.com/products/matlab.html), IDL, Matrix Market120, Fortran, NetCDF121, Harwell-Boeing122, WAV and ARFF data files.A collection of functions and classes for reading and writing Matlab ; matrix decompositions, including Cholesky, Schur, Hessenberg, LU, LDLT, QR, QZ, singular value and polar; and functions to create specialized matrices, such as diagonal, Toeplitz, Hankel, companion, Hilbert and more.Linear algebra functions, including elementary functions of a matrix, such as the trace, determinant, norm and condition number; basic solver for ndimageThis subpackage contains various functions for multi-dimensional image processing, including convolution and assorted linear and nonlinear filters ; interpolation; region labeling and processing; and mathematical morphology functions.miscA collection of functions that did not fit into the other subpackages. Although this subpackage still exists in SciPy 1.0, an effort is underway to deprecate or relocate the contents of this subpackage and remove it.odr54.Orthogonal distance regression, including Python wrappers for the Fortran library ODRPACKoptimizeThis subpackage includes simplex and interior-point linear programming solvers, implementations of many nonlinear minimization algorithms, a routine for least-squares curve fitting, and a collection of general nonlinear solvers for root-finding.signalThe signal subpackage focuses on signal processing and basic linear systems theory. Functionality includes convolution and correlation, splines, filtering and filter design, continuous and discrete time linear systems, waveform generation, window functions, wavelet computations, peak finding and spectral analysis.sparseThis subpackage includes implementations of several representations of sparse matrices. scipy.sparse.linalg provides a collection of linear algebra routines that work with sparse matrices, including linear equation solvers, eigenvalue decomposition, singular value decomposition and LU factorization. scipy.sparse.csgraph provides a collections of graph algorithms for which the graph is represented using a sparse matrix. Algorithms include connected components, shortest path, minimum spanning tree and more.spatialk-d tree, Delaunay triangulation, convex hulls and Voronoi diagrams. scipy.spatial.distance provides a large collection of distance functions, along with functions for computing the distance between all pairs of vectors in a given collection of points or between all pairs from two collections of points.This subpackage provides spatial data structures and algorithms, including the specialThe name comes from the class of functions traditionally known as special functions, but over time, the subpackage has grown to include functions beyond the classical special functions. A more appropriate characterization of this subpackage is simply useful functions. It includes a large collection of the classical special functions such as Airy, Bessel and others; families of orthogonal polynomials; the Gamma function, and functions related to it; functions for computing the PDF, CDF and quantile function for several probability distributions; information theory functions; combinatorial functions comb and factorial; and more.statst-test) and tests whether a sample is drawn from a certain distribution (such as the Kolmogorov-Smirnov test); measures of correlation, including Pearson’s r, Kendall’s τ, and Spearman’s ρ coefficients; descriptive statistics including trimmed values; kernel density estimation; and transformations of data such as the Box-Cox power transformation.The stats subpackage provides a large collection of continuous and discrete probability distributions, each with methods to compute the PDF or PMF, CDF, moments and other statistics, generation of random variates and more; statistical tests, including tests on equality of means/medians/variance , whereas Statsmodels45 provides more advanced statistical estimators and inference methods, scikit-learn3 covers machine learning, and PyMC346, emcee47 and PyStan (http://mc-stan.org) cover Bayesian statistics and probabilistic modeling. scikit-image4 provides image processing capabilities beyond SciPy’s ndimage, SymPy48 provides a Python interface for symbolic computation, and sparse.csgraph and spatial offer basic tools for working with graphs and networks compared to specialized libraries such as NetworkX49.SciPy provides fundamental algorithms for scientific computing. The breadth of its scope was derived from the guide to available mathematical software (GAMS) classification systemThe algorithm is of relevance to multiple fields of science.The algorithm is demonstrably important. For example, it is classic enough to be included in textbooks, or it is based on a peer-reviewed article that has a substantial number of citations.We use the following criteria to determine whether to include new functionality in SciPy:In terms of software systems and architecture, SciPy’s scope matches NumPy’s: algorithms for in-memory computing on single machines, with support for a wide range of data types and process architectures. Distributed computing and support for graphics processing units (GPUs) were explicitly out of scope at the 1.0 release point, but this has been revised in our roadmap (see Discussion).https://github.com/github/linguist), SciPy is approximately 50% Python, 25% Fortran, 20% C, 3% Cython and 2% C++, with a dash of TeX, Matlab, shell script and Make. The distribution of secondary programming languages in SciPy is a compromise between a powerful, performance-enhancing language that interacts well with Python  and the usage of languages (and their libraries) that have proven reliable and performant over many decades.According to analysis using the linguist library  for computing Bessel functions; and CDFLIB60 for evaluating cumulative density functions.Fortran, despite its age, is still a high-performance scientific programming language with continued contemporary usage61 of scientific computing. The C libraries that we wrap in SciPy include trlib62 for optimization, SuperLU64 for solving sparse linear systems, Qhull65 for computational geometry and Cephes (http://www.netlib.org/cephes/) for special functions.Rounding out the top three languages in SciPy is C, which is also extremely well-established over several decades40. We often use Cython as a glue between well-established, low-level scientific computing libraries written in C/C++ and the Python interface offered by SciPy. We also use Cython to enable performance enhancements in Python code, especially for cases where heavily used inner loops benefit from a compiled code with static typing.Cython has been described as a creole language that mixes the best parts of Python and lower-level C/C++ paradigmsFor implementing new functionality, Python is the still the language of choice. If Python performance is an issue, then we prefer the use of Cython followed by C, C++ or Fortran (in that order). The main motivation for this is maintainability: Cython has the highest abstraction level, and most Python developers will understand it. C is also widely known, and easier for the current core development team to manage than C++ and especially Fortran.66) are very powerful but have traditionally fallen outside the remit of the main SciPy library. That said, we have recently increased our efforts to support compatibility with some of these options, and our full test suite passed with the PyPy JIT compiler67 at the 1.0 release point.The position that SciPy occupies near the foundation of the scientific Python ecosystem is such that adoption of new languages or major dependencies is generally unlikely; our choices are strongly driven by long-term stability. GPU acceleration, new transpiling libraries and the latest JIT compilation approaches  costs to users and only after giving clear deprecation warnings to those users for at least one year. In general, we encourage changes that improve clarity in the API of the library but strongly discourage breaking backward compatibility, given our position near the base of the scientific Python computing stack.In addition to the Python API, SciPy has C and Cython interfaces. Therefore, we also have to consider the application binary interface (ABI). This ABI has been stable for a long time, and we aim to evolve it only in a backward-compatible way.Here we describe key technical improvements made in the last three years.scipy.sparse offers seven sparse matrix data structures, also known as sparse formats. The most important ones are the row- and column-compressed formats . These offer fast major-axis indexing and fast matrix-vector multiplication, and are used heavily throughout SciPy and dependent packages.63 was updated to version 5.2.1, enhancing the low-level implementations leveraged by a subset of our sparse offerings.Over the last three years, our sparse matrix handling internals were rewritten and performance was improved. Iterating over and slicing of CSC and CSR matrices is now up to 35% faster, and the speed of coordinate (COO)/diagonal (DIA) to CSR/CSC matrix format conversions has increased. SuperLUFrom a new features standpoint, scipy.sparse matrices and linear operators now support the Python matrix multiplication (@) operator. We added scipy.sparse.norm and scipy.sparse.random for computing sparse matrix norms and drawing random variates from arbitrary distributions, respectively. Also, we made a concerted effort to bring the scipy.sparse API into line with the equivalent NumPy API where possible.k-dimensional space, was rewritten in C++ with templated classes. Support was added for periodic boundary conditions, which are often used in simulations of physical processes.The scipy.spatial.ckdtree module, which implements a space-partitioning data structure that organizes points in k-nearest-neighbor search from cKDTree.query was approximately loglinear68, consistent with its formal description69. Since then, we enhanced cKDTree.query by reimplementing it in C++, removing memory leaks and allowing release of the global interpreter lock (GIL) so that multiple threads may be used70. This generally improved performance on any given problem while preserving the asymptotic complexity.In 2013, the time complexity of the p-norm between 1 and infinity. By default, the returned data structure is a dictionary of keys (DOK)-based sparse matrix, which is very efficient for matrix construction. This hashing approach to sparse matrix assembly can be seven times faster than constructing with CSR format71, and the C++ level sparse matrix construction releases the Python GIL for increased performance. Once the matrix is constructed, distance value retrieval has an amortized constant time complexity72, and the DOK structure can be efficiently converted to a CSR, CSC or COO matrix to allow for speedy arithmetic operations.In 2015, SciPy added the sparse_distance_matrix routine for generating approximate sparse distance matrices between KDTree objects by ignoring all distances that exceed a user-provided value. This routine is not limited to the conventional L2 (Euclidean) norm but supports any Minkowski 73 was enhanced to support weights74, which are essential in many scientific applications, for example, computing correlation functions of galaxies75.In 2015, the cKDTree dual tree counting algorithmAs of SciPy version 0.19, it is possible for users to wrap low-level functions in a scipy.LowLevelCallable object that reduces the overhead of calling compiled C functions, such as those generated using Numba or Cython, directly from Python. Supported low-level functions include PyCapsule objects, ctypes function pointers and cffi function pointers. Furthermore, it is possible to generate a low-level callback function automatically from a Cython module using scipy.LowLevelCallable.from_cython.76 routines for many years. SciPy now additionally includes Cython40 wrappers for many BLAS and LAPACK routines (added in 2015) and the special functions provided in the scipy.special subpackage (added in 2016), which are available in scipy.linalg.cython_blas, scipy.linalg.cython_lapack and scipy.special.cython_special, respectively. When writing algorithms in Cython, it is typically more efficient to call directly into the libraries SciPy wraps rather than indirectly, using SciPy’s Python APIs. These low-level interfaces for Cython can also be used outside of the SciPy codebase to gain access to the functions in the wrapped libraries while avoiding the overhead of Python function calls. This can give performance gains of one or two orders of magnitude for many use cases.SciPy has provided special functions and leveraged basic linear algebra subprograms (BLAS) and linear algebra package (LAPACK)77. This lets other extensions avoid the complexity of finding and using the correct libraries. Avoiding this complexity is especially important when wrapping libraries written in Fortran. Not only can these low-level wrappers be used without a Fortran compiler, they can also be used without having to handle all the different Fortran compiler ABIs and name mangling schemes.Developers can also use the low-level Cython interfaces without linking against the wrapped libraries19, though a small number of routines use hand-written type signatures instead. The input and output types of each routine are saved in a data file that is read at build time and used to generate the corresponding Cython wrapper files. The wrappers in scipy.special.cython_special are also generated from a data file containing type information for the wrapped routines.Most of these low-level Cython wrappers are generated automatically to help with both correctness and ease of maintenance. The wrappers for BLAS and LAPACK are primarily generated using type information that is parsed from the BLAS and LAPACK source files using F2PYSince SciPy can be built with LAPACK 3.4.0 or later, Cython wrappers are only provided for the routines that maintain a consistent interface across all supported LAPACK versions. The standard BLAS interface provided by the various existing BLAS libraries is not currently changing, so changes are not generally needed in the wrappers provided by SciPy. Changes to the Cython wrappers for the functions in scipy.special follow corresponding changes to the interface of that subpackage.The scipy.optimize subpackage provides functions for the numerical solution of several classes of root finding and optimization problems. Here we highlight recent additions through SciPy 1.0.78, it solves all of the 90+ NETLIB LP benchmark problems79 tested. Unlike some interior point methods, this homogeneous self-dual formulation provides certificates of infeasibility or unboundedness as appropriate.A new interior-point optimizer for continuous linear programming problems, linprog with method = ’interior-point’, was released with SciPy 1.0. Implementing the core algorithm of the commercial solver MOSEK80 solves trivial problems and otherwise performs problem simplifications, such as bound tightening and removal of fixed variables, and one of several routines for eliminating redundant equality constraints is automatically chosen to reduce the chance of numerical difficulties caused by singular matrices. Although the main solver implementation is pure Python, end-to-end sparse matrix support and heavy use of SciPy’s compiled linear system solvers—often for the same system with multiple right hand sides owing to the predictor-corrector approach—provide speed sufficient for problems with tens of thousands of variables and constraints.A presolve routineThe minimize function provides a unified interface for finding local minima of nonlinear optimization problems. Four new methods for unconstrained optimization were added to minimize in recent versions of SciPy: dogleg, trust-ncg, trust-exact and trust-krylov. All are trust-region methods that build a local model of the objective function based on first and second derivative information, approximate the best point within a local ‘trust region’ and iterate until a local minimum of the original objective function is reached, but each has unique characteristics that make it appropriate for certain types of problems. For instance, trust-exact achieves fast convergence by solving the trust-region subproblem almost exactly, but it requires the second derivative Hessian matrix to be stored and factored every iteration, which may preclude the solution of large problems . In contrast, trust-ncg and trust-krylov are well suited to large-scale optimization problems because they do not need to store and factor the Hessian explicitly, instead using second derivative information in a faster, approximate way. We compare the characteristics of all minimize methods in detail in Table 82 is a stochastic global optimizer that works by evolving a population of candidate solutions. In each iteration, trial candidates are generated by combination of candidates from the existing population. If the trial candidates represent an improvement, then the population is updated. Most recently, the SciPy benchmark suite gained a comprehensive set of 196 global optimization problems for tracking the performance of existing solvers over time and for evaluating whether the performance of new solvers merits their inclusion in the package.As minimize may return any local minimum, some problems require the use of a global optimization routine. The new scipy.optimize.differential_evolution function83).The scipy.stats subpackage contains more than 100 probability distributions: 96 continuous and 13 discrete univariate distributions, and 10 multivariate distributions. The implementation relies on a consistent framework that provides methods to sample random variates, to evaluate the cumulative distribution function (CDF) and the probability density function (PDF), and to fit parameters for every distribution. Generally, the methods rely on specific implementations for each distribution, such as a closed-form expression of the CDF or a sampling algorithm, if available. Otherwise, default methods are used based on generic code, for example, numerical integration of the PDF to obtain the CDF. Key recent distributions added to scipy.stats include the histogram-based distribution in scipy.stats.rv_histogram and the multinomial distribution in scipy.stats.multinomial  and BSpline (SciPy 0.19)86, which allow efficient vectorized evaluations, differentiation, integration and root-finding. PPoly represents piecewise polynomials in the power basis in terms of breakpoints and coefficients at each interval. BPoly is similar and represents piecewise polynomials in the Bernstein basis . BSpline represents spline curves, that is, linear combinations of B-spline basis elements87.At the lowest level of the new design are classes that represent univariate piecewise polynomials: PPoly (SciPy 0.13)88 constructs a twice differentiable piecewise cubic function, Akima1DInterpolator and PCHIPInterpolator implement two classic prescriptions for constructing a C1 continuous monotone shape-preserving interpolator90.In the next layer, these polynomial classes are used to construct several common ways of interpolating data: CubicSpline (SciPy 0.18)91. For each component of SciPy, we write multiple small executable tests that verify its intended behavior. The collection of these, known as a ‘test suite’, increases confidence in the correctness and accuracy of the library, and allows us to make code modifications known not to alter desired behavior. According to the practice of continuous integration92, all proposed contributions to SciPy are temporarily integrated with the master branch of the library before the test suite is run, and all tests must be passed before the contribution is permanently merged. Continuously monitoring the number of lines of code in SciPy covered by unit tests is one way we maintain some certainty that changes and new features are correctly implemented.Test-driven development has been described as a way to manage fear and uncertainty when making code changeshttps://docs.pytest.org/en/latest) framework. In Fig. https://github.com/tylerjereddy/scipy-cov-track). With the exception of the removal of ∼61,000 lines of compiled code for SciPy v0.14, the volume of both compiled  and Python code has increased between releases, as have the number of lines covered by unit tests. Test coverage at the SciPy 1.0 release point was at 87% for Python code according to pytest-cov (https://pypi.org/project/pytest-cov/). Coverage of compiled  code was only 45% according to gcov (https://gcc.gnu.org/onlinedocs/gcc/Gcov.html), but the compiled codebase is much more robust than this figure would suggest as the figure does not correct for the inclusion of reputable vendor code, the original library of which is well-tested; generated code, for which full coverage is impractical; and deprecated code, which does not require unit tests. Documentation for the code is automatically built and published by the CircleCI service to facilitate evaluation of documentation changes/integrity.The SciPy test suite is orchestrated by a continuous integration matrix that includes POSIX and Windows 32/64-bit) platforms managed by Travis CI and AppVeyor, respectively. Our tests cover Python versions 2.7, 3.4, 3.5, 3.6, and include code linting with pyflakes and pycodestyle. There are more than 13,000 unit tests in the test suite, which is written for usage with the pytest (/64-bit phttps://github.com/airspeed-velocity/asv). SciPy’s run.py script conveniently wraps asv features such that benchmark results over time can be generated with a single console command. For example, in Fig. In addition to ensuring that unit tests are passing, it is important to confirm that the performance of the SciPy codebase improves over time. Since February 2015, the performance of SciPy has been monitored with Airspeed Velocity (asv https://docs.scipy.org/doc/scipy/reference/dev/governance/governance.html) on August 3, 2017. A steering council, currently composed of 18 members, oversees daily development of the project by contributing code and reviewing contributions from the community. Council members have commit rights to the project repository, but they are expected to merge changes only when there are no substantive community objections. The chair of the steering council, Ralf Gommers, is responsible for initiating biannual technical reviews of project direction and summarizing any private council activities to the broader community. The project’s benevolent dictator for life, Pauli Virtanen, has overruling authority on any matter, but is expected to act in good faith and only exercise this authority when the steering council cannot reach agreement.SciPy adopted an official governance document  provides guidance on how to do that. In addition, the project currently has 15 active (volunteer) maintainers: people who review the contributions of others and do everything else needed to ensure that the software and the project move forward. Maintainers are critical to the health of the project93; their skills and efforts largely determine how fast the project progresses, and they enable input from the much larger group of contributors. Anyone can become a maintainer, too, as they are selected on a rolling basis from contributors with a substantial history of high-quality contributions.The SciPy project has ~100 unique contributors for every 6-month release cycle. Anyone with the interest and skills can become a contributor; the SciPy contributor guide (https://www.openhub.net/p/scipy/estimated_cost). Yet the project is largely unfunded, having been developed predominantly by graduate students, faculty and members of industry in their free time. Small amounts of funding have been applied with success: some meetings were sponsored by universities and industry, Google’s Summer of Code program supported infrastructure and algorithm work, and teaching grant funds were used early on to develop documentation. However, funding from national agencies, foundations and industry has not been commensurate with the enormous stack of important software that relies on SciPy. More diverse spending to support planning, development, management and infrastructure would help SciPy remain a healthy underpinning of international scientific and industrial endeavors.The development cost of SciPy is estimated in excess of 10 million dollars by Open Hub , with 721 unique copies (‘clones’) of the codebase over that time period. The developer community at that time consisted of 610 unique contributors of source code, with more than 19,000 commits accepted into the codebase (GitHub page data).95 and 5,776,017 via the default channel of the conda (https://github.com/ContinuumIO/anaconda-package-data) package manager during the year 2017. These numbers establish a lower bound on the total number of downloads by users given that PyPI and conda are only two of several popular methods for installing SciPy. The SciPy website (http://www.scipy.org/), which has been the default citation in the absence of a peer-reviewed paper, has been cited over 3,000 times (https://scholar.google.com/scholar?cites=2086009121748039507). Some of the most prominent uses of or demonstrations of credibility for SciPy include the LIGO-Virgo scientific collaboration that lead to the observation of gravitational waves96, the fact that SciPy is shipped directly with macOS and in the Intel distribution for Python97, and that SciPy is used by 47% of all machine learning projects on GitHub (https://github.blog/2019-01-24-the-state-of-the-octoverse-machine-learning/).From the user side, there were 13,096,468 downloads of SciPy from the Python Packaging Index (PyPI)https://docs.scipy.org/doc/scipy-1.0.0/reference/roadmap.html, https://scipy.github.io/devdocs/roadmap.html), summarized in Table Nevertheless, SciPy continually strives to improve. The SciPy Roadmap (A problem faced by many open-source projects is attracting and retaining developers. Although it is normal for some individuals to contribute to a project for a while and then move on, too much turnover can result in the loss of institutional memory, leading to mistakes of the past being repeated, APIs of new code becoming inconsistent with the old code and a drifting project scope. We are fortunate that the SciPy project continues to attract enthusiastic and competent new developers while maintaining the involvement of a small but dedicated old guard. There are contributors who were present in the early years of the project who still contribute to discussions of bug reports and reviews of new code contributions. Our benevolent dictator for life has been with the project for more than 10 years and is still actively contributing code, and the head of our steering council, who also acts as a general manager, is approaching his eleventh anniversary. An additional half dozen or so active developers have been contributing steadily for five or more years. The combination of a committed old guard and a host of new contributors ensures that SciPy will continue to grow while maintaining a high level of quality.A final important challenge to address is the accommodation of GPU and distributed computing without disrupting our conventional and heavily used algorithm/API infrastructure. Although the exact approach we will adopt across the entire library to leverage these emerging technologies remains unclear, and was not a priority at the 1.0 release point, we now have a concrete implementation of a subpackage that allows for the experimental use of multiple backends, such as GPU-tractable data structures, in the new scipy.fft. This will be described in detail in a future report.Further information on research design is available in the Reporting Summary


Background: Patients with heart failure with preserved ejection fraction (HFpEF) may be at a higher risk of mortality from sepsis than patients without heart failure.Objective: The aim of this study is to compare sepsis-related morbidity and mortality between patients with HFpEF and patients without heart failure presenting to the emergency department (ED) of a tertiary medical center.Design: Single-center retrospective cohort study conducted at an academic ED between January 1, 2015 and December 31, 2018.Patients: Patients with a diagnosis of sepsis were included.Main Measures: Bivariate and multivariate analyses were performed to look at differences in demographics, infection, and treatment parameters as well as outcomes of patients with sepsis. The primary outcome of the study was in-hospital mortality. Secondary outcomes included ED mortality, lengths of stay, and treatment differences between both groups.Key Results: A total of 1,092 patients presented with sepsis to the ED, of which 305 (27.93%) had HFpEF. There was no significant difference in in-hospital mortality between the two groups . However, there was a significant increase in ED mortality for septic HFpEF patients compared to non-heart failure patients . Septic HFpEF patients presenting to the ED were older than non-heart failure patients . On the other hand, there was no significant increase in the use of vasopressors in the first 24 h between both groups. There was a significantly higher rate of intubation in the first 48 h for septic HFpEF patients . Finally, there was significantly less intravenous fluid requirement at 6 h  and 24 h  for septic patients with HFpEF compared to non-heart failure patients.Conclusion: Septic HFpEF patients experienced an increase in ED mortality, intubation, and steroid use compared to septic non-heart failure patients. Heart failure and sepsis are major public health problems. More than 5.8 million in the United States and 23 million people worldwide have heart failure . The preThis was a single-center, retrospective, cohort study conducted in an academic emergency department (ED) between January 1, 2015, and December 31, 2018. The hospital's electronic system was used to query patients' charts. All demographic information, including comorbidities, vital signs, laboratory results, and resuscitation parameters, were extracted from scanned charts by research fellows. Multiple meetings with the principal investigators were conducted to standardize the data extraction and entry process. This study was approved by the Institutional Review Board of the American University of Beirut and the hospital's IRB (BIO-2018-0106) and carried out in accordance with the recommendations provided. The research was performed according to ethical principles and in compliance with all prevailing and applicable laws, rules, and regulations and policies regarding the protection of human subjects and research conduct as outlined by the declaration of Helsinki. Subject privacy and data confidentiality were of paramount concern at all times, and every effort was made to protect subjects' rights and welfare.Patients' ED encounters were filtered by an experienced data user using the hospital's EHR  via an extensive structured keyword search and ICD-9 coding . The ICD-9 diagnoses retrieved were sepsis (995.91) and septic shock (785.52). A list of all patients who were diagnosed with sepsis or septic shock between January 1, 2015, and December 31, 2018, was therefore compiled (IRB #BIO-2018-0106). Sepsis was defined according to the sepsis-3 definition as the presence of an infection with signs of organ dysfunction, which were represented by an increase in the Sequential [Sepsis-related] Organ Failure Assessment (SOFA) score of two points or more. Septic shock was defined by a vasopressor requirement to maintain a mean arterial pressure of 65 mm Hg and a serum lactate level >2 mmol/L (>18 mg/dL) in the absence of hypovolemia (2 and peak tricuspid regurgitation (TR) velocity > 2.8 m/s  and the European Association of Cardiovascular Imaging (EACVI) . In orde 2.8 m/s . All theThe aim was to characterize the presentation of sepsis among HFpEF patients compared to those without heart failure and assess associated clinical outcomes. The primary outcome of the study was in-hospital mortality. Secondary outcomes included ED mortality, lengths of stay, and differences in treatment interventions between both groups. The infection site was determined from documentation in the medical record, culture results , and/or radiology reports (such as chest X-rays). Laboratory results were obtained from the hospital's EHR system. Information about antibiotics and vasopressors, time to their initiation, and duration of their use was obtained by reviewing the scanned ED order sheet. Disposition status was also recorded by reviewing admission and discharge documents.t-test and the Mann–Whitney U-test were used for the continuous ones. Tests were interpreted at a significance level alpha = 0.05. Multivariable analyses were performed to ascertain the association between HFpEF status and mortality  in the ortality . A backwp = 0.285). Patients with HFpEF were significantly older than non-heart failure patients . The HFpEF group had a significantly higher rate of chronic kidney disease , hypertension , dyslipidemia , coronary artery disease , atrial fibrillation , diabetes mellitus , and chronic obstructive pulmonary disease (COPD) . One thousand ninety-two septic patients were included in this study, of which 305 (27.93%) had HFpEF on admission. On the other hand, 787 patients (72.07%) had neither HFpEF nor HFrEF. There was an equal gender distribution among patients with HFpEF , a significantly lower heart rate , and a significantly lower oxygen saturation . The rest of the vital signs at presentation were similar between the two cohorts   . The medp = 0.314); however, this difference was not statistically significant. Moreover, there was a significantly higher rate of ED mortality in the HFpEF cohort . During their hospital course, patients with HFpEF had a lower amount of fluid administered during the first 6 h  and 24 h since ED admission  compared to patients without HFpEF. Among survivors, the hospital length of stay was significantly lower for patients with HFpEF compared to non-heart failure patients . Over the first 24h, more HFpEF patients received steroids . Moreover, over the first 48 h, a higher number of HFpEF patients were intubated compared to patients without heart failure   .p = 0.001). Moreover, HFpEF patients had less gastrointestinal infections when compared to the non-heart failure group . Bacteria were found mostly in blood in the two groups. However, there were more bacteria isolated from the urine in the HFpEF cohort . The most common bacteria found in blood, urine, and wound, in both groups, was E. coli. The most common bacteria found in sputum was Pseudomonas aeruginosa and Acinetobacter baumannii in the HFpEF group and E. coli in the non-heart failure group  2.85 h vs. 3.86 h). In both groups, the most common site of infection was the lungs. However, urinary tract infections were more common in HFpEF septic patients compared to septic patients without HFpEF  after adjusting for confounders. Patients who underwent intubation in the first 24 h  and patients whose lungs were the site of infection  had higher odds of in-hospital mortality. Moreover, for every unit increase of lactic acid at presentation , patients had higher odds of in-hospital mortality . PatientOur results showed that HFpEF patients had a slightly increased in-hospital mortality as compared to the non-heart failure group; however, this difference was not statistically significant. On the other hand, septic HFpEF patients had a significantly higher ED mortality compared to septic patients without heart failure. Moreover, HFpEF patients were found to have 1.21 times the odds of hospital mortality compared to controls and 9 times the odds for ED mortality after adjusting for potential confounders. These results are in line with the literature, where a meta-analysis by Sanfilippo et al. found that septic patients with diastolic dysfunction had a significantly higher mortality rate than patients with no diastolic dysfunction , 9, 11. p < 0.0001), they had a higher rate of intubation, probably due to cardiogenic pulmonary edema. Due to the impaired LV relaxation and the sepsis-induced myocardial suppression, these patients are very sensitive to fluid and can develop pulmonary edema rapidly.Second, sepsis also causes rhythm disturbances, and in a recent study, sepsis was an independent predictor of new-onset atrial fibrillation (AF) . AF is cIt is interesting to note that there was no difference in hospital lengths of stay between both groups nor were there any differences in the lactate acid level, the site of infections, or the most commonly isolated bacteria. One possible explanation for the length of stay similarity could be that HFpEF has a higher mortality early on in the course of sepsis, as witnessed by their high ED mortality in our cohort and their increased intubation rates. However, if they overcome this early period, HFpEF patients tend to have a similar hospital course like non-heart failure patients. Nonetheless, emergency physicians should be aware of their increased mortality. The authors recommend early aggressive measures and early coordination and consultation with cardiology specialists as well as critical care specialists when dealing with a septic HFpEF patient.Given that this was a retrospective chart review cohort study, the most important limitation is the biases associated with this kind of study. In order to minimize those, frequent meetings were held between the principal investigator and research assistants to standardize the way in which data were collected, entered, and cleaned. This study is from a referral academic center ED that deals with regional complicated cases, which could explain the increased mortality seen in both cohorts and could limit the generalizability of the results. Second, the delay in antibiotic administration : 2.85 vs. 3.86 h) might have led to the increased morality, as it has been shown in several studies , 24, 25.Septic HFpEF patients experienced an increased rate of ED mortality, intubation, and steroid use compared to controls. This indicates increased vulnerability for this subcategory of patients. It is important to note that, because of the increased risk of lung congestion and cardiopulmonary edema in these patients, it is preferable to start vasopressors early on for hemodynamic support than to potentially overwhelm them with fluids. Septic HFpEF patients should benefit from a multidisciplinary approach in order to improve their outcome. This is of particular importance in the early phase of the disease given the increased risk of ED noted in our study. ED physicians should promptly identify these patients and aim for individualized and optimal care.The datasets generated for this study are available on request to the corresponding author.The studies involving human participants were reviewed and approved by Institutional Review Board of the American University of Beirut. Written informed consent for participation was not required for this study in accordance with the national legislation and the institutional requirements.RC and GD made substantial contributions to the conception and design of the study. RC, GD, IB, RS, AS, MS, MM, and HT were responsible for the acquisition of data, analysis, and interpretation of data. RC, GD, IB, SJ, and RS were involved in drafting the manuscript. GD, RC, IB, and RS were responsible for revising the manuscript critically for important intellectual content. RC and GD took responsibility for the paper as a whole. All authors contributed substantially to its revision and approved the submitted version.The authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.


Aims: Community integration is the catalyst for recovery that is provided by mental health services to persons with mental disorders. This study explores the impact of socio-demographic variables on the level of community integration in persons with mental disorders compared to the general population living in the same communities and the difference in community integration level between the two groups. Methods: A total of 224 persons with mental disorders  in communities and 247 individuals  of the general population in the same communities participated in the evaluation of levels of physical, psychological, and social integration. The effects of socio-demographic variables on the three types of community integration on both groups were evaluated using multiple regression analyses. Differences in the three types of community integration between the two groups were tested using multivariate analysis of covariance (MANCOVA) by controlling for socio-demographic variables as covariates. Results: The effects of socio-demographic variables on the three types of community integration differed between the two groups. In addition, the two groups differed significantly in terms of social rather than physical or psychological integration when the level of community integration was compared while controlling socio-demographic variables. The results also show that persons with mental disorders had smaller social networks and fewer social contacts than the general population. Conclusions: Based on the findings, we recommended that service providers provide incentives for consumers to strengthen social relationships and social skills training in order to maintain relationships. The aim of mental health serves is to recover persons with mental disorders. “Recovery” refers to persons with mental disorders experiencing “themselves as recovering a new sense of self and of purpose within and beyond the limits of the disability” . In the Despite the importance of community integration, in most societies, persons with mental disorders are still marginalized. Their social networks are small and provide a low level of social support, and because of social stigma, they have limited opportunities for employment, housing, and education ,9,10,11.Originally the concept of community integration focused on physical integration , but gradually evolved to include psychological and social integration. In their concept of community integration, Wong and Solomon  includedPrevious community integration studies have identified predictors of community integration of persons with mental disorders, including socio-demographic variables , psychopThis study compared the level of community integration of the general population and consumers of mental health services with a common geographic and cultural characteristics in order to assess the extent to which the presence of mental disorders is a barrier to community integration. Based on the results, evidence-based intervention for community integration may be suggested. In addition, we explored how socio-demographic variables explain the differences in community integration between the two groups. In other words, the analyses focused on the extent to which socio-demographic variables account for community integration of both the general population and persons with mental disorders; physical, psychological, and social integration differs between the two groups when socio-demographic variables are controlled as covariates.The study was approved from the Institutional Review Board of Gyeongsang National University. Participants included two samples: 247 general populations and 224 persons with mental disorders who were receiving community mental health services in Gyeongsangnam-do of Korea. After explaining the study specifics to the participants, we got written informed consent from the participants who volunteered to participate.General population: We set the number of the general population over 20 by the age-appropriate participants in each region using area sampling and proportionate stratified sampling based on National Statistics Korea Population Statistics (2015), then recruited the participants who perform social activities without any mental health problems through a convenience sampling. The number of men and women were equally distributed. Among 247 adults, 125 (50.6%) were male and 122 (49.4%) were female. The mean age was 44.6 (SD = ±11.41); the mean educational years was 14.75 (SD = ±2.48); the average monthly income was 5,028,600 (SD = ±590.98) KRW. In terms of city size, 121 (49%) lived in large cities and 126 (51%) lived in small and medium-sized cities.Participants with mental disorders: We recruited 224 participants with mental disorders over the age of 20 years from community mental health services facilities  which cooperated with the study. The inclusion criteria for participants with mental disorders included a diagnosis of schizophrenia or a mood disorder according to DSM-5; living in the community and maintaining ongoing contact with the outpatient unit. Among them, 116 (51.8%) were male and 108 (48.2%) were female. The mean age was 45 (SD = ±12.84); the mean educational years was 12.36 (SD = ±3.17); the average monthly income was 1,679,000 (SD = ±162.5) KRW. Regarding the size of the city, 115 (51.3%) lived in large cities and 109 (48.7%) lived in small and medium-sized cities.p = 0.798), age (p = 0.574), city size (p = 0.610), community resource accessibility (p = 0.740) between the general population and persons with mental disorders. However, the average monthly income (p < 0.001) and educational years (p < 0.001) were statistically significant differences between the two groups. In the general population, average monthly income and education levels were higher than in persons with mental disorders.Chi-square tests were conducted to determine whether socio-demographic characteristics of the two groups were homogeneous. There were no statistically significant differences in gender  to closer contact (such as going out). Social contact frequency is scored from 1 (never) to 9 , with higher scores indicating higher levels of social integration. Cronbach’s α for social integration was social network size 0.631; social contact frequency 0.594.Psychological integration: In order for psychological integration, we used the Neighborhood Cohesion [Cohesion . Ten iteStatistical analyses were conducted with SPSS version 21.0 . The descriptive statistical analysis was carried out to examine the socio-demographic characteristics of two groups, and we used chi-square tests to evaluate the homogeneity of the socio-demographic variables between the two groups. Regression analysis was used to analyze the socio-demographic variables’ effects on three types of community integration in both groups. Multivariate analysis of covariance (MANCOVA) was performed to investigate the differences in community integration scores between two groups. MANCOVA was calculated with the physical, social, and psychological community integration scores as dependence variables and groups  as independent variables and gender, age, educational years, average monthly income, and city size as covariates.The effects of socio-demographic variables on three types of community integration among two groups were analyzed using regression analysis . In termp = 0.958) and psychological integration  between the two groups, based on Wilks’ criterion .We compared means for the physical, social, and psychological community integration between the general population and persons with mental disorders controlling gender, age, educational years, average monthly income, and city size. As can be seen in p < 0.001), the first type of social integration, showed significant differences between the two groups. For the general population, social network size was greater (3.80 ± 0.71) than for those with mental disorders (2.39 ± 0.98). It suggests there are more family members, relatives, friends, neighbors, or peers in the general population than do persons with mental disorders. For social network size, four of the five covariates, age , educational years , monthly income , and city size  are significantly related but gender is not. In terms of covariate power for social network size, age was followed by monthly income, educational years, and city size.Social network size , the second type of social integration, showed significant differences between the two groups. For the general population, social contact frequency was also higher (6.16 ± 1.23) than for persons with mental disorders (4.98 ± 1.64). The results suggest that the general population has more frequent contacts with family members, relatives, friends, neighbors, or peers than do persons with mental disorders. None of the five covariates are related to social contact frequency.Social contact frequency  and persons with mental disorders (r = 0.182) were significantly correlated. The two variables are important indicators of socioeconomic status. The results also indicate that, as socioeconomic status increases, social network size may increase. This is consistent with the study by Yanos et al. 4 and per,24,31. IThe second important finding of the present study is that when socio-demographic variables were controlled as covariates, the two groups differed in terms of social integration rather than physical or psychological integration. In other words, compared to the general population, persons with mental disorders have smaller social networks and fewer social contacts. This result is consistent with Aubry and Myner’s finding  that useThere are several implications for the significant difference in social integration between persons with mental disorders and the general population found in this study. First, a small social network for persons with mental disorders who experience their disorders becoming chronic with lower social functioning means that they are socially isolated and faced challenges in obtaining the social support needed to live in their communities. Such isolation poses the risk that their psychopathology will deteriorate. Second, despite people with mental health problems having a level of physical integration similar to that of the general population, a lower level of social integration means that the activities of persons with mental disorders do not contribute to building meaningful social relationships. Furthermore, even if there is a “sense of community” among those with mental disorders at a level similar to that of the general population, the presence of a low level of social integration also suggests that a sense of community still does not provide opportunities for social relationships. Third, social integration is the most important predictor of quality of life among the three areas of community integration ,35,36. LA comparison of persons with mental disorders and the general population living in the same communities has yielded significant findings. On the basis of the results, the authors propose the following. First, mental health service providers must develop programs aimed at encouraging consumers of mental health services to build relationships with other community members and provide them with opportunities to actively engage in community activities. Second, although there is a need to broaden their social networks, it is important to help them develop close relationships with frequent contacts. Such intimate relationships are the source of social support and are essential to building long-term stable relationships. Intervention is therefore needed to help them maintain relationships not only with professionals and other persons with mental disorders, but also with close friends and family members who can understand and support them in the community, i.e., taking recreational activities, self-help group programs, contacts with family, or psychotherapy groups. Thirdly, before expanding their social networks, it is also important to improve their potential for social relationships such as social skills, and the ability to use and access social media.There are, however, several limitations. First, the assessment was limited to quantitative areas of social integration  and did not include qualitative aspects. Since individuals can maintain close relationships in small networks, in which the quality rather than the quantity of relationships can have a greater significance in terms of social support, future research needs to take careful consideration qualitative aspects. Second, the size of the city was the only characteristic of the community included in this study and is insufficient to represent the cultural characteristics of the community. Future research, therefore, needs to include additional variables to assess the characteristics of the community  in order to inform community-specific practical interventions.


Heart disease is a fatal human disease, rapidly increases globally in both developed and undeveloped countries and consequently, causes death. Normally, in this disease, the heart fails to supply a sufficient amount of blood to other parts of the body in order to accomplish their normal functionalities. Early and on-time diagnosing of this problem is very essential for preventing patients from more damage and saving their lives. Among the conventional invasive-based techniques, angiography is considered to be the most well-known technique for diagnosing heart problems but it has some limitations. On the other hand, the non-invasive based methods, like intelligent learning-based computational techniques are found more upright and effectual for the heart disease diagnosis. Here, an intelligent computational predictive system is introduced for the identification and diagnosis of cardiac disease. In this study, various machine learning classification algorithms are investigated. In order to remove irrelevant and noisy data from extracted feature space, four distinct feature selection algorithms are applied and the results of each feature selection algorithm along with classifiers are analyzed. Several performance metrics namely: accuracy, sensitivity, specificity, AUC, F1-score, MCC, and ROC curve are used to observe the effectiveness and strength of the developed model. The classification rates of the developed system are examined on both full and optimal feature spaces, consequently, the performance of the developed model is boosted in case of high variated optimal feature space. In addition, P-value and Chi-square are also computed for the ET classifier along with each feature selection technique. It is anticipated that the proposed system will be useful and helpful for the physician to diagnose heart disease accurately and effectively. Heart failure occurs due to blockage and narrowing of coronary arteries. Coronary arteries are responsible for the supply of blood to the heart itself2. A recent survey reveals that the United States is the most affected country by heart disease where the ratio of heart disease patients is very high3. The most common symptoms of heart disease include physical body weakness, shortness of breath, feet swollen, and weariness with associated signs, etc.4. The risk of heart disease may be increased by the lifestyle of a person like smoking, unhealthy diet, high cholesterol level, high blood pressure, deficiency of exercise and fitness, etc.5. Heart disease has several types in which coronary artery disease (CAD) is the common one that can lead to chest pain, stroke, and heart attack. The other types of heart disease include heart rhythm problems, congestive heart failure, congenital heart disease (birth time heart disease), and cardiovascular disease (CVD). Initially, traditional investigation techniques were used for the identification of heart disease, however, they were found complex6. Owing to the non-availability of medical diagnosing tools and medical experts specifically in undeveloped countries, diagnosis and cure of heart disease are very complex7. However, the precise and appropriate diagnosis of heart disease is very imperative to prevent the patient from more damage8. Heart disease is a fatal disease that rapidly increases in both economically developed and undeveloped countries. According to a report generated by the World Health Organization (WHO), an average of 17.90 million humans died from CVD in 2016. This amount represents approximately 30% of all global deaths. According to a report, 0.2 million people die from heart disease annually in Pakistan. Every year, the number of victimizing people is rapidly increasing. European Society of Cardiology (ESC) has published a report in which 26.5 million adults were identified having heart disease and 3.8 million were identified each year. About 50–55% of heart disease patients die within the initial 1–3 years, and the cost of heart disease treatment is about 4% of the overall healthcare annual budget9.Heart disease is considered one of the most perilous and life snatching chronic diseases all over the world. In heart disease, normally the heart fails to supply sufficient blood to other parts of the body to accomplish their normal functionality10. Among the conventional methods, angiography is considered one of the most precise technique for the identification of heart problems. Conversely, angiography has some drawbacks like high cost, various side effects, and strong technological knowledge11. Conventional methods often lead to imprecise diagnosis and take more time due to human mistakes. In addition, it is a very expensive and computational intensive approach for the diagnosis of disease and takes time in assessment12.Conventional invasive-based methods used for the diagnosis of heart disease which were based on the medical history of a patient, physical test results, and investigation of related symptoms by the doctors13. As a result, the death ratio of heart disease patients has been decreased14. In literature, the Cleveland heart disease dataset is extensively utilized by the researchers16.To overcome the issues in conventional invasive-based methods for the identification of heart disease, researchers attempted to develop different non-invasive smart healthcare systems based on predictive machine learning techniques namely: Support Vector Machine (SVM), K-Nearest Neighbor (KNN), Naïve Bayes (NB), and Decision Tree (DT), etc..17 have used a logistic regression classification algorithm for heart disease detection and obtained an accuracy of 77.1%. Similarly, Wankhade et al.18 have used a multi-layer perceptron (MLP) classifier for heart disease diagnosis and attained accuracy of 80%. Likewise, Allahverdi et al.19 have developed a heart disease classification system in which they integrated neural networks with an artificial neural network and attained an accuracy of 82.4%. In a sequel, Awang et al.20 have used NB and DT for the diagnosis and prediction of heart disease and achieved reasonable results in terms of accuracy. They achieved an accuracy of 82.7% with NB and 80.4% with DT. Oyedodum and Olaniye21 have proposed a three-phase system for the prediction of heart disease using ANN. Das and Turkoglu22 have proposed an ANN ensemble-based predictive model for the prediction of heart disease. Similarly, Paul and Robin23 have used the adaptive fuzzy ensemble method for the prediction of heart disease. Likewise, Tomov et al.24 have introduced a deep neural network for heart disease prediction and his proposed model performed well and produced good outcomes. Further, Manogaran and Varatharajan25 have introduced the concept of a hybrid recommendation system for diagnosing heart disease and their model has given considerable results. Alizadehsani et al.26 have developed a non-invasive based model for the prediction of coronary artery disease and showed some good results regarding the accuracy and other performance assessment metrics. Amin et al.27 have proposed a framework of a hybrid system for the identification of cardiac disease, using machine learning, and attained an accuracy of 86.0%. Similarly, Mohan et al.28 have proposed another intelligent system that integrates RF with a linear model for the prediction of heart disease and achieved the classification accuracy of 88.7%. Likewise, Liaqat et al.29 have developed an expert system that uses stacked SVM for the prediction of heart disease and obtained 91.11% classification accuracy on selected features.In this regard, Robert et al1) and Hungarian (S2) heart disease datasets which are available online on the UCI machine learning repository. All the processing and computations were performed using Anaconda IDE. Python has been used as a tool for implementing all the classifiers. The main packages and libraries used include pandas, NumPy, matplotlib, sci-kit learn (sklearn), and seaborn. The main contribution of our proposed work is given below:The performance of all classifiers has been tested on full feature spaces in terms of all performance evaluation matrices specifically accuracy.The performances of the classifiers are tested on selected feature spaces, selected through various feature selection algorithms mentioned above.The research study recommends that which feature selection algorithm is feasible with which classification algorithm for developing a high-level intelligence system for the diagnosing of heart disease patients.The contribution of the current work is to introduce an intelligent medical decision system for the diagnosis of heart disease based on contemporary machine learning algorithms. In this study, 10 different nature of machine learning classification algorithms such as Logistic Regression (LR), Decision Tree (DT), Naïve Bayes (NB), Random Forest (RF), Artificial Neural Network (ANN), etc. are implemented in order to select the best model for timely and accurate detection of heart disease at an early stage. Four feature selection algorithms, Fast Correlation-Based Filter Solution (FCBF), minimal redundancy maximal relevance (mRMR), Least Absolute Shrinkage and Selection Operator (LASSO), and Relief have been used for selecting the vital and more correlated features that have truly reflect the motif of the desired target. Our developed system has been trained and tested on the Cleveland , Decision Tree (DT), Extra-Tree Classifier (ETC), Random Forest (RF), Logistic Regression (LR), Naïve Bayes (NB), Artificial Neural Network (ANN), Support Vector Machine (SVM), Adaboost (AB), and Gradient Boosting (GB) along with full feature space is evaluated. After that, four feature selection algorithms (FSA): Fast Correlation-Based Filter (FCBF), Minimal Redundancy Maximal Relevance (mRMR), Least Absolute Shrinkage and Selection Operator (LASSO), and Relief are applied to select the prominent and high variant features from feature space. Furthermore, the selected feature spaces are provided to classification algorithms as input to analyze the significance of feature selection techniques. The cross-validation techniques i.e. k-fold (10-fold) are applied on both the full and selected feature spaces to analyze the generalization power of the proposed model. Various performance evaluation metrics are implemented for measuring the performances of the classification models.The experimental outcomes of the applied classification algorithms on the full feature space of the two benchmark datasets by using 10-fold cross-validation (CV) techniques are shown in Tables The experimental results demonstrated that the ET classifier performed quite well in terms of all performance evaluation metrics compared to the other classifiers using 10-fold CV. ET achieved 92.09% accuracy, 91.82% sensitivity, 92.38% specificity, 97.92% AUC, 92.84% Precision, 0.92 F1-Score and 0.84 MCC. The specificity indicates that the diagnosed test was negative and the individual doesn't have the disease. While the sensitivity indicates the diagnostic test was positive and the patient has heart disease. In the case of the KNN classification model, multiple experiments were accomplished by considering various values for k i.e. k = 3, 5, 7, 9, 13, and 15, respectively. Consequently, KNN has shown the best performance at value k = 7 and achieved a classification accuracy of 85.55%, 85.93% sensitivity, 85.17% specificity, 95.64% AUC, 86.09% Precision, 0.86 F1-Score, and 0.71 MCC. Similarly, DT classifier has achieved accuracy of 86.82%, 89.73% sensitivity, 83.76% specificity, 91.89% AUC, 85.40% Precision, 0.87 F1-Score, and 0.73 MCC. Likewise, GB classifier has yielded accuracy of 91.34%, 90.32% sensitivity, 91.52% specificity, 96.87% AUC, 92.14% Precision, 0.92 F1-Score, and 0.83 MCC. After empirically evaluating the success rates of all classifiers, it is observed that ET Classifier out-performed among all the used classification algorithms in terms of accuracy, sensitivity, and specificity. Whereas, NB shows the lowest performance in terms of accuracy, sensitivity, and specificity. The ROC curve of all classification algorithms on full feature space is represented in Fig. 2, composed of 1025 total instances in which 525 belong to the positive class and 500 instances of having negative class, again ET has obtained quite well results compared to other classifiers using a 10-fold cross-validation test, which are 96.74% accuracy, 96.36 sensitivity, 97.40% specificity, and 0.93 MCC as shown in Table In the case of dataset SFCBF feature selection technique is applied to select the best subset of feature space. In this attempt, various length of subspaces is generated and tested. Finally, the best results are achieved by classification algorithms on the subset of feature space (n = 6) using a 10-fold CV. Table Table mRMR feature selection technique is used in order to select a subset of features that enhance the performance of classifiers. The best results reported on a subset of n = 6 of feature space which is shown in Table In the case of mRMR, still, the success rates of the ET classifier are well in terms of all performance evaluation metrics compared to the other classifiers. ET has attained 93.42% accuracy, 93.92% sensitivity, and specificity of 93.88%. In contrast, NB has achieved the lowest outcomes which are 81.84% accuracy. Figure In order to choose the optimal feature space which not only reduces computational cost but also progresses the performance of the classifiers, LASSO feature selection technique is applied. After performing various experiments on different subsets of feature space, the best results are still noted on the subspace of (n = 6). The predicted outcomes of the best-selected feature space are reported in Table Table In a sequel, another feature selection technique Relief is applied to investigate the performance of classifiers on different sub-feature spaces by using the wrapper method. After empirically analyzing the results of the classifiers on a different subset of feature spaces, it is observed that the performance of classifiers is outstanding on the sub-space of length n = 6). The results of the optimal feature space on the 10-fold CV technique are listed in Table . The resAgain, the ET classifier performed outstandingly in terms of all performance evaluation metrics as compared to other classifiers. ET has obtained an accuracy of 94.41%, 94.93% sensitivity, and specificity of 94.89%. In contrast, NB has shown the lowest performance and achieved 80.29% accuracy, 81.93% sensitivity, and specificity of 78.55%. The ROC curves of the classifiers are demonstrated in Fig. 30. Doing so will assist the readers to have a better understanding of the impact, of the number of selected features on the performance of the classifiers. The same process is repeated for another dataset i.e. S2 (Hungarian heart disease dataset) as well, to know the impact of selected features on the classification performance.After executing classification algorithms along with full and selected feature spaces in order to select the optimal algorithm for the operational engine, the empirical results have revealed that ET performed well not only on all feature space but also on optimal selected feature space among all the used classification algorithms. Furthermore, the ET classifier obtained quite promising accuracy in the case of the Relief feature selection technique which is 94.41%. Overall, the performance of ET is reported better in terms of most of the measures while other classifiers have shown good results in one measure while worse in other measures. In addition, the performance of the ET classifier is also evaluated on a 10-fold CV in combination with different sub-feature spaces of varying length starting from 1 to 12 with a step size of 1 to check the stability and discrimination power of the classifier as described in2 (Hungarian heart disease dataset). The results are shown in Tables In Table Further, a comparative study of the developed system is conducted with other states of the art machine learning approaches discussed in the literature. Table The subsections represent the materials and the methods that are used in this paper.1 and Hungarian heart disease dataset (S2) are used, which are available online at the University of California Irvine (UCI) machine learning repository and UCI Kaggle repository, and various researchers have used it for conducting their research studies32. The S1 consists of 304 instances, where each instance has distinct 13 attributes along with the target labels and are selected for training. The dataset is composed of two classes, presence or absence of heart disease. The S2 is composed of 1025 instances in which 525 instances belong to positive class while the rest of 500 instances have negative class. The description of attributes of both the datasets is the same, and both have similar attributes. The complete description and information of the datasets with 13 attributes are given in Table The first and rudimentary step of developing an intelligent computational model is to construct or develop a problem-related dataset that truly and effectively reflects the pattern of the target class. Well organized and problem-related dataset has a high influence on the performance of the computational model. Looking at the significance of the dataset, two datasets i.e. the Cleveland heart disease dataset SThe main theme of the developed system is to identify heart problems in human beings. In this study, four distant feature selection techniques namely: FCBF, mRMR, Relief, and LASSO are applied on the provided dataset in order to remove noisy, redundant features and select variant features, consequently may cause of enhancing the performance of the proposed model. Various machine learning classification algorithms are used in this study which include, KNN, DT, ETC, RF, LR, NB, ANN, SVM, AB, and GB. Different evaluation metrics are computed to assess the performance of classification algorithms. The methodology of the proposed system is carried out in five stages which include dataset preprocessing, selection of features, cross-validation technique, classification algorithms, and performance evaluation of classifiers. The framework of the proposed system is illustrated in Fig. Data preprocessing is the process of transforming raw data into meaningful patterns. It is very crucial for a good representation of data. Various preprocessing approaches such as missing values removal, standard scalar, and Min–Max scalar are used on the dataset in order to make it more effective for classification.Fast correlation-based filter (FCBF): FCBF feature selection algorithm follows a sequential search strategy. It first selects full features and then uses symmetric uncertainty for measuring the dependencies of the features on each other and how they affect the target output label. After this, it selects the most important features using the backward sequential search strategy. FCBF outperforms on high dimensional datasets. Table Minimal redundancy maximal relevance (mRMR): mRMR uses the heuristic approach for selecting the most vital features that have minimum redundancy and maximum relevance. It selects those features which are useful and relevant to the target. As it follows a heuristic approach so, it checks one feature at a time and then computes its pairwise redundancy with the other features. The mRMR feature selection algorithm is not suitable for high domain feature problems33. The results of selected features by the mRMR feature selection algorithm (n = 6) are listed in Table Least absolute shrinkage and selection operator (LASSO) LASSO selects features based on updating the absolute value of the features coefficient. In updating the features coefficient values, zero becoming values are removed from the features subset. LASSO outperforms with low feature coefficient values. The features having high coefficient values will be selected in the subset of features and the rest will be eliminated. Moreover, some irrelevant features with higher coefficient values may be selected and are included in the subset of features30. Table Relief feature selection algorithm Relief utilizes the concept of instance-based learning which allocates weight to each attribute based on its significance. The weight of each attribute demonstrates its capability to differentiate among class values. Attributes are rated by weights, and those attributes whose weight is exceeding a user-specified cutoff, are chosen as the final subset34 . The relief feature selection algorithm selects the most significant attributes which have more effect on the target35 . The algorithm operates by selecting instances randomly from the training samples. The nearest instance of the same class (nearest hit) and opposite class (nearest miss) is identified for each sampled instance. The weight of an attribute is updated according to how well its values differentiate between the sampled instance and its nearest miss and hit. If an attribute discriminates amongst instances from different classes and has the same value for instances of the same class, it will get a high weight.Feature selection technique selects the optimal features sub-space among all the features in a dataset. It is very crucial because sometimes, the classification performance degrades due to irrelevant features in the dataset. The feature selection technique improves the performance of classification algorithms and also reduces their execution time. In this research study, four feature selection techniques are used and are listed below:i and NH have dissimilar value , that means the attribute splits two instances with the same class which is not worthwhile, and thus we reduce the attributes weight. On the other hand, if the instance Ri and NM have a distinct value that means the attribute separates the two instances with a different class, which is desirable. The six most important features selected by the Relief algorithm are listed in descending order in Table The weight updating of attributes works on a simple idea (line 6). That if instance RVarious machine learning classification algorithms are investigated for early detection of heart disease, in this study. Each classification algorithm has its significance and the importance is reported varied from application to application. In this paper, 10 distant nature of classification algorithms namely: KNN, DT, ET, GB, RF, SVM, AB, NB, LR, and ANN are applied to select the best and generalize prediction model.Validation of the prediction model is an essential step in machine learning processes. In this paper, the K-Fold cross-validation method is applied to validating the results of the above-mentioned classification models.In K-Fold CV, the whole dataset is split into k equal parts. The (k-1) parts are utilized for training and the rest is used for the testing at each iteration. This process continues for k-iteration. Various researchers have used different values of k for CV. Here k = 10 is used for experimental work because it produces good results. In tenfold CV, 90% of data is utilized for training the model and the remaining 10% of data is used for the testing of the model at each iteration. At last, the mean of the results of each step is taken which is the final result.For measuring the performance of the classification algorithms used in this paper, various evaluation matrices have been implemented including accuracy, sensitivity, specificity, f1-score, recall, Mathew Correlation-coefficient (MCC), AUC-score, and ROC curve. All these measures are calculated from the confusion matrix described in Table In confusion matrix True Negative (TN) shows that the patient has not heart disease and the model also predicts the same i.e. a healthy person is correctly classified by the model.True Positive (TP) represents that the patient has heart disease and the model also predicts the same result i.e. a person having heart disease is correctly classified by the model.False Positive (FP) demonstrates that the patient has not heart disease but the model predicted that the patient has i.e. a healthy person is incorrectly classified by the model. This is also called a type-1 error.False Negative (FN) notifies that the patient has heart disease but the model predicted that the patient has not i.e. a person having heart disease is incorrectly classified by the model. This is also called a type-2 error.Accuracy Accuracy of the classification model shows the overall performance of the model and can be calculated by the formula given below:Specificity specificity is a ratio of the recently classified healthy people to the total number of healthy people. It means the prediction is negative and the person is healthy. The formula for calculating specificity is given as follows:Sensitivity Sensitivity is the ratio of recently classified heart patients to the total patients having heart disease. It means the model prediction is positive and the person has heart disease. The formula for calculating sensitivity is given below:Precision: Precision is the ratio of the actual positive score and the positive score predicted by the classification model/algorithm. Precision can be calculated by the following formula:F1-score F1 is the weighted measure of both recall precision and sensitivity. Its value ranges between 0 and 1. If its value is one then it means the good performance of the classification algorithm and if its value is 0 then it means the bad performance of the classification algorithm.MCC It is a correlation coefficient between the actual and predicted results. MCC gives resulting values between − 1 and + 1. Where − 1 represents the completely wrong prediction of the classifier.0 means that the classifier generates random prediction and + 1 represents the ideal prediction of the classification models. The formula for calculating MCC values is given below:Finally, we will examine the predictability of the machine learning classification algorithms with the help of the receiver optimistic curve (ROC) which represents a graphical demonstration of the performance of ML classifiers. The area under the curve (AUC) describes the ROC of a classifier and the performance of the classification algorithms is directly linked with AUC i.e. larger the value of AUC greater will be the performance of the classification algorithm.In this study, 10 different machine learning classification algorithms namely: LR, DT, NB, RF, ANN, KNN, GB, SVM, AB, and ET are implemented in order to select the best model for early and accurate detection of heart disease. Four feature selection algorithms such as FCBF, mRMR, LASSO, and Relief have been used to select the most vital and correlated features that truly reflect the motif of the desired target. Our developed intelligent computational model has been trained and tested on two datasets i.e. Cleveland (S1) and Hungarian (S2) heart disease datasets. Python has been used as a tool for implementation and simulating the results of all the utilized classification algorithms.The performance of all classification models has been tested in terms of various performance metrics on full feature space as well as selected feature spaces, selected through various feature selection algorithms. This research study recommends that which feature selection algorithm is feasible with which classification model for developing a high-level intelligent system for the diagnosis of a patient having heart disease. From simulation results, it is observed that ET is the best classifier while relief is the optimal feature selection algorithm. In addition, P-value and Chi-square are also computed for the ET classifier along with each feature selection algorithm. It is anticipated that the proposed system will be useful and helpful for the doctors and other care-givers to diagnose a patient having heart disease accurately and effectively at the early stages.Heart disease is one of the most devastating and fatal chronic diseases that rapidly increase in both economically developed and undeveloped countries and causes death. This damage can be reduced considerably if the patient is diagnosed in the early stages and proper treatment is provided to her. In this paper, we developed an intelligent predictive system based on contemporary machine learning algorithms for the prediction and diagnosis of heart disease. The developed system was checked on two datasets i.e. Cleveland (S1) and Hungarian (S2) heart disease datasets. The developed system was trained and tested on full features and optimal features as well. Ten classification algorithms including, KNN, DT, RF, NB, SVM, AB, ET, GB, LR, and ANN, and four feature selection algorithms such as FCBF, mRMR, LASSO, and Relief are used. The feature selection algorithm selects the most significant features from the feature space, which not only reduces the classification errors but also shrink the feature space. To assess the performance of classification algorithms various performance evaluation metrics were used such as accuracy, sensitivity, specificity, AUC, F1-score, MCC, and ROC curve. The classification accuracies of the top two classification algorithms i.e. ET and GB on full features were 92.09% and 91.34% respectively. After applying feature selection algorithms, the classification accuracy of ET with the relief feature selection algorithm increases from 92.09 to 94.41%. The accuracy of GB increases from 91.34 to 93.36% with the FCBF feature selection algorithm. So, the ET classifier with the relief feature selection algorithm performs excellently. P-value and Chi-square are also computed for the ET classifier with each feature selection technique. The future work of this research study is to use more optimization techniques, feature selection algorithms, and classification algorithms to improve the performance of the predictive system for the diagnosis of heart disease.Supplementary Information.