def getFeature(item):
    if item is None:
        return
    yr = item['year']
    vec = fe.get(item['sentences1'],item['sentences2'])
    titles = ([item['title1'],item['title2']])
#    print [vec,titles,yr]
    return ([vec,titles,yr,item['date1'],item['date2']])
def getFeature(item):
    if item is None:
        return
    yr = item['year']
    vec = fe.get(item['sentences1'], item['sentences2'])
    titles = ([item['title1'], item['title2']])
    #    print [vec,titles,yr]
    return ([vec, titles, yr, item['date1'], item['date2']])
Beispiel #3
0
def train(doubleSets):
    bools = []
    features = []

    for item in doubleSets:
        bools.append(item['year'])
        vec = fe.get(item['sentences1'],item['sentences2'])
        features.append(vec)
    print "Training The Classifier."
    clf.fit(features,bools)
Beispiel #4
0
def test(doubleSets):
    bools = []
    features = []
    correct = 0
    incorrect = 0
    for item in doubleSets:
        bools.append(item['year'])
        vec = fe.get(item['sentences1'],item['sentences2'])
        titles.append([item['title1'],item['title2']])
        features.append(vec)

    for feature in range(len(features)):
        predict = clf.predict(np.array9[features[feature]]))
        prob = clf.predict_proba(np.arrat([features[feature]]))
        probs.append([predict,prob, bools[feature]])
Beispiel #5
0
def getFeature(item):
    yr = item['year']
    vec = fe.get(item['sentences1'], item['sentences2'])
    titles = ([item['title1'], item['title2']])
    return ([vec, titles, yr])
Beispiel #6
0
def getFeature(item):
    yr = item['year']
    vec = fe.get(item['sentences1'],item['sentences2'])
    titles = ([item['title1'],item['title2']])
    return ([vec,titles,yr])