Я работаю с данными временных рядов, и когда я написал 'pjme_test_fcst = model.predict (df = pjme_test.reset_index () \ .rename (columns = {' Datetime ':' ds '}))', то консольный jus остановился и не работал, и я попытался перезапустить, но то же самое случилось, не могли бы вы сказать мне, почему это произошло и что мне нужно сделать? примечание: я учу это у Kaggle.
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from fbprophet import Prophet
from sklearn.metrics import mean_squared_error, mean_absolute_error
import seaborn as sns
<pre> f=pd.read_csv('https://raw.githubusercontent.com/pedrocava/trab_series1/master/PJME_hourly.csv',index_col=[0],parse_dates=[0])
# Color pallete for plotting
color_pal = ["#F8766D", "#D39200", "#93AA00",
"#00BA38", "#00C19F", "#00B9E3",
"#619CFF", "#DB72FB"]
from fbprophet import Prophet
from sklearn.metrics import mean_squared_error, mean_absolute_error
plt.style.use('fivethirtyeight')
df.plot(style='.',figsize=(15,5),color=color_pal,title='hourly data ')
<pre> def create_features(df, label=None):
df = df.copy()
df['date'] = df.index
df['hour'] = df['date'].dt.hour
df['dayofweek'] = df['date'].dt.dayofweek
df['quarter'] = df['date'].dt.quarter
df['month'] = df['date'].dt.month
df['year'] = df['date'].dt.year
df['dayofyear'] = df['date'].dt.dayofyear
df['dayofmonth'] = df['date'].dt.day
df['weekofyear'] = df['date'].dt.weekofyear
X = df[['hour','dayofweek','quarter','month','year',
'dayofyear','dayofmonth','weekofyear']]
if label:
y = df[label]
return X, y
return X
X, y = create_features(df, label='PJME_MW')
features_and_target = pd.concat([X, y], axis=1)
features_and_target.head()
sns.pairplot(features_and_target.dropna(),
hue='hour',
x_vars=['hour','dayofweek','year','weekofyear'],
y_vars='PJME_MW',
height=5,
plot_kws={'alpha':0.15,'linewidth':0})
plt.suptitle('hourl;u ,day of week, year and week ofyear')
split_date='01-Jan-2015'
pjme_train=df.loc[df.index <=split_date].copy()
pjme_test=df.loc[df.index > split_date].copy()
pjme_test \
.rename(columns={'PJME_MW':'Test set'})\
.join(pjme_train.rename(columns={'PJME_MW':'train set'}),how='outer')\
.plot(figsize=(15,5),title='PJME',style='.')
plt.show()
pjme_train.reset_index()\
.rename(columns={'Datetime':'ds',
'PJME_MW':'Y'}).head()
model=Prophet()
model.fit(pjme_train.reset_index()\
.rename(columns={'Datetime':'ds',
'PJME_MW':'y'}))
#predict
pjme_test_fcst=model.predict(df=pjme_test.reset_index()\
.rename(columns={'Datetime':'ds'}))
INFO:numexpr.utils:NumExpr defaulting to 4 threads.