TradeMaster-NTU / TradeMaster

TradeMaster is an open-source platform for quantitative trading empowered by reinforcement learning :fire: :zap: :rainbow:
Apache License 2.0
1.35k stars 273 forks source link

Small Error in Tutorial 9: openfe() #170

Closed joshwigginton closed 1 year ago

joshwigginton commented 1 year ago

The following error could be specific to my environment but having issues with ofe = openfe()

Running the following code:

n_jobs=4 ofe = openfe() ofe.fit(data=X, label=Y, n_jobs=n_jobs) train_x, valid_x = transform(train_x, valid_x, ofe.new_features_list[:10], n_jobs=n_jobs) X, test_x = transform(X, test_x, ofe.new_features_list[:10], n_jobs=n_jobs)

**Gives this error:

TypeError Traceback (most recent call last) Cell In[5], line 179 176 Y = pd.DataFrame({"close": list(df_train['close'][1:])}) 178 n_jobs=4 --> 179 ofe = openfe() 180 ofe.fit(data=X, label=Y, n_jobs=n_jobs) 181 train_x, valid_x = transform(train_x, valid_x, ofe.new_features_list[:10], n_jobs=n_jobs)

TypeError: 'module' object is not callable

Change the import and code resolved the issue for me:

from openfe import OpenFE, transform

n_jobs=4 ofe = OpenFE() ofe.fit(data=X, label=Y, n_jobs=n_jobs) train_x, valid_x = transform(train_x, valid_x, ofe.new_features_list[:10], n_jobs=n_jobs) X, test_x = transform(X, test_x, ofe.new_features_list[:10], n_jobs=n_jobs)

jzmster1209 commented 1 year ago

Thank you for your notice! This tutorial 9 was uploaded 2 months ago, but OpenFE (https://github.com/IIIS-Li-Group/OpenFE) recently updated some of the documentation and code design. We have now changed the syntax to the latest version.