2013-04-26 3 views

답변

1

"기계 학습"에 대해 언급 한대로 문제가 해결되는지, 어떤 종류의 데이터가 있는지 확실하지 않습니다. 그러나 "예측"과 "추정 주파수"에 대해서도 언급 했으므로 보간이 도움이 될 수 있다고 생각합니다. 이 경우 scipy.interpolate을 볼 수 있습니다.

보간 기는 "방사형 기저 함수 근사/보간 n 차원 분산 데이터 용 클래스 ..."입니다. 그것은 다음과 같은 기능을 지원합니다

'multiquadric': sqrt((r/self.epsilon)**2 + 1) 
'inverse':  1.0/sqrt((r/self.epsilon)**2 + 1) 
'gaussian':  exp(-(r/self.epsilon)**2) 
'linear':  r 
'cubic':  r**3 
'quintic':  r**5 
'thin_plate': r**2 * log(r) 
+0

감사 (SciPy 0.11.0에서 제거) SciPy의 maxentropy 모듈을 사용

Example. 나는이 신문에이 모델을 구현하는 더 쉬운 방법이 있는지 알아 내려고 노력 중이다. http://users.cis.fiu.edu/~lzhen001/activities/KDD_USB_key_2010/docs/p213.pdf – user2322784

3

당신이 SciPy (즉 0.10 이전)의 이전 버전을 사용하는 경우 (NLP, MaxEnt = 최대 엔트로피 모델링 = 로그 - 선형 모델에서) scipy.maxentropy를 사용할 수 있습니다. 이 모듈은 버전 0.11.0이 출시되었을 때 SciPy를 제거했고, SciPy 팀은 sklearn.linear_model.LogisticRegression을 대체로 사용했습니다 (both 로그 선형 모델 및 로지스틱 회귀는 generalized linear models의 예이며, 선형 예측 자).

#!/usr/bin/env python 

""" Example use of the maximum entropy module: 

    Machine translation example -- English to French -- from the paper 'A 
    maximum entropy approach to natural language processing' by Berger et 
    al., 1996. 

    Consider the translation of the English word 'in' into French. We 
    notice in a corpus of parallel texts the following facts: 

     (1) p(dans) + p(en) + p(a) + p(au cours de) + p(pendant) = 1 
     (2) p(dans) + p(en) = 3/10 
     (3) p(dans) + p(a) = 1/2 

    This code finds the probability distribution with maximal entropy 
    subject to these constraints. 
""" 

__author__ = 'Ed Schofield' 
__version__= '2.1' 

from scipy import maxentropy 

a_grave = u'\u00e0' 

samplespace = ['dans', 'en', a_grave, 'au cours de', 'pendant'] 

def f0(x): 
    return x in samplespace 

def f1(x): 
    return x=='dans' or x=='en' 

def f2(x): 
    return x=='dans' or x==a_grave 

f = [f0, f1, f2] 

model = maxentropy.model(f, samplespace) 

# Now set the desired feature expectations 
K = [1.0, 0.3, 0.5] 

model.verbose = True 

# Fit the model 
model.fit(K) 

# Output the distribution 
print "\nFitted model parameters are:\n" + str(model.params) 
print "\nFitted distribution is:" 
p = model.probdist() 
for j in range(len(model.samplespace)): 
    x = model.samplespace[j] 
    print ("\tx = %-15s" %(x + ":",) + " p(x) = "+str(p[j])).encode('utf-8') 


# Now show how well the constraints are satisfied: 
print 
print "Desired constraints:" 
print "\tp['dans'] + p['en'] = 0.3" 
print ("\tp['dans'] + p['" + a_grave + "'] = 0.5").encode('utf-8') 
print 
print "Actual expectations under the fitted model:" 
print "\tp['dans'] + p['en'] =", p[0] + p[1] 
print ("\tp['dans'] + p['" + a_grave + "'] = " + str(p[0]+p[2])).encode('utf-8') 
# (Or substitute "x.encode('latin-1')" if you have a primitive terminal.) 

다른 아이디어 : 답장을 http://homepages.inf.ed.ac.uk/lzhang10/maxent.html

관련 문제