物探论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1191|回复: 0

[算法] 超级平滑

[复制链接]
发表于 2013-11-24 09:49:54 | 显示全部楼层 |阅读模式
supsmu: Smoothing of scatterplots using Friedman's supersmoother algorithm.

  Syntax:
    Y_SMOOTH = supsmu(X,Y,'PropertyName',PropertyValue,...)

  Inputs:
    X, Y are same-length vectors.

  Output
    Y_SMOOTH is a smoothed version of Y.

  Example,
    x = linspace(0,1,201);
    y = sin(2.5*x) + 0.05*randn(1,201);
    smo = supsmu(x,y);
    plot(x,y,'o',x,smo)

  The supersmoother algorithm computes three separate smooth curves from
  the input data with symmetric spans of 0.05*n, 0.2*n and 0.5*n, where n
  is the number of data points.  The best of the three smooth curves is
  chosen for each predicted point using leave-one-out cross validation. The
  best spans are then smoothed by a fixed-span smoother (span = 0.2*n) and
  the prediction is computed by linearly interpolating between the three
  smooth curves.  This final smooth curve is then smmothed again with a
  fixed-span smoother (span = 0.05*n).

  According to comments by Friedman, "For small samples (n < 40) or if
  there are substantial serial correlations between observations close in
  x-value, then a prespecified fixed span smoother (span > 0) should be
  used.  Reasonable span values are 0.2 to 0.4."


  The following optional property/value pairs can be specified as arguments
  to control the indicated behavior:

    Property    Value
    ----------  ----------------------------------------------------------
    Weights     Vector of relative weights of each data point.  Default is
                for all points to be weighted equally.

    Span        Sets the width of a fixed-width smoothing operation
                relative to the number of data points, 0 < SPAN < 1.
                Setting this to be non-zero disables the supersmoother
                algorithm.  Default is 0 (use supersmoother).

    Period      Sets the period of periodic data.  Default is Inf
                (infinity) which implies that the data is not periodic.
                Can also be set to zero for the same effect.

    Alpha       Sets a small-span penalty to produce a greater smoothing
                effect.  0 < Alpha < 10, where 0 does nothing and 10
                produces the maximum effect.  Default = 0.

    Unsorted    If the data points are not already sorted in order of the X
                values then setting this to true will sort them for you.
                Default = false.

  All properties names are case-insensitive and need only be unambiguous.
  For example,

    Y_SMOOTH = supsmu(X,Y,'weights',ones(n,1),'per',2*pi)

  is valid usage.
1.png supsmu.zip (4.56 KB, 下载次数: 0, 售价: 2 物探币)
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|物探论坛 ( 鄂ICP备12002012号 微信号:iwutan )

GMT+8, 2024-4-29 13:40 , Processed in 0.159146 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表