Skip to content

Instantly share code, notes, and snippets.

View feriat's full-sized avatar

Andrew feriat

  • Economic and Mathematics school of Moscow
  • Moscow, Russia
View GitHub Profile
@feriat
feriat / code
Last active August 29, 2015 14:13
DataJoy mini bug with __builtin__
class llist(__builtin__.list):
"""Special list for Ordered Models. Element -1 is -Inf, Final element is Inf.
--------------------------------------------------------
EXAMPLE:
x = llist([12.,14,2.2])
x[1]
>>>14
x[-1], x[3]
>>>(-inf, inf)
@feriat
feriat / gist:c43fcd9e2667fbab2ede
Created April 6, 2015 16:45
Standard Errors Computation
def se(self,params):
"""
Return standard errors at optimum point, NOT SE
"""
hess = self.hessian(params)
return np.sqrt(np.linalg.inv(-hess).diagonal())
def hessian (self, x0, epsilon=1.e-8, *args ):
"""
A numerical approximation to the Hessian matrix of arbitrary function f at
import urllib2
import json
ll = urllib2.urlopen('http://worldfreightrates.com/en/calculator/ocean/rate?fromId=50eb29010f0880372c627af9&toId=50eb29010f0880372c627a38&fromName=Rotterdam%2C+Netherlands&toName=Los+Angeles%2C+United+States&oceanType=FCL&commodityName=Packaging+%26+Printing&commodityValue=25000&includeInsurance=false&includeReefer=false&includeHazardous=false&weight=&unit=lb&length=&width=&height=&containerSize=40&_=1439321618401')
result = json.load(ll)
print result['rate']
@feriat
feriat / gudkov.ru.2017-09-09.forecast.tsv
Created September 9, 2017 17:00
прогноз голосов от гудкова
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 2 columns, instead of 1 in line 4.
Район
округ
количество просмотров
нужно голосов
процент последних двух
Академический 1 1172 1055 111%
Академический 2 1308 1067 123%
Академический 3 1547 1048 148%