Discovering Data
  • Home
  • Blog

#100DaysOfDataScience

Day 27 - 4th DengAI submission

8/1/2018

0 Comments

 
Attempted a polynomial regression:

from sklearn.preprocessing import PolynomialFeatures
from sklearn.linear_model import LinearRegression
# Create matrix and vectors

# PolynomialFeatures (prepreprocessing)
poly = PolynomialFeatures(degree=2)
X_ = poly.fit_transform(X)
X_test_ = poly.fit_transform(X_test)

lg = LinearRegression()

# Fit
lg.fit(X_, y)

# Obtain coefficients
#lg.coef_

# Predict
test = pd.read_csv('short_test.csv')
test['city'] = test['city'].map({'sj': 1, 'iq': 2})
test = test.dropna()
test_ = poly.fit_transform(test)
predictions = lg.predict(test_)
#np.around(predictions)
print(np.around(predictions))

but this resulted in a drop in score back to 33.1 from 30.1
0 Comments



Leave a Reply.

Proudly powered by Weebly
  • Home
  • Blog