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

Getting error while running the code al.py #1

Closed
rkchaitu87 opened this issue Mar 2, 2021 · 1 comment
Closed

Getting error while running the code al.py #1

rkchaitu87 opened this issue Mar 2, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@rkchaitu87
Copy link

Hi! I tried to run the code but got some issues. Can you help me how to run the code. I am interested to work in this area.
Version:
Python: Python 3.7.1
Scikit-learn : 0.23.2
Numpy: 1.19.2
Joblib: 0.17.0

Run command:
python al.py --data data files data
I tried python al.py --data data also
The data file I'm using is the same file given in repository

Error:
Traceback (most recent call last):
File "al.py", line 566, in
main(sys.argv)
File "al.py", line 561, in main
train_model()
File "al.py", line 442, in train_model
cf.clf.fit(cf.data, cf.labels)
File "C:\Users\hp.conda\envs\tensorflow_env\lib\site-packages\sklearn\ensemble_forest.py", line 304, in fit
accept_sparse="csc", dtype=DTYPE)
File "C:\Users\hp.conda\envs\tensorflow_env\lib\site-packages\sklearn\base.py", line 432, in _validate_data
X, y = check_X_y(X, y, **check_params)
File "C:\Users\hp.conda\envs\tensorflow_env\lib\site-packages\sklearn\utils\validation.py", line 72, in inner_f
return f(**kwargs)
File "C:\Users\hp.conda\envs\tensorflow_env\lib\site-packages\sklearn\utils\validation.py", line 802, in check_X_y
estimator=estimator)
File "C:\Users\hp.conda\envs\tensorflow_env\lib\site-packages\sklearn\utils\validation.py", line 72, in inner_f
return f(**kwargs)
File "C:\Users\hp.conda\envs\tensorflow_env\lib\site-packages\sklearn\utils\validation.py", line 623, in check_array
"if it contains a single sample.".format(array))
ValueError: Expected 2D array, got 1D array instead:
array=[].
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.

The error showing the data needs to be in 2D format. How to do that? Please help.

@cppbari cppbari added the bug Something isn't working label Mar 2, 2021
@cppbari
Copy link
Contributor

cppbari commented Mar 2, 2021

I was able to reproduce your error and found where the issue was. The bugfix has been made and pushed to the repo. Please pull the latest version and it should start working properly.

@cppbari cppbari closed this as completed Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants