SlideShare une entreprise Scribd logo
1  sur  25
Télécharger pour lire hors ligne
Curve-fitting (regression) with Python



            September 18, 2009
Enthought Consulting
Enthought Training Courses




                Python Basics, NumPy, SciPy,
                Matplotlib, Traits, TraitsUI,
                Chaco…
Enthought Python Distribution (EPD)
     http://www.enthought.com/products/epd.php
Data                      Model


       y   =   mx + b
       m   =   4.316
       b   =   2.763




                a
       y =
           (b + ce−dx )
       a = 7.06
       b = 2.52
       c = 26.14
       d = −5.57
Curve Fitting or Regression?




Adrien-Marie
                         Francis Galton
Legendre




                          R.A. Fisher
Carl Gauss
or (my preferred) ... Bayesian Inference
                                                       Model   Prior
                                     Inference         p(Y|X)p(X)
                                     p(X|Y)        =
                                                           p(Y)




                                       Un

                                             Da
                                                          p(Y|X)p(X)




                                        kn

                                              ta
                                                   =




                                         ow
                                                         p(Y|X)p(X)dX




                                            ns
     Bayes             Laplace




  Harold Jeffreys   Richard T. Cox                 Edwin T. Jaynes
More pedagogy
                                           Machine Learning


       Curve Fitting             Regression
   Parameter Estimation      Bayesian Inference
   Understated statistical Statistical model is
   model                   more important
   Just want “best” fit to   Post estimation
   data                      analysis of error and fit
Pragmatic look at the methods

 • Because the concept is really at the heart of
   science, many practical methods have been
   developed.
 • SciPy contains the building blocks to
   implement basically any method.
 • SciPy should get high-level interfaces to all
   the methods in common use.
Methods vary in...

  • The model used:
   – parametric (specific model): y = f (x; θ)
   – non-parametric (many unknowns) y =              θi φi (x)
                                                 i
  • The way error is modeled y = y +
                             ˆ
   – few assumptions (e.g. zero-mean, homoscedastic)
   – full probabilistic model
  • What “best fit” means (i.e. what is distance
    between the predicted and the measured).
   – traditional least-squares
   – robust methods (e.g. absolute difference)
Parametric Least Squares

                                 T
   y
   ˆ   =   [y0 , y1 , ..., yN −1 ]
                                     T
   x =     [x0 , x1 , ..., xN −1 ]
                                     T
                                         y = f (x; β) +
                                         ˆ
  β    =   [β0 , β1 , ..., βK−1 ]
  K    < N

       ˆ
       β    =     argmin J(ˆ, x, β)
                           y
                      β
       ˆ
       β    =     argmin (ˆ − f (x; β))T W(ˆ − f (x; β))
                          y                y
                      β
Linear Least Squares
   y = H(x)β +
   ˆ
                                 −1
  ˆ = H(x)T WH(x)
  β                                   H(x) Wˆ
                                            y
                                                T



  Quadratic Example:
                              yi =     2
                                     axi   + bxi + c
                                               
                        x20          x0     1              
                       x2           x1     1    a
                         1                     
             y=
             ˆ           .
                         .            .
                                      .     .
                                            .    b +
                        .            .     .    c
                       x2 −1
                        N        xN −1      1
                                H(x)                    β
Non-linear least squares
     ˆ
     β    =     argmin J(ˆ, x, β)
                         y
                    β
     ˆ
     β    =     argmin (ˆ − f (x; β)) W(ˆ − f (x; β))
                        y               y T
                    β


     Logistic Example

                                  a
                        yi =
                             b + ce−dxi

                 Optimization Problem!!
Tools in NumPy / SciPy

 • polyfit (linear least squares)
 • curve_fit (non-linear least-squares)
 • poly1d (polynomial object)
 • numpy.random (random number generators)
 • scipy.stats (distribution objects
 • scipy.optimize (unconstrained and
   constrained optimization)
Polynomials

• p = poly1d(<coefficient array>)             >>> p = poly1d([1,-2,4])
                                              >>> print p
                                               2
• p.roots (p.r) are the roots                 x - 2 x + 4

• p.coefficients (p.c) are the coefficients   >>> g = p**3 + p*(3-2*p)
                                              >>> print g

• p.order is the order                         6     5      4      3      2
                                              x - 6 x + 25 x - 51 x + 81 x - 58 x + 44
• p[n] is the coefficient of xn               >>> print g.deriv(m=2)
                                                  4       3       2
• p(val) evaulates the polynomial at val      30 x - 120 x + 300 x - 306 x + 162

                                              >>> print p.integ(m=2,k=[2,1])
• p.integ() integrates the polynomial                  4          3     2
                                              0.08333 x - 0.3333 x + 2 x + 2 x + 1
• p.deriv() differentiates the polynomial
                                              >>> print p.roots
• Basic numeric operations (+,-,/,*) work     [ 1.+1.7321j 1.-1.7321j]

                                              >>> print p.coeffs
• Acts like p.c when used as an array         [ 1 -2 4]

• Fancy printing



                                                                                   15
Statistics
scipy.stats — CONTINUOUS DISTRIBUTIONS

 over 80
 continuous
 distributions!

METHODS
pdf     entropy
cdf     nnlf
rvs     moment
ppf     freeze
stats
fit
sf
isf
                                         16
Using stats objects
DISTRIBUTIONS


>>> from scipy.stats import norm
# Sample normal dist. 100 times.
>>> samp = norm.rvs(size=100)

>>> x = linspace(-5, 5, 100)
# Calculate probability dist.
>>> pdf = norm.pdf(x)
# Calculate cummulative Dist.
>>> cdf = norm.cdf(x)
# Calculate Percent Point Function
>>> ppf = norm.ppf(x)




                                     17
Setting location and Scale
NORMAL DISTRIBUTION


>>> from scipy.stats import norm
# Normal dist with mean=10 and std=2
>>> dist = norm(loc=10, scale=2)

>>> x = linspace(-5, 15, 100)
# Calculate probability dist.
>>> pdf = dist.pdf(x)
# Calculate cummulative dist.
>>> cdf = dist.cdf(x)

# Get 100 random samples from dist.
>>> samp = dist.rvs(size=100)

# Estimate parameters from data
>>> mu, sigma = norm.fit(samp)           .fit returns best
>>> print “%4.2f, %4.2f” % (mu, sigma)   shape + (loc, scale)
10.07, 1.95                              that explains the data
                                                            18
Fitting Polynomials (NumPy)
POLYFIT(X, Y, DEGREE)
>>> from numpy import polyfit, poly1d
>>> from scipy.stats import norm
# Create clean data.
>>> x = linspace(0, 4.0, 100)
>>> y = 1.5 * exp(-0.2 * x) + 0.3
# Add a bit of noise.
>>> noise = 0.1 * norm.rvs(size=100)
>>> noisy_y = y + noise

# Fit noisy data with a linear model.
>>> linear_coef = polyfit(x, noisy_y, 1)
>>> linear_poly = poly1d(linear_coef)
>>> linear_y = linear_poly(x),

# Fit noisy data with a quadratic model.
>>> quad_coef = polyfit(x, noisy_y, 2)
>>> quad_poly = poly1d(quad_coef)
>>> quad_y = quad_poly(x))
                                           19
Optimization
scipy.optimize — Unconstrained Minimization and Root Finding

Unconstrained Optimization               Constrained Optimization
• fmin (Nelder-Mead simplex)             • fmin_l_bfgs_b
• fmin_powell (Powell’s method)          • fmin_tnc (truncated Newton code)
• fmin_bfgs (BFGS quasi-Newton           • fmin_cobyla (constrained optimization by
  method)                                  linear approximation)
• fmin_ncg (Newton conjugate
  gradient)                              • fminbound (interval constrained 1D
                                           minimizer)
• leastsq (Levenberg-Marquardt)
• anneal (simulated annealing global     Root Finding
  minimizer)                             •   fsolve (using MINPACK)
• brute (brute force global minimizer)   •   brentq
• brent (excellent 1-D minimizer)        •   brenth
• golden                                 •   ridder
• bracket
                                         •   newton
                                         •   bisect
                                         •   fixed_point (fixed point equation solver)

                                                                                 20
Optimization: Data Fitting
NONLINEAR LEAST SQUARES CURVE FITTING
>>> from scipy.optimize import curve_fit
# Define the function to fit.
>>> def function(x, a , b, f, phi):
...     result = a * exp(-b * sin(f * x + phi))
...     return result

# Create a noisy data set.
>>> actual_params = [3, 2, 1, pi/4]
>>> x = linspace(0,2*pi,25)
>>> exact = function(x, *actual_params)
>>> noisy = exact + 0.3 * randn(len(x))

# Use curve_fit to estimate the function parameters from the noisy data.
>>> initial_guess = [1,1,1,1]
>>> estimated_params, err_est = curve_fit(function, x, noisy, p0=initial_guess) >>>
estimated_params
array([3.1705, 1.9501, 1.0206, 0.7034])

# err_est is an estimate of the covariance matrix of the estimates
# (i.e. how good of a fit is it)




                                                                              21
StatsModels
Josef Perktold
  Canada




Economists


Skipper Seabold
  PhD Student
  American University
  Washington, D.C.
GUI example: astropysics (with TraitsUI)
    Erik J. Tollerud
       PhD Student
       UC Irvine
       Center for Cosmology
       Irvine, CA

http://www.physics.uci.edu/~etolleru/
Scientific Python Classes
       http://www.enthought.com/training

        Sept 21-25      Austin
        Oct 19-22       Silicon Valley
        Nov 9-12        Chicago
        Dec 7-11        Austin

Contenu connexe

Tendances

Common derivatives integrals_reduced
Common derivatives integrals_reducedCommon derivatives integrals_reduced
Common derivatives integrals_reducedKyro Fitkry
 
Montpellier Math Colloquium
Montpellier Math ColloquiumMontpellier Math Colloquium
Montpellier Math ColloquiumChristian Robert
 
Low Complexity Regularization of Inverse Problems - Course #1 Inverse Problems
Low Complexity Regularization of Inverse Problems - Course #1 Inverse ProblemsLow Complexity Regularization of Inverse Problems - Course #1 Inverse Problems
Low Complexity Regularization of Inverse Problems - Course #1 Inverse ProblemsGabriel Peyré
 
Calculus cheat sheet_integrals
Calculus cheat sheet_integralsCalculus cheat sheet_integrals
Calculus cheat sheet_integralsUrbanX4
 
Signal Processing Course : Inverse Problems Regularization
Signal Processing Course : Inverse Problems RegularizationSignal Processing Course : Inverse Problems Regularization
Signal Processing Course : Inverse Problems RegularizationGabriel Peyré
 
Runtime Analysis of Population-based Evolutionary Algorithms
Runtime Analysis of Population-based Evolutionary AlgorithmsRuntime Analysis of Population-based Evolutionary Algorithms
Runtime Analysis of Population-based Evolutionary AlgorithmsPK Lehre
 
Markov Tutorial CDC Shanghai 2009
Markov Tutorial CDC Shanghai 2009Markov Tutorial CDC Shanghai 2009
Markov Tutorial CDC Shanghai 2009Sean Meyn
 
Lesson 13: Derivatives of Logarithmic and Exponential Functions
Lesson 13: Derivatives of Logarithmic and Exponential FunctionsLesson 13: Derivatives of Logarithmic and Exponential Functions
Lesson 13: Derivatives of Logarithmic and Exponential FunctionsMatthew Leingang
 
Quantum modes - Ion Cotaescu
Quantum modes - Ion CotaescuQuantum modes - Ion Cotaescu
Quantum modes - Ion CotaescuSEENET-MTP
 
Image Processing 3
Image Processing 3Image Processing 3
Image Processing 3jainatin
 
Lesson 16: Derivatives of Logarithmic and Exponential Functions
Lesson 16: Derivatives of Logarithmic and Exponential FunctionsLesson 16: Derivatives of Logarithmic and Exponential Functions
Lesson 16: Derivatives of Logarithmic and Exponential FunctionsMatthew Leingang
 
Lesson 14: Derivatives of Logarithmic and Exponential Functions (slides)
Lesson 14: Derivatives of Logarithmic and Exponential Functions (slides)Lesson 14: Derivatives of Logarithmic and Exponential Functions (slides)
Lesson 14: Derivatives of Logarithmic and Exponential Functions (slides)Matthew Leingang
 
Stuff You Must Know Cold for the AP Calculus BC Exam!
Stuff You Must Know Cold for the AP Calculus BC Exam!Stuff You Must Know Cold for the AP Calculus BC Exam!
Stuff You Must Know Cold for the AP Calculus BC Exam!A Jorge Garcia
 
Low Complexity Regularization of Inverse Problems - Course #2 Recovery Guaran...
Low Complexity Regularization of Inverse Problems - Course #2 Recovery Guaran...Low Complexity Regularization of Inverse Problems - Course #2 Recovery Guaran...
Low Complexity Regularization of Inverse Problems - Course #2 Recovery Guaran...Gabriel Peyré
 
Formulario de calculo
Formulario de calculoFormulario de calculo
Formulario de calculoHenry Romero
 
Considerate Approaches to ABC Model Selection
Considerate Approaches to ABC Model SelectionConsiderate Approaches to ABC Model Selection
Considerate Approaches to ABC Model SelectionMichael Stumpf
 
ABC-Xian
ABC-XianABC-Xian
ABC-XianDeb Roy
 

Tendances (20)

Common derivatives integrals_reduced
Common derivatives integrals_reducedCommon derivatives integrals_reduced
Common derivatives integrals_reduced
 
MUMS: Bayesian, Fiducial, and Frequentist Conference - Statistical Sparsity, ...
MUMS: Bayesian, Fiducial, and Frequentist Conference - Statistical Sparsity, ...MUMS: Bayesian, Fiducial, and Frequentist Conference - Statistical Sparsity, ...
MUMS: Bayesian, Fiducial, and Frequentist Conference - Statistical Sparsity, ...
 
Montpellier Math Colloquium
Montpellier Math ColloquiumMontpellier Math Colloquium
Montpellier Math Colloquium
 
Low Complexity Regularization of Inverse Problems - Course #1 Inverse Problems
Low Complexity Regularization of Inverse Problems - Course #1 Inverse ProblemsLow Complexity Regularization of Inverse Problems - Course #1 Inverse Problems
Low Complexity Regularization of Inverse Problems - Course #1 Inverse Problems
 
Calculus cheat sheet_integrals
Calculus cheat sheet_integralsCalculus cheat sheet_integrals
Calculus cheat sheet_integrals
 
Signal Processing Course : Inverse Problems Regularization
Signal Processing Course : Inverse Problems RegularizationSignal Processing Course : Inverse Problems Regularization
Signal Processing Course : Inverse Problems Regularization
 
Runtime Analysis of Population-based Evolutionary Algorithms
Runtime Analysis of Population-based Evolutionary AlgorithmsRuntime Analysis of Population-based Evolutionary Algorithms
Runtime Analysis of Population-based Evolutionary Algorithms
 
Markov Tutorial CDC Shanghai 2009
Markov Tutorial CDC Shanghai 2009Markov Tutorial CDC Shanghai 2009
Markov Tutorial CDC Shanghai 2009
 
Lesson 13: Derivatives of Logarithmic and Exponential Functions
Lesson 13: Derivatives of Logarithmic and Exponential FunctionsLesson 13: Derivatives of Logarithmic and Exponential Functions
Lesson 13: Derivatives of Logarithmic and Exponential Functions
 
Quantum modes - Ion Cotaescu
Quantum modes - Ion CotaescuQuantum modes - Ion Cotaescu
Quantum modes - Ion Cotaescu
 
Image denoising
Image denoisingImage denoising
Image denoising
 
Image Processing 3
Image Processing 3Image Processing 3
Image Processing 3
 
Lesson 16: Derivatives of Logarithmic and Exponential Functions
Lesson 16: Derivatives of Logarithmic and Exponential FunctionsLesson 16: Derivatives of Logarithmic and Exponential Functions
Lesson 16: Derivatives of Logarithmic and Exponential Functions
 
Lesson 14: Derivatives of Logarithmic and Exponential Functions (slides)
Lesson 14: Derivatives of Logarithmic and Exponential Functions (slides)Lesson 14: Derivatives of Logarithmic and Exponential Functions (slides)
Lesson 14: Derivatives of Logarithmic and Exponential Functions (slides)
 
Stuff You Must Know Cold for the AP Calculus BC Exam!
Stuff You Must Know Cold for the AP Calculus BC Exam!Stuff You Must Know Cold for the AP Calculus BC Exam!
Stuff You Must Know Cold for the AP Calculus BC Exam!
 
確率伝播
確率伝播確率伝播
確率伝播
 
Low Complexity Regularization of Inverse Problems - Course #2 Recovery Guaran...
Low Complexity Regularization of Inverse Problems - Course #2 Recovery Guaran...Low Complexity Regularization of Inverse Problems - Course #2 Recovery Guaran...
Low Complexity Regularization of Inverse Problems - Course #2 Recovery Guaran...
 
Formulario de calculo
Formulario de calculoFormulario de calculo
Formulario de calculo
 
Considerate Approaches to ABC Model Selection
Considerate Approaches to ABC Model SelectionConsiderate Approaches to ABC Model Selection
Considerate Approaches to ABC Model Selection
 
ABC-Xian
ABC-XianABC-Xian
ABC-Xian
 

En vedette

The Joy of SciPy
The Joy of SciPyThe Joy of SciPy
The Joy of SciPykammeyer
 
Raspberry Pi and Scientific Computing [SciPy 2012]
Raspberry Pi and Scientific Computing [SciPy 2012]Raspberry Pi and Scientific Computing [SciPy 2012]
Raspberry Pi and Scientific Computing [SciPy 2012]Samarth Shah
 
Доклад АКТО-2012 Душкин, Смирнова
Доклад АКТО-2012 Душкин, СмирноваДоклад АКТО-2012 Душкин, Смирнова
Доклад АКТО-2012 Душкин, СмирноваDmitry Dushkin
 
Statistical inference for (Python) Data Analysis. An introduction.
Statistical inference for (Python) Data Analysis. An introduction.Statistical inference for (Python) Data Analysis. An introduction.
Statistical inference for (Python) Data Analysis. An introduction.Piotr Milanowski
 
Introduction to NumPy & SciPy
Introduction to NumPy & SciPyIntroduction to NumPy & SciPy
Introduction to NumPy & SciPyShiqiao Du
 
Scientific computing
Scientific computingScientific computing
Scientific computingBrijesh Kumar
 
Making your code faster cython and parallel processing in the jupyter notebook
Making your code faster   cython and parallel processing in the jupyter notebookMaking your code faster   cython and parallel processing in the jupyter notebook
Making your code faster cython and parallel processing in the jupyter notebookPyData
 
Effective Numerical Computation in NumPy and SciPy
Effective Numerical Computation in NumPy and SciPyEffective Numerical Computation in NumPy and SciPy
Effective Numerical Computation in NumPy and SciPyKimikazu Kato
 
Taller Multimedia en el Aula Virtual
Taller Multimedia en el Aula VirtualTaller Multimedia en el Aula Virtual
Taller Multimedia en el Aula VirtualAxel Mérida
 
Data Analytics with Pandas and Numpy - Python
Data Analytics with Pandas and Numpy - PythonData Analytics with Pandas and Numpy - Python
Data Analytics with Pandas and Numpy - PythonChetan Khatri
 
Introduction to NumPy (PyData SV 2013)
Introduction to NumPy (PyData SV 2013)Introduction to NumPy (PyData SV 2013)
Introduction to NumPy (PyData SV 2013)PyData
 

En vedette (18)

NumPy/SciPy Statistics
NumPy/SciPy StatisticsNumPy/SciPy Statistics
NumPy/SciPy Statistics
 
The Joy of SciPy
The Joy of SciPyThe Joy of SciPy
The Joy of SciPy
 
Raspberry Pi and Scientific Computing [SciPy 2012]
Raspberry Pi and Scientific Computing [SciPy 2012]Raspberry Pi and Scientific Computing [SciPy 2012]
Raspberry Pi and Scientific Computing [SciPy 2012]
 
Доклад АКТО-2012 Душкин, Смирнова
Доклад АКТО-2012 Душкин, СмирноваДоклад АКТО-2012 Душкин, Смирнова
Доклад АКТО-2012 Душкин, Смирнова
 
Python Scipy Numpy
Python Scipy NumpyPython Scipy Numpy
Python Scipy Numpy
 
Statistical inference for (Python) Data Analysis. An introduction.
Statistical inference for (Python) Data Analysis. An introduction.Statistical inference for (Python) Data Analysis. An introduction.
Statistical inference for (Python) Data Analysis. An introduction.
 
Data Visulalization
Data VisulalizationData Visulalization
Data Visulalization
 
Introduction to NumPy & SciPy
Introduction to NumPy & SciPyIntroduction to NumPy & SciPy
Introduction to NumPy & SciPy
 
Scipy, numpy and friends
Scipy, numpy and friendsScipy, numpy and friends
Scipy, numpy and friends
 
Scientific computing
Scientific computingScientific computing
Scientific computing
 
Curve fitting
Curve fittingCurve fitting
Curve fitting
 
Making your code faster cython and parallel processing in the jupyter notebook
Making your code faster   cython and parallel processing in the jupyter notebookMaking your code faster   cython and parallel processing in the jupyter notebook
Making your code faster cython and parallel processing in the jupyter notebook
 
Effective Numerical Computation in NumPy and SciPy
Effective Numerical Computation in NumPy and SciPyEffective Numerical Computation in NumPy and SciPy
Effective Numerical Computation in NumPy and SciPy
 
Taller Multimedia en el Aula Virtual
Taller Multimedia en el Aula VirtualTaller Multimedia en el Aula Virtual
Taller Multimedia en el Aula Virtual
 
Data Analytics with Pandas and Numpy - Python
Data Analytics with Pandas and Numpy - PythonData Analytics with Pandas and Numpy - Python
Data Analytics with Pandas and Numpy - Python
 
Curve fitting
Curve fitting Curve fitting
Curve fitting
 
Introduction to NumPy (PyData SV 2013)
Introduction to NumPy (PyData SV 2013)Introduction to NumPy (PyData SV 2013)
Introduction to NumPy (PyData SV 2013)
 
Bayesian model averaging
Bayesian model averagingBayesian model averaging
Bayesian model averaging
 

Similaire à Scientific Computing with Python Webinar 9/18/2009:Curve Fitting

Emat 213 study guide
Emat 213 study guideEmat 213 study guide
Emat 213 study guideakabaka12
 
Integral table
Integral tableIntegral table
Integral tablebags07
 
icml2004 tutorial on bayesian methods for machine learning
icml2004 tutorial on bayesian methods for machine learningicml2004 tutorial on bayesian methods for machine learning
icml2004 tutorial on bayesian methods for machine learningzukun
 
Bayesian Methods for Machine Learning
Bayesian Methods for Machine LearningBayesian Methods for Machine Learning
Bayesian Methods for Machine Learningbutest
 
Lesson 2: A Catalog of Essential Functions (slides)
Lesson 2: A Catalog of Essential Functions (slides)Lesson 2: A Catalog of Essential Functions (slides)
Lesson 2: A Catalog of Essential Functions (slides)Mel Anthony Pepito
 
Lesson 2: A Catalog of Essential Functions (slides)
Lesson 2: A Catalog of Essential Functions (slides)Lesson 2: A Catalog of Essential Functions (slides)
Lesson 2: A Catalog of Essential Functions (slides)Matthew Leingang
 
Quadratic Function by Jasmine & Cristina
Quadratic Function by Jasmine & CristinaQuadratic Function by Jasmine & Cristina
Quadratic Function by Jasmine & CristinaHope Scott
 
Lesson 28: The Fundamental Theorem of Calculus
Lesson 28: The Fundamental Theorem of CalculusLesson 28: The Fundamental Theorem of Calculus
Lesson 28: The Fundamental Theorem of CalculusMatthew Leingang
 
Lesson 28: The Fundamental Theorem of Calculus
Lesson 28: The Fundamental Theorem of CalculusLesson 28: The Fundamental Theorem of Calculus
Lesson 28: The Fundamental Theorem of CalculusMatthew Leingang
 
Functions for Grade 10
Functions for Grade 10Functions for Grade 10
Functions for Grade 10Boipelo Radebe
 
Cea0001 ppt project
Cea0001 ppt projectCea0001 ppt project
Cea0001 ppt projectcea0001
 

Similaire à Scientific Computing with Python Webinar 9/18/2009:Curve Fitting (20)

Emat 213 study guide
Emat 213 study guideEmat 213 study guide
Emat 213 study guide
 
Lect3cg2011
Lect3cg2011Lect3cg2011
Lect3cg2011
 
1203 ch 12 day 3
1203 ch 12 day 31203 ch 12 day 3
1203 ch 12 day 3
 
Integral table
Integral tableIntegral table
Integral table
 
icml2004 tutorial on bayesian methods for machine learning
icml2004 tutorial on bayesian methods for machine learningicml2004 tutorial on bayesian methods for machine learning
icml2004 tutorial on bayesian methods for machine learning
 
Bayesian Methods for Machine Learning
Bayesian Methods for Machine LearningBayesian Methods for Machine Learning
Bayesian Methods for Machine Learning
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Fourier series 1
Fourier series 1Fourier series 1
Fourier series 1
 
Lesson 22: Graphing
Lesson 22: GraphingLesson 22: Graphing
Lesson 22: Graphing
 
Lesson 2: A Catalog of Essential Functions (slides)
Lesson 2: A Catalog of Essential Functions (slides)Lesson 2: A Catalog of Essential Functions (slides)
Lesson 2: A Catalog of Essential Functions (slides)
 
Lesson 2: A Catalog of Essential Functions (slides)
Lesson 2: A Catalog of Essential Functions (slides)Lesson 2: A Catalog of Essential Functions (slides)
Lesson 2: A Catalog of Essential Functions (slides)
 
parent functons
parent functonsparent functons
parent functons
 
Lesson 22: Graphing
Lesson 22: GraphingLesson 22: Graphing
Lesson 22: Graphing
 
Bayes 6
Bayes 6Bayes 6
Bayes 6
 
Figures
FiguresFigures
Figures
 
Quadratic Function by Jasmine & Cristina
Quadratic Function by Jasmine & CristinaQuadratic Function by Jasmine & Cristina
Quadratic Function by Jasmine & Cristina
 
Lesson 28: The Fundamental Theorem of Calculus
Lesson 28: The Fundamental Theorem of CalculusLesson 28: The Fundamental Theorem of Calculus
Lesson 28: The Fundamental Theorem of Calculus
 
Lesson 28: The Fundamental Theorem of Calculus
Lesson 28: The Fundamental Theorem of CalculusLesson 28: The Fundamental Theorem of Calculus
Lesson 28: The Fundamental Theorem of Calculus
 
Functions for Grade 10
Functions for Grade 10Functions for Grade 10
Functions for Grade 10
 
Cea0001 ppt project
Cea0001 ppt projectCea0001 ppt project
Cea0001 ppt project
 

Plus de Enthought, Inc.

Talk at NYC Python Meetup Group
Talk at NYC Python Meetup GroupTalk at NYC Python Meetup Group
Talk at NYC Python Meetup GroupEnthought, Inc.
 
Scientific Applications with Python
Scientific Applications with PythonScientific Applications with Python
Scientific Applications with PythonEnthought, Inc.
 
Scientific Computing with Python Webinar March 19: 3D Visualization with Mayavi
Scientific Computing with Python Webinar March 19: 3D Visualization with MayaviScientific Computing with Python Webinar March 19: 3D Visualization with Mayavi
Scientific Computing with Python Webinar March 19: 3D Visualization with MayaviEnthought, Inc.
 
February EPD Webinar: How do I...use PiCloud for cloud computing?
February EPD Webinar: How do I...use PiCloud for cloud computing?February EPD Webinar: How do I...use PiCloud for cloud computing?
February EPD Webinar: How do I...use PiCloud for cloud computing?Enthought, Inc.
 
Parallel Processing with IPython
Parallel Processing with IPythonParallel Processing with IPython
Parallel Processing with IPythonEnthought, Inc.
 
Scientific Computing with Python Webinar: Traits
Scientific Computing with Python Webinar: TraitsScientific Computing with Python Webinar: Traits
Scientific Computing with Python Webinar: TraitsEnthought, Inc.
 
Scientific Computing with Python Webinar --- August 28, 2009
Scientific Computing with Python Webinar --- August 28, 2009Scientific Computing with Python Webinar --- August 28, 2009
Scientific Computing with Python Webinar --- August 28, 2009Enthought, Inc.
 
Scientific Computing with Python Webinar --- June 19, 2009
Scientific Computing with Python Webinar --- June 19, 2009Scientific Computing with Python Webinar --- June 19, 2009
Scientific Computing with Python Webinar --- June 19, 2009Enthought, Inc.
 
Scientific Computing with Python Webinar --- May 22, 2009
Scientific Computing with Python Webinar --- May 22, 2009Scientific Computing with Python Webinar --- May 22, 2009
Scientific Computing with Python Webinar --- May 22, 2009Enthought, Inc.
 

Plus de Enthought, Inc. (13)

Numpy Talk at SIAM
Numpy Talk at SIAMNumpy Talk at SIAM
Numpy Talk at SIAM
 
Talk at NYC Python Meetup Group
Talk at NYC Python Meetup GroupTalk at NYC Python Meetup Group
Talk at NYC Python Meetup Group
 
Scientific Applications with Python
Scientific Applications with PythonScientific Applications with Python
Scientific Applications with Python
 
SciPy 2010 Review
SciPy 2010 ReviewSciPy 2010 Review
SciPy 2010 Review
 
Scientific Computing with Python Webinar March 19: 3D Visualization with Mayavi
Scientific Computing with Python Webinar March 19: 3D Visualization with MayaviScientific Computing with Python Webinar March 19: 3D Visualization with Mayavi
Scientific Computing with Python Webinar March 19: 3D Visualization with Mayavi
 
Chaco Step-by-Step
Chaco Step-by-StepChaco Step-by-Step
Chaco Step-by-Step
 
February EPD Webinar: How do I...use PiCloud for cloud computing?
February EPD Webinar: How do I...use PiCloud for cloud computing?February EPD Webinar: How do I...use PiCloud for cloud computing?
February EPD Webinar: How do I...use PiCloud for cloud computing?
 
SciPy India 2009
SciPy India 2009SciPy India 2009
SciPy India 2009
 
Parallel Processing with IPython
Parallel Processing with IPythonParallel Processing with IPython
Parallel Processing with IPython
 
Scientific Computing with Python Webinar: Traits
Scientific Computing with Python Webinar: TraitsScientific Computing with Python Webinar: Traits
Scientific Computing with Python Webinar: Traits
 
Scientific Computing with Python Webinar --- August 28, 2009
Scientific Computing with Python Webinar --- August 28, 2009Scientific Computing with Python Webinar --- August 28, 2009
Scientific Computing with Python Webinar --- August 28, 2009
 
Scientific Computing with Python Webinar --- June 19, 2009
Scientific Computing with Python Webinar --- June 19, 2009Scientific Computing with Python Webinar --- June 19, 2009
Scientific Computing with Python Webinar --- June 19, 2009
 
Scientific Computing with Python Webinar --- May 22, 2009
Scientific Computing with Python Webinar --- May 22, 2009Scientific Computing with Python Webinar --- May 22, 2009
Scientific Computing with Python Webinar --- May 22, 2009
 

Dernier

Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 

Dernier (20)

Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 

Scientific Computing with Python Webinar 9/18/2009:Curve Fitting

  • 1. Curve-fitting (regression) with Python September 18, 2009
  • 3. Enthought Training Courses Python Basics, NumPy, SciPy, Matplotlib, Traits, TraitsUI, Chaco…
  • 4. Enthought Python Distribution (EPD) http://www.enthought.com/products/epd.php
  • 5. Data Model y = mx + b m = 4.316 b = 2.763 a y = (b + ce−dx ) a = 7.06 b = 2.52 c = 26.14 d = −5.57
  • 6. Curve Fitting or Regression? Adrien-Marie Francis Galton Legendre R.A. Fisher Carl Gauss
  • 7. or (my preferred) ... Bayesian Inference Model Prior Inference p(Y|X)p(X) p(X|Y) = p(Y) Un Da p(Y|X)p(X) kn ta = ow p(Y|X)p(X)dX ns Bayes Laplace Harold Jeffreys Richard T. Cox Edwin T. Jaynes
  • 8. More pedagogy Machine Learning Curve Fitting Regression Parameter Estimation Bayesian Inference Understated statistical Statistical model is model more important Just want “best” fit to Post estimation data analysis of error and fit
  • 9. Pragmatic look at the methods • Because the concept is really at the heart of science, many practical methods have been developed. • SciPy contains the building blocks to implement basically any method. • SciPy should get high-level interfaces to all the methods in common use.
  • 10. Methods vary in... • The model used: – parametric (specific model): y = f (x; θ) – non-parametric (many unknowns) y = θi φi (x) i • The way error is modeled y = y + ˆ – few assumptions (e.g. zero-mean, homoscedastic) – full probabilistic model • What “best fit” means (i.e. what is distance between the predicted and the measured). – traditional least-squares – robust methods (e.g. absolute difference)
  • 11. Parametric Least Squares T y ˆ = [y0 , y1 , ..., yN −1 ] T x = [x0 , x1 , ..., xN −1 ] T y = f (x; β) + ˆ β = [β0 , β1 , ..., βK−1 ] K < N ˆ β = argmin J(ˆ, x, β) y β ˆ β = argmin (ˆ − f (x; β))T W(ˆ − f (x; β)) y y β
  • 12. Linear Least Squares y = H(x)β + ˆ −1 ˆ = H(x)T WH(x) β H(x) Wˆ y T Quadratic Example: yi = 2 axi + bxi + c   x20 x0 1    x2 x1 1  a  1  y= ˆ . . . . . .  b +  . . .  c x2 −1 N xN −1 1 H(x) β
  • 13. Non-linear least squares ˆ β = argmin J(ˆ, x, β) y β ˆ β = argmin (ˆ − f (x; β)) W(ˆ − f (x; β)) y y T β Logistic Example a yi = b + ce−dxi Optimization Problem!!
  • 14. Tools in NumPy / SciPy • polyfit (linear least squares) • curve_fit (non-linear least-squares) • poly1d (polynomial object) • numpy.random (random number generators) • scipy.stats (distribution objects • scipy.optimize (unconstrained and constrained optimization)
  • 15. Polynomials • p = poly1d(<coefficient array>) >>> p = poly1d([1,-2,4]) >>> print p 2 • p.roots (p.r) are the roots x - 2 x + 4 • p.coefficients (p.c) are the coefficients >>> g = p**3 + p*(3-2*p) >>> print g • p.order is the order 6 5 4 3 2 x - 6 x + 25 x - 51 x + 81 x - 58 x + 44 • p[n] is the coefficient of xn >>> print g.deriv(m=2) 4 3 2 • p(val) evaulates the polynomial at val 30 x - 120 x + 300 x - 306 x + 162 >>> print p.integ(m=2,k=[2,1]) • p.integ() integrates the polynomial 4 3 2 0.08333 x - 0.3333 x + 2 x + 2 x + 1 • p.deriv() differentiates the polynomial >>> print p.roots • Basic numeric operations (+,-,/,*) work [ 1.+1.7321j 1.-1.7321j] >>> print p.coeffs • Acts like p.c when used as an array [ 1 -2 4] • Fancy printing 15
  • 16. Statistics scipy.stats — CONTINUOUS DISTRIBUTIONS over 80 continuous distributions! METHODS pdf entropy cdf nnlf rvs moment ppf freeze stats fit sf isf 16
  • 17. Using stats objects DISTRIBUTIONS >>> from scipy.stats import norm # Sample normal dist. 100 times. >>> samp = norm.rvs(size=100) >>> x = linspace(-5, 5, 100) # Calculate probability dist. >>> pdf = norm.pdf(x) # Calculate cummulative Dist. >>> cdf = norm.cdf(x) # Calculate Percent Point Function >>> ppf = norm.ppf(x) 17
  • 18. Setting location and Scale NORMAL DISTRIBUTION >>> from scipy.stats import norm # Normal dist with mean=10 and std=2 >>> dist = norm(loc=10, scale=2) >>> x = linspace(-5, 15, 100) # Calculate probability dist. >>> pdf = dist.pdf(x) # Calculate cummulative dist. >>> cdf = dist.cdf(x) # Get 100 random samples from dist. >>> samp = dist.rvs(size=100) # Estimate parameters from data >>> mu, sigma = norm.fit(samp) .fit returns best >>> print “%4.2f, %4.2f” % (mu, sigma) shape + (loc, scale) 10.07, 1.95 that explains the data 18
  • 19. Fitting Polynomials (NumPy) POLYFIT(X, Y, DEGREE) >>> from numpy import polyfit, poly1d >>> from scipy.stats import norm # Create clean data. >>> x = linspace(0, 4.0, 100) >>> y = 1.5 * exp(-0.2 * x) + 0.3 # Add a bit of noise. >>> noise = 0.1 * norm.rvs(size=100) >>> noisy_y = y + noise # Fit noisy data with a linear model. >>> linear_coef = polyfit(x, noisy_y, 1) >>> linear_poly = poly1d(linear_coef) >>> linear_y = linear_poly(x), # Fit noisy data with a quadratic model. >>> quad_coef = polyfit(x, noisy_y, 2) >>> quad_poly = poly1d(quad_coef) >>> quad_y = quad_poly(x)) 19
  • 20. Optimization scipy.optimize — Unconstrained Minimization and Root Finding Unconstrained Optimization Constrained Optimization • fmin (Nelder-Mead simplex) • fmin_l_bfgs_b • fmin_powell (Powell’s method) • fmin_tnc (truncated Newton code) • fmin_bfgs (BFGS quasi-Newton • fmin_cobyla (constrained optimization by method) linear approximation) • fmin_ncg (Newton conjugate gradient) • fminbound (interval constrained 1D minimizer) • leastsq (Levenberg-Marquardt) • anneal (simulated annealing global Root Finding minimizer) • fsolve (using MINPACK) • brute (brute force global minimizer) • brentq • brent (excellent 1-D minimizer) • brenth • golden • ridder • bracket • newton • bisect • fixed_point (fixed point equation solver) 20
  • 21. Optimization: Data Fitting NONLINEAR LEAST SQUARES CURVE FITTING >>> from scipy.optimize import curve_fit # Define the function to fit. >>> def function(x, a , b, f, phi): ... result = a * exp(-b * sin(f * x + phi)) ... return result # Create a noisy data set. >>> actual_params = [3, 2, 1, pi/4] >>> x = linspace(0,2*pi,25) >>> exact = function(x, *actual_params) >>> noisy = exact + 0.3 * randn(len(x)) # Use curve_fit to estimate the function parameters from the noisy data. >>> initial_guess = [1,1,1,1] >>> estimated_params, err_est = curve_fit(function, x, noisy, p0=initial_guess) >>> estimated_params array([3.1705, 1.9501, 1.0206, 0.7034]) # err_est is an estimate of the covariance matrix of the estimates # (i.e. how good of a fit is it) 21
  • 22. StatsModels Josef Perktold Canada Economists Skipper Seabold PhD Student American University Washington, D.C.
  • 23.
  • 24. GUI example: astropysics (with TraitsUI) Erik J. Tollerud PhD Student UC Irvine Center for Cosmology Irvine, CA http://www.physics.uci.edu/~etolleru/
  • 25. Scientific Python Classes http://www.enthought.com/training Sept 21-25 Austin Oct 19-22 Silicon Valley Nov 9-12 Chicago Dec 7-11 Austin