forecast new death
Budget: $10 – $30 USD
i have a covid data and i want to use it predict future new covid death
I have a code but it fails when i run it
here is the code
def lr_model(training):
training.withColumn('submission_date',F.to_date(F.col("submission_date")))
feature_cols=['pnew_case', 'tot_cases','state','submission_date', 'conf_cases','conf_death', 'prob_cases', 'prob_death', 'New_case', 'pnew_death']
y=training.tot_death
X=training.select(feature_cols)
lm = LinearRegression()
lm.fit(X, y)
# print intercept and coefficients
print(lm.intercept_)
print(lm.coef_)
it suppose to predict total death in the future month ahead in pyspark
but i have this error
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.
I have a code but it fails when i run it
here is the code
def lr_model(training):
training.withColumn('submission_date',F.to_date(F.col("submission_date")))
feature_cols=['pnew_case', 'tot_cases','state','submission_date', 'conf_cases','conf_death', 'prob_cases', 'prob_death', 'New_case', 'pnew_death']
y=training.tot_death
X=training.select(feature_cols)
lm = LinearRegression()
lm.fit(X, y)
# print intercept and coefficients
print(lm.intercept_)
print(lm.coef_)
it suppose to predict total death in the future month ahead in pyspark
but i have this error
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.