Coder Social home page Coder Social logo

artificial-intelligence-with-python's Issues

python3 not found

for Python 3.6.3 to see version type "python --version", not "python3 --version"

No module named 'utilities'

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?

ch02/income_classifier throws bad_shape error

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 ()

data_multivar_nb.txt file for Naïve Bayes classifier

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..

Chapter 3. Random Forest Classifier.

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.

Ch 4: Building a classifier based on Gaussian Mixture Models

# 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>

fit() missing 1 required positional argument: 'y'

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.

error with naive_bayes.py

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?

OS error

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.

missing preprocessing.py

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."

true labels and pred labels

hi, i want to know the values substituted as true labels and pred labels ? How those values are taken?? Thanks

Running this prime.py script

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)

Artificial-Intelligence-with-Python/Chapter 03/code/traffic_prediction.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!

code error

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

chapter04 stocks.py matplotlib.finance removed

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.