AI4S2S / s2spy

A high-level python package integrating expert knowledge and artificial intelligence to boost (sub) seasonal forecasting
https://ai4s2s.readthedocs.io/
Apache License 2.0
20 stars 7 forks source link

RGDR class implementation #68

Closed BSchilperoort closed 2 years ago

BSchilperoort commented 2 years ago

This PR implements RGDR as a class, with the previously implemented DBSCAN functionality integrated into the class, and with plotting methods available for users to play with the RGDR configuration.

Note that this is a standalone implementation of RGDR, without any knowledge about splits/folds implemented explicitly.


Example:

from s2spy import RGDR
rgdr = RGDR(target_timeseries) # instantiate the class

# Fit & apply the RGDR clustering to the training data
clustered_train_data = rgdr.fit(precursor_field_train_data) 

# Apply the clustering to test data
clustered_test_data = rgdr.transform(precursor_field_test_data)

Closes #38

review-notebook-app[bot] commented 2 years ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

BSchilperoort commented 2 years ago

Hi Yang, thanks for the review. RGDR does feel cluttered, however it currently only contains the following;

I think the size and structure of the file is fine at the moment. We could move out the correlation method along with the pearsonr_nan function, but that would indeed be appropriate to do when implementing different correlation/regression methods.

We could refactor it to something like;

sonarcloud[bot] commented 2 years ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

94.9% 94.9% Coverage
0.0% 0.0% Duplication