Python SciPy fcluster: Hierarchical Cluster

fcluster

Recently, I was working on a data science project where I needed to group similar data points. The challenge was finding an efficient way to perform hierarchical clustering and extract meaningful clusters from my dataset. That’s when I discovered SciPy’s fcluster function, a powerful tool that made this complex task surprisingly easy. In this article, … Read more >>

Python SciPy Exponential

exponential regression python

Recently, I was working on a data analysis project where I needed to model the time between customer arrivals at a store. The exponential distribution was perfect for this scenario, as it’s commonly used to model the time between independent events. SciPy, one of Python’s most powerful scientific libraries, offers excellent tools for working with … Read more >>

Python SciPy Eigenvalues

eigenvalue python

Recently, I was working on a data science project that required analyzing the principal components of a large dataset. The key to this analysis was computing eigenvalues efficiently. While NumPy offers eigenvalue computation, SciPy provides more specialized and often faster methods that can handle various matrix types. In this article, I’ll walk you through multiple … Read more >>

Python SciPy Derivative of Array: Calculate with Precision

scipy derivative

Recently, I was working on a data analysis project that required calculating the rate of change in temperature measurements across different U.S. cities. The challenge was finding an efficient way to compute derivatives for large arrays of time-series data. SciPy came to the rescue with its powerful numerical differentiation capabilities. If you’re dealing with scientific … Read more >>

Python Scipy Convolve 2d: Image Processing

convolve2d

Recently, I was working on an image processing project where I needed to apply various filters to detect edges and blur certain areas. The scipy.signal.convolve2d function became my go-to tool for these operations. In this article, I’ll share how to effectively use this powerful function for image processing in Python. Whether you’re working on computer … Read more >>

Python SciPy Chi-Square Test

chi square test python

Recently, I worked on a data analysis project where I needed to determine if there was a significant relationship between two categorical variables in my dataset. The chi-squared test was the ideal statistical method for this situation. Since Python’s SciPy library provides a straightforward implementation of this test, I decided to explore it in depth. … Read more >>

Python SciPy Butterworth Filter

butterworth filter python

Recently, I was working on a signal processing project where I needed to remove noise from sensor data collected from a traffic monitoring system in downtown Chicago. The challenge was filtering out random fluctuations while preserving the important traffic pattern information. This is where the Butterworth filter in SciPy came to my rescue. In this … Read more >>

Scipy’s Lil_Matrix

lil_matrix

Recently, I was working on a machine learning project that involved a large dataset with mostly zero values. When I tried to process this data using regular NumPy arrays, my computer almost crashed due to memory limitations. That’s when I discovered the power of sparse matrices in SciPy, particularly the LIL (List of Lists) matrix … Read more >>

@typescript-eslint/no-unused-vars: Underscore, Disable and Options

typescript-eslint no-unused-vars: the terminal showing that an underscore-prefixed parameter is still reported as an error

@typescript-eslint/no-unused-vars reports variables, parameters, imports and types that you declared and never used. The usual advice is to rename the thing with a leading underscore, and on a default setup that does not work: The underscore convention has to be switched on. This guide shows the configuration that enables it, along with the inline comments … Read more >>

SciPy curve_fit in Python: maxfev, bounds and p0

SciPy curve_fit: the Command Prompt showing the RuntimeError that the number of calls to function has reached maxfev

SciPy curve fit takes a model function and some data, then finds the parameter values that make the model match. It lives in SciPy‘s optimize module: popt comes back with the fitted parameters and pcov with their covariance. The one thing that goes wrong more than anything else is RuntimeError: Optimal parameters not found, which … Read more >>