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

Error while Trading Model example running #40

Open
snussik opened this issue Apr 15, 2021 · 1 comment
Open

Error while Trading Model example running #40

snussik opened this issue Apr 15, 2021 · 1 comment

Comments

@snussik
Copy link

snussik commented Apr 15, 2021

Describe the bug
While running the tutorial getting the error:

Traceback (most recent call last):
  File "/Users/snusik_zzz/GIT/ap/venv/bin/mflow", line 8, in <module>
    sys.exit(main())
  File "/Users/snusik_zzz/GIT/ap/venv/lib/python3.8/site-packages/alphapy/market_flow.py", line 435, in main
    model = market_pipeline(model, market_specs)
  File "/Users/snusik_zzz/GIT/ap/venv/lib/python3.8/site-packages/alphapy/market_flow.py", line 302, in market_pipeline
    run_analysis(a, lag_period, forecast_period, leaders, predict_history)
  File "/Users/snusik_zzz/GIT/ap/venv/lib/python3.8/site-packages/alphapy/analysis.py", line 270, in run_analysis
    analysis.model = main_pipeline(model)
  File "/Users/snusik_zzz/GIT/ap/venv/lib/python3.8/site-packages/alphapy/__main__.py", line 436, in main_pipeline
    model = training_pipeline(model)
  File "/Users/snusik_zzz/GIT/ap/venv/lib/python3.8/site-packages/alphapy/__main__.py", line 230, in training_pipeline
    model = sample_data(model)
  File "/Users/snusik_zzz/GIT/ap/venv/lib/python3.8/site-packages/alphapy/data.py", line 280, in sample_data
    X, y = sampler.fit_sample(X_train, y_train)
AttributeError: 'RandomUnderSampler' object has no attribute 'fit_sample'

Desktop:

  • OS: macOS 10.15.2

I think it should be X, y = sampler.fit_resample(X_train, y_train) in the data.py file

@ArjunWhabi
Copy link

Using the following dependencies versions helped.
I think in one of imblearn versions they changed the fit_sample to fit_resample

i receommend installing the following dependencies in a new vitual env because they can easily corrupt your current env

Name Version Build Channel

absl-py 0.15.0 pypi_0 pypi
alphapy 2.5.0 pypi_0 pypi
arrow 1.2.0 pypi_0 pypi
astunparse 1.6.3 pypi_0 pypi
backcall 0.2.0 pypi_0 pypi
bokeh 2.3.3 pypi_0 pypi
ca-certificates 2021.10.8 h5b45459_0 conda-forge
cachetools 4.2.4 pypi_0 pypi
category-encoders 2.3.0 pypi_0 pypi
certifi 2021.10.8 py38haa244fe_0 conda-forge
charset-normalizer 2.0.7 pypi_0 pypi
clang 5.0 pypi_0 pypi
colorama 0.4.4 pypi_0 pypi
console_shortcut 0.1.1 4
cycler 0.10.0 pypi_0 pypi
decorator 5.1.0 pypi_0 pypi
empyrical 0.5.5 pypi_0 pypi
flatbuffers 1.12 pypi_0 pypi
gast 0.4.0 pypi_0 pypi
google-auth 2.3.0 pypi_0 pypi
google-auth-oauthlib 0.4.6 pypi_0 pypi
google-pasta 0.2.0 pypi_0 pypi
grpcio 1.41.0 pypi_0 pypi
h5py 3.1.0 pypi_0 pypi
idna 3.3 pypi_0 pypi
iexfinance 0.5.0 pypi_0 pypi
imbalanced-learn 0.7.0 pypi_0 pypi
ipython 7.28.0 pypi_0 pypi
jedi 0.18.0 pypi_0 pypi
jinja2 3.0.2 pypi_0 pypi
joblib 1.1.0 pypi_0 pypi
keras 2.6.0 pypi_0 pypi
keras-layer-normalization 0.15.0 pypi_0 pypi
keras-preprocessing 1.1.2 pypi_0 pypi
kiwisolver 1.3.2 pypi_0 pypi
lxml 4.6.3 pypi_0 pypi
markdown 3.3.4 pypi_0 pypi
markupsafe 2.0.1 pypi_0 pypi
matplotlib 3.4.3 pypi_0 pypi
matplotlib-inline 0.1.3 pypi_0 pypi
numpy 1.19.5 pypi_0 pypi
oauthlib 3.1.1 pypi_0 pypi
openssl 3.0.0 h8ffe710_1 conda-forge
opt-einsum 3.3.0 pypi_0 pypi
packaging 21.0 pypi_0 pypi
pandas 1.3.4 pypi_0 pypi
pandas-datareader 0.10.0 pypi_0 pypi
parso 0.8.2 pypi_0 pypi
patsy 0.5.2 pypi_0 pypi
pickleshare 0.7.5 pypi_0 pypi
pillow 8.4.0 pypi_0 pypi
pip 21.3 pyhd8ed1ab_0 conda-forge
prompt-toolkit 3.0.20 pypi_0 pypi
protobuf 3.18.1 pypi_0 pypi
pyasn1 0.4.8 pypi_0 pypi
pyasn1-modules 0.2.8 pypi_0 pypi
pyfolio 0.9.2 pypi_0 pypi
pygments 2.10.0 pypi_0 pypi
pyparsing 2.4.7 pypi_0 pypi
python 3.8.12 h900ac77_2_cpython conda-forge
python-dateutil 2.8.2 pypi_0 pypi
python_abi 3.8 2_cp38 conda-forge
pytz 2021.3 pypi_0 pypi
pyyaml 6.0 pypi_0 pypi
requests 2.26.0 pypi_0 pypi
requests-oauthlib 1.3.0 pypi_0 pypi
rsa 4.7.2 pypi_0 pypi
scikit-learn 0.23.1 pypi_0 pypi
scipy 1.4.1 pypi_0 pypi
seaborn 0.11.2 pypi_0 pypi
setuptools 58.2.0 py38haa244fe_0 conda-forge
setuptools-scm 4.0.0 pyh9f0ad1d_0 conda-forge
six 1.15.0 pypi_0 pypi
sklearn 0.0 pypi_0 pypi
sqlite 3.36.0 h8ffe710_2 conda-forge
statsmodels 0.13.0 pypi_0 pypi
tensorboard 2.7.0 pypi_0 pypi
tensorboard-data-server 0.6.1 pypi_0 pypi
tensorboard-plugin-wit 1.8.0 pypi_0 pypi
tensorflow 2.6.0 pypi_0 pypi
tensorflow-estimator 2.6.0 pypi_0 pypi
termcolor 1.1.0 pypi_0 pypi
threadpoolctl 3.0.0 pypi_0 pypi
toml 0.10.2 pyhd8ed1ab_0 conda-forge
tornado 6.1 pypi_0 pypi
traitlets 5.1.0 pypi_0 pypi
typing-extensions 3.7.4.3 pypi_0 pypi
ucrt 10.0.20348.0 h57928b3_0 conda-forge
urllib3 1.26.7 pypi_0 pypi
vc 14.2 hb210afc_5 conda-forge
vs2015_runtime 14.29.30037 h902a5da_5 conda-forge
wcwidth 0.2.5 pypi_0 pypi
werkzeug 2.0.2 pypi_0 pypi
wheel 0.37.0 pyhd8ed1ab_1 conda-forge
wincertstore 0.2 py38haa244fe_1006 conda-forge
wrapt 1.12.1 pypi_0 pypi

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

2 participants