Comments (3)
Hi @kennis222,
Yes, you understood it well :)
from skforecast.
Hello @kennis222,
Thank you for opening the issue, a similar example works for me in version 0.4.3, here is:
# Libraries
# ==============================================================================
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from skforecast.ForecasterAutoregMultiOutput import ForecasterAutoregMultiOutput
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error
# Create and fit forecaster
# ==============================================================================
y = pd.Series(list(range(50)))
forecaster = ForecasterAutoregMultiOutput(
regressor = LinearRegression(),
steps = 5,
lags = 2
)
forecaster.fit(y=y)
# Get coef for step 1
# ==============================================================================
display(forecaster.get_coef(step=1))
# Get list of df
# ==============================================================================
coef_ = []
for i in list(range(forecaster.steps)):
df = forecaster.get_coef(step=i+1) # First step is 1 not 0
coef_.append(df)
# print Get coef for step 1
display(coef_[0])
From forecaster.get_coef(step=1)
:
feature | coef | |
---|---|---|
0 | lag_1 | 0.5 |
1 | lag_2 | 0.5 |
From list:
feature | coef | |
---|---|---|
0 | lag_1 | 0.5 |
1 | lag_2 | 0.5 |
FYI, the get_coef
method was deprecated because it was merged into the get_feature_importance
method. get_feature_importance
accesses the method coef_
or feature_importances_
depending on the type of the regressor.
So in the latest version, 0.5.1 it would be:
Note that ForecasterAutoregMultiOutput
has been renamed to ForecasterAutoregDirect
# Libraries
# ==============================================================================
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from skforecast.ForecasterAutoregDirect import ForecasterAutoregDirect
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error
# Create and fit forecaster
# ==============================================================================
y = pd.Series(list(range(50)))
forecaster = ForecasterAutoregDirect(
regressor = LinearRegression(),
steps = 5,
lags = 2
)
forecaster.fit(y=y)
# Get coef for step 1
# ==============================================================================
display(forecaster.get_feature_importance(step=1))
# Get list of df
# ==============================================================================
coef_ = []
for i in list(range(forecaster.steps)):
df = forecaster.get_feature_importance(step=i+1) # First step is 1 not 0
coef_.append(df)
# print Get coef for step 1
display(coef_[0])
From forecaster.get_feature_importance(step=1)
:
feature | importance | |
---|---|---|
0 | lag_1 | 0.5 |
1 | lag_2 | 0.5 |
From list:
feature | importance | |
---|---|---|
0 | lag_1 | 0.5 |
1 | lag_2 | 0.5 |
I recommend using the latest version as we have fixed some bugs and improved efficiency. 😄
Thank you!
from skforecast.
Hello @JavierEscobarOrtiz,
Thank you for the reply, but the case you show me in the version 0.4.3 still not works for my environment. However, since merging the the method coef_ or feature_importances_ depending on the type of the regressor, can I understand in this way: if using LinearRegression, the feature_importances_ means the coefficients, but if using the random forest, the feature_importances_ means the impurity-based feature importance? If "Yes", I can directly use the latest version : )
from skforecast.
Related Issues (20)
- A single model multivariate forecaster HOT 3
- Issue saving ForecasterSarimax object HOT 4
- Custom predictors are inefficient for window features HOT 1
- grid_search_sarimax takes a very long time to run HOT 1
- Feature request: Add ability to skip steps in backtesting HOT 6
- Bad error handling when Index is neither RangeIndex nor DateIndex HOT 3
- Why do i have faster runtime when using more frequent refits HOT 2
- syntax error !! HOT 1
- Feature request: Custom predictors for multivariate forecasting
- Series-specifc exogenous vars for ForecasterAutoregMultiSeries HOT 2
- add method to forecasters to return the input data that is passed to the model to make predictions HOT 1
- allow extraction of features from y
- Feature request: Allow the training set to be passed to custom error metrics HOT 2
- XGboost using GPU
- MissingValuesExogWarning despite no NaN HOT 1
- Fitted Values HOT 2
- Using skforecast with panel data HOT 5
- Disable progress bar HOT 1
- Time Series Differentiation not working as expected HOT 3
- ForecasterSarimax - AttributeError: 'PeriodIndex' object has no attribute 'step' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from skforecast.