Closed ryanskiba closed 2 months ago
@ryanskiba ^^ fully agree. I just reported that comment to GitHub Support. Sorry about that!
Thanks for opening this issue. It looks like you are using the Command Line Interface syntax correctly but in a jupyter notebook possibly? Please refer to our Naive Bayes Tutorial for more detail than the ReadTheDocs page, and let us know if this is still not resolved. Thanks.
@HaleySchuhl Yes, I'm using it in a jupyter notebook. Is there a better way to do it? And I copied the code straight from that link, but I wish there was a Binder or something where I could see the script in action. Thanks!
I think you can add an exclaimation point in front of the command to run it in Jupyter.
!plantcv-train naive_bayes_multiclass --file pixelinspectdata.txt --outfile naive_bayes_pdfs.txt --plots
I get this output after adding the exclamation point.
'plantcv-train' is not recognized as an internal or external command, operable program or batch file.
You could also try the notebook version of the command: plantcv.learn.naive_bayes_multiclass(input, output)
This has worked for me within a Jupyter notebook.
@k034b363 After trying that I get "NameError: name 'plantcv' is not defined"
I think that's because you have imported plantcv as pcv
, so it would actually be: pcv.learn.naive_bayes_multiclass(input, output)
Failed again...
AttributeError Traceback (most recent call last) Cell In[6], line 1 ----> 1 pcv.learn.naive_bayes_multiclass(pixelinspectdata.txt, naive_bayes_pdfs.txt)
AttributeError: module 'plantcv.plantcv' has no attribute 'learn'
Oops, sorry, that's my bad, you actually have to add an import: from plantcv import learn
and then the command is just: learn.naive_bayes_multiclass(pixelinspectdata.txt, naive_bayes_pdfs.txt)
.
And those in/out files will have to be string paths for the non-command line version, of course.
@k034b363 Thank you so much, that worked! I appreciate all your help!
Thanks again for opening this issue. It seems totally valuable to document this syntax. I will open a new issue to add this to our development to-do list, and will close this issue in the meanwhile. Please feel free to reopen with anything further though!
Describe the bug When I attempt to create a PDF using "plantcv-train" I get a syntax error that just tells me my syntax is invalid.
To Reproduce The code I ran: import numpy as np import argparse import os import sys import cv2 from matplotlib import pyplot as plt import pandas as pd print("All modules loaded")
%matplotlib widget from plantcv import plantcv as pcv from plantcv.parallel import WorkflowInputs
plantcv-train naive_bayes_multiclass --file pixelinspectdata.txt --outfile naive_bayes_pdfs.txt --plots
Cell In[3], line 1 plantcv-train naive_bayes_multiclass --file pixelinspectdata.txt --outfile naive_bayes_pdfs.txt --plots ^ SyntaxError: invalid syntax
Expected behavior naive_bayes_pdfs.txt is output.
Local environment (please complete the following information):
Additional context I made sure the tab-delimited .txt file was in the active directory. In the same notebook I have been cropping and color-correcting images using plantcv without issue. I haven't been able to find a tutorial on using plantcv-train like there is for color correcting and cropping.