码迷,mamicode.com
首页 > 其他好文 > 详细

Linear Regression

时间:2016-02-02 14:47:01      阅读:202      评论:0      收藏:0      [点我收藏+]

标签:

大学时候学物理实验的时候接触过线性回归,现在忘记了...还得重新拾起来。学习不扎实耽误了多少时光... sigh

Suppose that you time a program as a function of N and produce
the following table.

        N   seconds
-------------------
       64     0.000
      128     0.001
      256     0.010
      512     0.083
     1024     0.698
     2048     5.742
     4096    48.346
     8192   401.315
    16384  3366.172


Estimate the order of growth of the running time as a function of N.
Assume that the running time obeys a power law T(N) ~ a N^b. For your
answer, enter the constant b. Your answer will be marked as correct
if it is within 1% of the target answer - we recommend using
two digits after the decimal separator, e.g., 2.34.

已知一组数据,N和seconds, 求T(n)中的b。

方法是两边先取对数,这样造成 log(T(n)) = log(a) + b * log(n), 这样就完成了一个斜率b的线性函数。我们用一般的线性回归就可以解出b和a。

Reference: 

https://en.wikipedia.org/wiki/Regression_analysis

Linear Regression

标签:

原文地址:http://www.cnblogs.com/yrbbest/p/5177142.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!