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

AttributeError: 'DecisionTreeClassifier' object has no attribute 'n_features_' #9

Open
TKSJ2020 opened this issue Jun 20, 2023 · 1 comment

Comments

@TKSJ2020
Copy link

Hello,

I installed whokaryote with conda and I am trying to run using this:
whokaryote.py --contigs /home/shishido/Lichen_data/Meta_omics2023/contigs/contigs_L10.fasta --outdir whokaryote_outputL10 --f --threads 10

But I am getting some error (below), could you please help me with what I should do?

Output directory is whokaryote_outputL10
Size-filtered contigs already exist. Using those.
Tiara prediction file already present.
Running prodigal...
Prodigal gene prediction successful. Saving gene coordinate file...
Gene coordinate file saved.
Gene prediction took 348.8451623916626 seconds.
Calculating gene structure features with gene predictions...
File extension: GFF
Calculating features successful.
Calculating gene structure features took 1.6910111904144287 seconds.
Predicting contig class...
Using model with tiara predictions to predict contig class...
Traceback (most recent call last):
File "/home/shishido/anaconda3/envs/whokaryote/bin/whokaryote.py", line 104, in
predict_class(feature_path, args.outdir, args.model)
File "/home/shishido/anaconda3/envs/whokaryote/lib/python3.8/site-packages/whokaryote_scripts/predict_class.py", line 90, in predict_class
predictions = loaded_rf.predict(features)
File "/home/shishido/anaconda3/lib/python3.8/site-packages/sklearn/ensemble/_forest.py", line 612, in predict
proba = self.predict_proba(X)
File "/home/shishido/anaconda3/lib/python3.8/site-packages/sklearn/ensemble/_forest.py", line 656, in predict_proba
X = self._validate_X_predict(X)
File "/home/shishido/anaconda3/lib/python3.8/site-packages/sklearn/ensemble/_forest.py", line 412, in validate_X_predict
return self.estimators
[0]._validate_X_predict(X, check_input=True)
File "/home/shishido/anaconda3/lib/python3.8/site-packages/sklearn/tree/classes.py", line 387, in validate_X_predict
if self.n_features
!= n_features:
AttributeError: 'DecisionTreeClassifier' object has no attribute 'n_features
'

@LottePronk
Copy link
Owner

I'm sorry for the late response, I've had some personal circumstances that prevented me from working for some time. I hope you managed to get Whokaryote to work in the meantime! If not, could you please give me some more information? How many contigs did you end up using, and what is their minimum length? I usually see this error when there are not enough contigs left to do calculations on, or if the contigs contain only 1 gene or less because they are so short. You could try to check the feature table file to see if this is the case.

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