コード例 #1
0
ファイル: logletnado.py プロジェクト: thejasonyung/pyloglet
    def get(self):
        xdata = [ 0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84 ]
        ydata = [ 0.00, 17.93, 36.36, 67.76, 98.10, 131.00, 169.50, 205.50, 228.30, 247.10, 250.50, 253.80, 254.50 ]
        # initial guesses
        p0 = [ 257, 42, 38 ]

        popts = logistic.levenberg_marquardt(p0).fit(xdata, ydata)
        self.write({'params': popts.tolist()})
コード例 #2
0
ファイル: logletnado.py プロジェクト: thejasonyung/pyloglet
 def post(self):
     """
     curl --data "{\"x\": [ 0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84 ], \"y\": [ 0.00, 17.93, 36.36, 67.76, 98.10, 131.00, 169.50, 205.50, 228.30, 247.10, 250.50, 253.80, 254.50 ], \"init_params\": [ 257, 42, 38 ]}" http://localhost:8888/fit/lm
     """
     print self.request.body
     data = tornado.escape.json_decode(tornado.escape.url_decode(self.request.body))
     popts = logistic.levenberg_marquardt(data['init_params']).fit(data['x'], data['y'])
     self.write({'params': popts.tolist()})
コード例 #3
0
ファイル: loglets.py プロジェクト: thejasonyung/pyloglet
#!/usr/bin/python
# -*- coding: utf-8 -*-
from pyloglet import logistic

# Sunflower data (single logistic)
# data
xdata = [ 0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84 ]
ydata = [ 0.00, 17.93, 36.36, 67.76, 98.10, 131.00, 169.50, 205.50, 228.30, 247.10, 250.50, 253.80, 254.50 ]
# initial guesses
p0 = [ 257, 42, 38 ]

popt = logistic.levenberg_marquardt(p0).fit(xdata, ydata)

print popt

# hold K
popt = logistic.levenberg_marquardt(p0, hold=[True, False, False]).fit(xdata, ydata)

print popt

# hold K
popt = logistic.marchetti().fit(xdata, ydata)

print popt