Comments (4)
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.
It worked! Thank you guys, you are the best!
from practical-machine-learning-with-python.
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.
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)
- Showing error while importing arima-Utils ,lstm_utils HOT 3
- expand contractions is not working as expected HOT 1
- unable to install model_evaluation_utils HOT 9
- Index Error HOT 3
- Error in Accessing Layers of Word Embedding model HOT 1
- Easier way to download "en_vectors_web_lg" model in spacy HOT 1
- Requirements file
- Ch07 use contractions_dict instead of import CONTRACTION_MAP
- Very minor bug in contractions with "ain't"
- Chapter 8 - frequent_itemsets not defined
- Chapter 8 - NameError: name 'OneHot' is not defined
- TypeError: 'NoneType' object is not subscriptable HOT 1
- Chapter 11 - notebook_gold_forecast_arima.ipynb
- Practical machine learning
- Contractions bug HOT 1
- Chapter 9 error Tensorflow AttributeError: 'Sequential' object has no attribute 'predict_class' because predict_class() changed to predict() HOT 1
- Chapter 9 error in Sklearn "DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel(). y = column_or_1d(y, warn=True)" HOT 1
- datasets
- Chapter-3,Visualization using Matplotlib,page-170(Legends)
- Chapter 4 feature engineering numeric data notebook broken on GitHub HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from practical-machine-learning-with-python.