packtpublishing / artificial-intelligence-with-python Goto Github PK
View Code? Open in Web Editor NEWCode repository for Artificial Intelligence with Python, published by Packt
License: MIT License
Code repository for Artificial Intelligence with Python, published by Packt
License: MIT License
This is not working. The entire book is based on line 5, so I cannot proceed. Utilities module does not exist. Can someone please tell me what's wrong?
for Python 3.6.3 to see version type "python --version", not "python3 --version"
I am attempting Logistic Regression classifier. I'm in Spyder/Anaconda so I can edit. I get error: no module named 'utilities'. What's wrong?
In [3]: runfile('C:/Users/Phil/src/Python/Artificial-Intelligence-with-Python/Chapter 02/code/income_classifier.py', wdir='C:/Users/Phil/src/Python/Artificial-Intelligence-with-Python/Chapter 02/code')
Reloaded modules: utilities
F1 score: 70.82%
Traceback (most recent call last):
File "", line 1, in
runfile('C:/Users/Phil/src/Python/Artificial-Intelligence-with-Python/Chapter 02/code/income_classifier.py', wdir='C:/Users/Phil/src/Python/Artificial-Intelligence-with-Python/Chapter 02/code')
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 710, in runfile
execfile(filename, namespace)
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 101, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/Phil/src/Python/Artificial-Intelligence-with-Python/Chapter 02/code/income_classifier.py", line 78, in
input_data_encoded[i] = int(label_encoder[count].transform(input_data[i]))
File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\preprocessing\label.py", line 128, in transform
y = column_or_1d(y, warn=True)
File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\utils\validation.py", line 614, in column_or_1d
raise ValueError("bad input shape {0}".format(shape))
ValueError: bad input shape ()
Page 67
from sklearn import cross_validation
Get an import error, looks like it is deprecated.
hello, thanks to authors,Am new to artificial intelligence using python & i'am using this book as my guide, i am learning how Naïve Bayes classifier works,the input file data_multivar_nb.txt is not provided.. i have searched via web but i couldn't get help,so am reaching out for the link so that i can download the file..
file: random_forests.py
I'm getting the following error:
usage: random_forests.py [-h] --classifier-type {rf,erf}
random_forests.py: error: the following arguments are required: --classifier-type
What should I do? Thanks in advance.
# Draw boundaries
plt.figure()
colors = 'bgr'
for i, color in enumerate(colors):
# Extract eigenvalues and eigenvectors
eigenvalues, eigenvectors = np.linalg.eigh(
classifier._get_covars()[i][:2, :2])
Output
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-34-c243fd25d6f3> in <module>
5 # Extract eigenvalues and eigenvectors
6 eigenvalues, eigenvectors = np.linalg.eigh(
----> 7 classifier._get_covars()[i][:2, :2])
AttributeError: 'GaussianMixture' object has no attribute '_get_covars'
<Figure size 432x288 with 0 Axes>
code: classifier.fit(X, y)
TypeError Traceback (most recent call last)
in
1 #Тренировка классификатора
----> 2 classifier.fit(X, y)
TypeError: fit() missing 1 required positional argument: 'y'
And please post the package versions for installation via pip.
I'm using pycharm, and when running the program, it sends the following error message: "ImportError: cannot import name 'cross_validation' from 'sklearn' "
Which command replaced the cross_validation function?
I'm getting this error when I run the code same with regressor_multivar.py
PS E:\Python> & C:/Users/rickz/anaconda3/python.exe "e:/Python/Artificial-Intelligence-with-Python/Chapter 02/code/regressor_singlevar.py"
Traceback (most recent call last):
File "e:/Python/Artificial-Intelligence-with-Python/Chapter 02/code/regressor_singlevar.py", line 12, in
data = np.loadtxt(input_file, delimiter=',')
File "C:\Users\rickz\AppData\Roaming\Python\Python37\site-packages\numpy\lib\npyio.py", line 981, in loadtxt
fh = np.lib._datasource.open(fname, 'rt', encoding=encoding)
File "C:\Users\rickz\AppData\Roaming\Python\Python37\site-packages\numpy\lib_datasource.py", line 269, in open
return ds.open(path, mode, encoding=encoding, newline=newline)
File "C:\Users\rickz\AppData\Roaming\Python\Python37\site-packages\numpy\lib_datasource.py", line 623, in open
raise IOError("%s not found." % path)
OSError: data_singlevar_regr.txt not found.
There is no preprocessing.py in "Chapter 02" or any other chapters of the downloaded code. In the Safari Books Online ebook at the end of chapter 2 [Preprocessing data]: "The code for this entire section is given in the preprocessing.py file."
hi, i want to know the values substituted as true labels and pred labels ? How those values are taken?? Thanks
I'm running into errors running this python script located here https://github.com/PacktPublishing/Artificial-Intelligence-with-Python/blob/master/Chapter%2006/code/prime.py
I'm also using this python logpy script found here https://github.com/MHordecki/LogPy
This is the error i receive when I try to run it. Please see below. Any suggestions on what I can be doing wrong. I'm new to python coding.
Traceback (most recent call last):
File "C:\Users\user022\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.11\prime.py", line 2, in
import logpy.core as lc
File "C:\Users\user022\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.11\logpy.py", line 11, in
from collections import Sequence
ImportError: cannot import name 'Sequence' from 'collections' (C:\Users\user022\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.11\collections_init_.py)
Good Day!
Hi, i have a problem in line #52 of traffic_prediction.py. Please, you can help me to resolve this error?
test_datapoint_encoded[i] = int(label_encoder[count].transform(test_datapoint[i]))
File "C:\Python35\lib\site-packages\sklearn\preprocessing\label.py", line 128, in transform
y = column_or_1d(y, warn=True)
File "C:\Python35\lib\site-packages\sklearn\utils\validation.py", line 614, in column_or_1d
raise ValueError("bad input shape {0}".format(shape))
ValueError: bad input shape ()
Best Regards!
I getting equal results with with using recall_weighted and precision_weighted scorers. What can I do for fix it and get results as in a book? Links for mine and original codes below.
My code , Original code
Ty u all
when I run chapter 14 vector_quantizer.py,it have the following error message
Error: slice indices must be integers or None or have an index method
when run to the following code
nn = nl.net.newlvq(nl.tool.minmax(data), num_input_neurons, weights
When running python stocks.py
in Chapter 04, it prints:
Traceback (most recent call last):
File "stocks.py", line 7, in <module>
from matplotlib.finance import quotes_historical_yahoo_ochl as quotes_yahoo
ModuleNotFoundError: No module named 'matplotlib.finance'
It seems matplotlib.finance
has been removed from matplotlib
and trasferred to mpl_finance. Moreover, quotes_historical_yahoo_ochl
is no longer available in this package due to frequent changes of Yahoo API.
I wonder if you could provide an alternative way to get the stock quotes data, so that the file can be correctly run.
Thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.