Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use Mamba for forecasting #14

Open
IsmailKhazi opened this issue Apr 16, 2024 · 18 comments
Open

How to use Mamba for forecasting #14

IsmailKhazi opened this issue Apr 16, 2024 · 18 comments

Comments

@IsmailKhazi
Copy link

Hello can you provide a Python Notebook for "How to do forecasting using Mamba?"

How to use Mamba to forecast and compare with LSTM, RNN also.

@wzhwzhwzh0921
Copy link
Owner

You can read Mamba's paper to learn the principles of Mamba Block. In fact, the input and output of Mamba Block are the same as those of classic RNN models such as LSTM and GRU. The input is the original tensor of the BLD shape, and the output is the hidden tensor (BLD Shape) corresponding to each position.

@IsmailKhazi
Copy link
Author

IsmailKhazi commented May 10, 2024 via email

@TomKoester
Copy link

An little example for forecasting in a notebook would be great @wzhwzhwzh0921

@IsmailKhazi
Copy link
Author

IsmailKhazi commented Jun 2, 2024 via email

@TomKoester
Copy link

The data preproccesing for excatly this model i cant help. I just build an Prototype of the iTransformer model last week for TSA.
For encode categorial data just encode it with numbers. If i get you problem right that would be something like bus:1 train:2 .... and after encoding you can normalize the data with sin/cos.

@IsmailKhazi
Copy link
Author

IsmailKhazi commented Jun 12, 2024 via email

@ericleonardo
Copy link

You can try Mambular (Mamba for Tabular data) new Python package ready to use:

https://github.com/basf/mamba-tabular

@IsmailKhazi
Copy link
Author

IsmailKhazi commented Jun 23, 2024 via email

@ericleonardo
Copy link

Yes, it is Mamba based. Take a look at the description and docs:
https://mambular.readthedocs.io/

Mambular is a Python package that brings the power of Mamba architectures to tabular data, offering a suite of deep learning models for regression, classification, and distributional regression tasks. Designed with ease of use in mind, Mambular models adhere to scikit-learn's BaseEstimator interface, making them highly compatible with the familiar scikit-learn ecosystem. This means you can fit, predict, and evaluate using Mambular models just as you would with any traditional scikit-learn model, but with the added performance and flexibility of deep learning.

@IsmailKhazi
Copy link
Author

IsmailKhazi commented Jun 23, 2024 via email

@ericleonardo
Copy link

Just read the docs. Regression:

https://mambular.readthedocs.io/en/latest/examples/regression.html

@IsmailKhazi
Copy link
Author

IsmailKhazi commented Jun 23, 2024 via email

@ericleonardo
Copy link

You can use the regression. In the train_test_split use shuffle=False to avoid leaking future samples in the training.
Please, show how your data is structured. The description you sent above is confused because mixed columns.
You can use print screen and paste here.

Name Description Data Type Example
service_date Date on which the trip took place. Service dates run from
around 2:00AM - 1:59:59AM Date 2019-12-31
route_id Route Id String 01

@TomKoester
Copy link

Is it also appliable for probalistic output to do multilabel classification? @ericleonardo

@ericleonardo
Copy link

Is it also appliable for probalistic output to do multilabel classification? @ericleonardo

You can try the Classification with multiclass output. In the example, it is used 4 classes:
https://mambular.readthedocs.io/en/latest/examples/classification.html

Generate target variable:
y = np.dot(X, coefficients) + np.random.randn(n_samples)
Convert y to multiclass by categorizing into quartiles
y = pd.qcut(y, 4, labels=False)

@TomKoester
Copy link

@ericleonardo Hey, thanks for the fast reply.
I think you got me wrong there, i need an probalistic output for each class for a mutlilabel prediction. That means each input can be more than just one class.
Example
Input Class1 Class2 Class3
19.6.24 1 0 1

@IsmailKhazi
Copy link
Author

IsmailKhazi commented Jun 23, 2024 via email

@ericleonardo
Copy link

@ericleonardo Hey, thanks for the fast reply. I think you got me wrong there, i need an probalistic output for each class for a mutlilabel prediction. That means each input can be more than just one class. Example Input Class1 Class2 Class3 19.6.24 1 0 1

I don't know if it will output class probabilities. You can ask the author:
https://github.com/basf/mamba-tabular

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants