Example #1
0
def prepare_training_data_modelx():
    sts_scores = np.array(get_sts_scores('score.train'))
    _x, to_remove = get_asiya_scores()
    x = np.array(_x)
    y = sts_scores
    y =np.delete(y, to_remove, axis=0)
    n = len(y)
    
    np.savetxt('x.asiya.train', x)
    np.savetxt('y.asiya.train', y)

    test_asiya_scores = np.array(get_asiya_test_scores())
    np.savetxt('x.asiya.test', test_asiya_scores)
from sklearn.gaussian_process import GaussianProcess
from sklearn.tree import DecisionTreeRegressor

import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection

from sts_data import get_meteor_scores, get_sts_scores
from asiya import get_asiya_scores

meteor_scores = np.array(get_meteor_scores('meteor.output.train'))
sts_scores = np.array(get_sts_scores('score.train'))

test_meteor_scores = np.array(get_meteor_scores('meteor.output.test'))

x = meteor_scores
_x, to_remove = get_asiya_scores()

x = np.array(_x)
y = sts_scores
y = np.delete(y, to_remove, axis=0)
n = len(y)
xt = x

#print len(_x), len(x), len(y)

# Linear Regression
print 'linear'
lr = LinearRegression()
#lr.fit(x[:, np.newaxis], y)
#lr_sts_scores = lr.predict(xt[:, np.newaxis])
lr.fit(x, y)
from sklearn.gaussian_process import GaussianProcess
from sklearn.tree import DecisionTreeRegressor

import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection

from sts_data import get_meteor_scores, get_sts_scores
from asiya import get_asiya_scores

meteor_scores = np.array(get_meteor_scores('meteor.output.train'))
sts_scores = np.array(get_sts_scores('score.train'))

test_meteor_scores = np.array(get_meteor_scores('meteor.output.test'))

x = meteor_scores
_x, to_remove = get_asiya_scores()

x = np.array(_x)
y = sts_scores
y =np.delete(y, to_remove, axis=0)
n = len(y)
xt = x

#print len(_x), len(x), len(y)

# Linear Regression
print 'linear'
lr = LinearRegression()
#lr.fit(x[:, np.newaxis], y)
#lr_sts_scores = lr.predict(xt[:, np.newaxis])
lr.fit(x, y)