Statistical learning methods | Chapter 1 Introduction to statistical learning methods | Scipy in Leastsq ()

 

Scipy is a popular software package for mathematics, science, engineering, and can handle interpolation, integration, optimization, image processing, solving problems such as signal processing numerical solution of ordinary differential equations. It is used to calculate the effective Numpy matrix, and so Numpy Scipy work efficiently solve the problem.

Scipy is composed of sub-modules for specific tasks consists of:

Module name Applications
scipy.cluster Vector calculation / Kmeans
scipy.constants Physical and mathematical constants
scipy.fftpack Fourier transform
scipy.integrate Integration program
scipy.interpolate Interpolation
scipy.io Data input and output
scipy.linalg Linear Algebra program
Sci py.ndimage n-dimensional video packet
scipy.odr Orthogonal distance regression
scipy.optimize optimization
scipy.signal Signal Processing
scipy.sparse sparse matrix
scipy.spatial Spatial Data Structures and Algorithms
scipy.special Some special mathematical functions
scipy.stats statistics

More may refer to: https://www.jianshu.com/p/6c742912047f

In Scipy, Optimize module provides many numerical optimization algorithm, wherein the least squares method can be said to be the most classical numerical optimization techniques, and the curve to find the best match data by minimizing the square error. In optimize module, used leastsq () function can be quickly fit the data using the least squares method.

First look leastsq () function call format:

leastsq(func, 
        x0,
        args=(),
        Dfun=None,
        full_output=0,
        col_deriv=0,
        ftol=1.49012e-08,
        xtol=1.49012e-08,
        gtol=0.0,
        maxfev=0,
        epsfcn=0.0,
        factor=100,
        diag=None,
        warning=True)

Generally speaking, we only need the first three parameters are enough of their role are:

  • func: error function
  • x0: parameter function
  • args () represents a data point

Guess you like

Origin www.cnblogs.com/shona/p/11315183.html