By executing code similar to the following in PyCharm
from sklearn import svm
xor_data = [
P,Q,result
[0, 0, 0],
[0, 1, 1],
[1, 0, 1],
[1, 1, 0]
]
data = [ ]
label = [ ]
for row in xor_data:
p=row[0]
q = row[1]
r=row[2]
data.append([p,q])
label.append(r)
clf = svm.SVC()
clf.fit (data, label)
pre=clf.predict(data)
print("Predicted Results:", pre)
ok = 0; total = 0
for idx, answer in enumerate (label):
p=pre[idx]
ifp==answer: ok+=1
total + = 1
print("correct answer rate:",ok,"/",total,"=",ok/total)
The following error will appear:
C:\Users\000\PycharmProjects\test1\venv\Scripts\python.exe C:/Users/000/PycharmProjects/test1/hello.py
Traceback (most recent call last):
File "C:/Users/ 〇 //PycharmProjects/test1/hello.py", line 1, in <module>
from sklearn import svm
File "C:\Users\000\PycharmProjects\test1\venv\lib\site-packages\sklearn\init.py", line 134, in <module>
from.base import clone
File "C:\Users\000\PycharmProjects\test1\venv\lib\site-packages\sklearn\base.py", line 11, in <module>
from scope import sparse
ModuleNotFoundError: No module named 'scipy'
Process finished with exit code 1
What should I do?
python python3 anaconda scikit-learn
I simply did not install scipy.I'm sorry.
579 Understanding How to Configure Google API Key
577 Who developed the "avformat-59.dll" that comes with FFmpeg?
585 PHP ssh2_scp_send fails to send files as intended
624 Uncaught (inpromise) Error on Electron: An object could not be cloned
617 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.