GithubHelp home page GithubHelp logo

Comments (4)

raghavbali avatar raghavbali commented on July 18, 2024 1

Hi @Noctem123 ,
Thank you for the feedback, we are glad the book is helpful.

Regarding the error, it is most probably due to difference in pandas/numpy version. You must be on a more latest version.
The issue can be fixed by replacing the error line by the following :

time_series = np.array(time_series).reshape(-1,1)
scaled_stock_series = scaler.fit_transform(time_series)

Let us know if this fix solves the issue, meanwhile we will work towards updating the code /documentation as per feasibility.

from practical-machine-learning-with-python.

 avatar commented on July 18, 2024

It worked! Thank you guys, you are the best!

from practical-machine-learning-with-python.

 avatar commented on July 18, 2024

I got the same type of error a little further in the code of sequence modeling, to be exact on this line:

trainPredict = scaler.inverse_transform(trainPredict.reshape(trainPredict.shape[1]))

saying:

ValueError: Expected 2D array, got 1D array instead:
array=[0.19647571 0.22339799 0.23686117 ... 0.22503245 0.22467923 0.22415847].
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.

Probably I will get it at the next line too:

testPredict = scaler.inverse_transform(testPredict.reshape(testPredict.shape[1]))

from practical-machine-learning-with-python.

raghavbali avatar raghavbali commented on July 18, 2024

Hey @Noctem123 ,
Thanks for pointing out. As noted in the earlier comment, the fix would be similar and the error is coming up due to different pandas versions in place.

We would update the code/documentation to note the versions used to avoid confusion.

Closing this for now.

from practical-machine-learning-with-python.

Related Issues (20)

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.