New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows 7 Install & Python 3.5 Upgrade - An Exciting Story [Solved] #3
Comments
This reply might be unuseful but, given the problems you reported:
In my case, those were the steps I took to have everything up and running on Ubuntu. In your case, you are using Windows but, given the fact that those steps aren't related to a specific system (the exception is the observation about the Tensorflow x Python compatibility on Windows), It should work fine. |
@GuilhermeCaeiro Thany you for your coment. The install processes and configurations are obviously different from Ubuntu and Mac. The main reason for this seems to be scipy which is a dependency of Keras and many other libraries. It has no descent windows support. This is described on there own website in parts here. This seems to be not fixed using 3rd-party bundles. Since I have a bunch of 3rd-party bundles on board now (several gigs), I will try it a last time with Anaconda/conda and report the errors back. |
I must admit that I never tried using Keras on Windows. But I already used the the jupyter notebook and, probably, scipy (I know I have it instaled on windows, but don't remember when it It was the last time I used It "directly" on Windows) without problems. |
Update: Hell I'm to old for this shit. Protocoll:
This does not work... ...continuing with a Python 2.7 branch... |
According to Tensorflow's documentation, on Windows, It only works on python 3.5. Use the MyLastTest (python 3.5) environment. Obs.: Don't give up. For me, It is always a pain in the ass to setup a proper environment too. :O |
@GuilhermeCaeiro Thank you so much for your guidance and useful advice's.
Any ideas? |
Did you include "Sequential" at the beginning of your code? |
I would say yes, it's in the original lstm.py... |
Try: I don't know if it is a Windows related problem and, unfortunately, I can't Test right now, because I'm on my phone right now. |
Hm the error comes and goes. Very strange, currently it's gone. I noticed that in the video Siray has a remark 'using TensorFlow backend' on the screen/in the browser. Do you know an easy way to change the backend to TensorFlow? I guess I saw a responding one-liner in one of Siray's other examples in another context- but I'm not sure if this is could help. Should/could I uninstall Theano? But then Keras will go away too. I'm so tired now...my live has no more sense...https://www.youtube.com/watch?v=y7EpSirtf_E |
Sorry for taking too long to answer... Today I had some time to test the code on Windows and, following your recipe (the list of things you installed), I got everything installed without errors. On the other hand, when I tried running the code, everything became a mess. Sometimes it would stuck and keep running forever during the training, other times it would execute the training "cell" (notebook cell) but wouldn't train anything and then get stuck at the predictions and, lastly, after I reset the notebook, it started raising errors in the "model" class, pointing that something was wrong with the Keras x Tensorflow compatibility.
You still have to make a few modification (change xrange to range and cast a value to int) in the code to make it work with Python 3, but those things are straightforward. Regarding the backend, the way (s) it can be changed can be found here: Now, I think you can be happy and try getting rich. :) Now, talking about a few curious things:
|
Very very interesting. I see hope and will give it a try.
Your last point would suggest to better use a dedicated OS for such calculations. If I get it running and start to understand that shit completely, I plan to make result comparisons between TensorFlow and Rapidminer. |
When I wrote "keras directory", I was talking about the folder you'll extract from the compacted file you'll download from keras repository. Regarding the errors, when you run the code (on jupyter), a few errors will show up in the lstm file, complaining about the things I mentioned before. When the error complains about "xrange", change It to "range", when the complaining is about passing a float to a function that expects integer, cast the value to an integer. Yes, if you want to use ML/AI professionaly, don't use VMs (unless that "VM" is an instance in the cloud - or somewhere else, properly set to deal with that task), because things might run extremely slow. Well, I must say that I'm a beginner on Neural Networks. Only a few weeks ago I started playing with It and, in the case of RNNs (LSTM), I'm having a hard time trying to do something useful with It. Regarding finance, my knowledge is near zero. Given this situation, I think I won't be able to do something more than help you getting things running. |
Thank you GuilhermeCaeiro, your advice's are informative as always. Well, I think there will be a ton of new things we can do with such approaches like RNN's, LSTM etc. I'm a free web- and app developer for a living since 20 years now. Finance is only one sector of this game. But if you understand everything of your ML stuff, the entry to this world is probably a little easier. Personally I don't do this. There would be much more to learn about chart techniques and fundamental data. And it needs a lot of money :-) Although there are some big sharks in this waters, ready to eat you. Some say, 'never try high frequency algo-trading as private person'. I saw a video where an expert tells interesting insider news about already launched quant-bots hunting amateur-algorithms, to take there money. Yes, algorithms are already fighting each other in the trading universe. And there is always a speed and knowledge-disadvantage regarding to big players- physically (special wires), systematically (special laws), digital (special software) and of course by money power (special budgets to buy early data, trade big stakes, hide identities, catch identities etc.). Since AI made a paradigm change with this relatively new approaches and everything becomes any kind of AI, this will be the next big innovation, after the 'cloud-hype' and the unlimited expansion of the JavaScript universe (my guess). I played with AI 10 years ago for a real customer online-support desk and I must say the new approaches are a game changer. Here are some very funny examples!: Danger, danger! 10 alarming examples of AI gone wild For me the beauty of this stuff is, if you understand ML completely, you can do everything. It only depends on your imagination. It's a kind of freedom and new inspiration for developers. Thank you so far...will try to get this beast running- once again. PS: I already have a running SVM customized for 'own' data (70% performance on up/down predictions), based on Rapidminer Studio (free edition). https://www.youtube.com/watch?v=w0vSSEq2bn0 (video is a little old) So the next logical step is to try RNN's and LSTM on TensorFlow. |
Update/Solution: Finally got it running (with your friendly help), although its output looks slightly different than the original. Anyways, I still have to learn, recap what does it mean in general :-). Protocol for Win7 users Short intro/recap... Standalone Requirements:
A)
B)
C) (MyLastTest)$ To see the errors, we start the notebook...
---Wow--- Credits are going to @GuilhermeCaeiro. He provided the crucial informations :-). PS: Meanwhile there is an official open pull request, for code modifications providing Python 3 compatibility. Since I'm not a Python-Guru, I highly recommend the pull request-version of the code modifications in Chapter "C)". |
ops I made too late a pull request to support python 3 :) |
Yours seems to be a bit different. Can you explain your approach. I'm totally new to Python :-)
You didn't cast to int. Am I right? What does '//' do? Update: The // operator is used for truncating division.
What is this for? Update: Checkpoints are temporary snapshots of your notebooks, Thank you. |
Hi the operator // does division an keeps it integer part. As example Also for the second I've just removed the temporary files from git. You got all the points by yourself :) Best, |
Update: Over night my Python-Version of the Env. seemed to be updated by itself to 3.6 where TensorFlow is not available for Windows. Update: Don't confound the environments. I turned it back with... And now I'm getting multiple, different outputs for the same data set. I'm getting crazy now... I can't believe it. Is this the end?Seems a little bit like... another hobby... |
Hello again! Regarding your problem with python, as far as I know, it doesn't upgrade itself automatically (and has no reason to do so). I think you probably did something that triggered that (if it really got "upgraded"). Anyway, don't keep more than one python version in an environment (unless needed), because it might mess up with your environment. Now, talking about your results, they are "right". Unfortunately, the data used for the example in this repository isn't enough to give you more accurate forecasts (given the nature of the stock prices, I could even say that those values themselves might not be a good indicator, if compared to sentiment and other things). The reason why the results differ from each other is the fact that the data is randomly shuffled before the training, what causes the "convergence" to happen in a different way each time. Given that situation, unless you improve your model (add more "knowledge" to it), it won't be useful at all (to be true, I don't even know if a simple mortal like me could create something "profitable"), but what you have now is probably a good starting point. |
Thank you GuilhermeCaeiro, |
Before giving you an answer, I must say that I MIGHT BE WRONG, given the fact that I'm new to neural networks and don't have much experience with machine learning (until now, the only things I have been using were linear and logistic regressions, and mostly for "classroom projects"). Now, trying to answer your questions:
Now, what I would suggest you is:
To finish, the code in this repository is based (basically, the same) on the code developed for the following article: |
Very resourceful ! So interesting ! Even after removed the "shuffle" (i.e. comment out "np.random.shuffle(train)" in load_data()), the output predication graph is still different each time I completely restart the whole linux machine. Is this normal ? And why ? |
It seems the initial state (i.e. weight, bias) for the RNN is different each time it runs "model.fit()", even it starts the linux machine from scratch each time. And, as we just did 1 epoch, so every time it comes up with different prediction result is normal .... Am I right ? |
Hello ckl8964, The most visible place where some kind of randomization happens is in the "dropout layer". If we consider the code as provided in this repository, when the data flows through that layer, 20% of the data is randomly "discarded", in order to prevent overfitting: One way to try reproducing a result is by setting a seed for the random number generator: I never used that though... so I don't know if it will work or not. |
@GuilhermeCaeiro Thank you for the infos. The Python - thing isn't such a big deal, since I already know 13 other languages. Python in one Hour with Derek Banas There is also a 'Python-preparation' course on Sirjas Udacy page (Chapter: PROGRAM SYLLABUS): The RNN/LSTM stuff seems to be much more complicated then my successfully adapted SVM with Rapidminer. I needed one week or so to understand and use it (with a little help)! I've seen the video from Jackob the author you mentioned before, but understood not much. So I booked a free online-course. Fingers crossed that this will help. PS: Now as you told us, I remember randomizations as tool from my times as student in Pychology/Statistics (long time ago) ;-). |
Thanks GuilhermeCaeiro ! Your response is always meaningful !! Yes, I start to recall some memory from the NN course long time ago in college. Have to make some revision and get more update from internet (and all of you here !). Thanks ! Interesting !! |
Does anybody knows a good link for notebook-convert instructions in one chapter? |
Thank you for the example. I get the following error:
Using Theano backend.
WARNING (theano.configdefaults): g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string.
File "C:\BrainPorn\How-to-Predict-Stock-Prices-Easily-Demo-master\lstm.py", line 17
print 'yo'
^
SyntaxError: Missing parentheses in call to 'print'
I'm more then confused.
I have Anaconda with a TensorFlow Env and a Keras lib.
But I can't start a notebook on the TensorFlow shell, so I start the notebook on the Anaconda shell, where the above output appears in the browser.
Who can provide a descent "how to start the example" (cross-platform or Win7)?
Update Day Two:
The environment of the example is not install able on Windows, so trying other ways.
Install native on Windows: Keras install failed, probably because of Scipy
Install Anaconda way: Keras install failed, Notebook showing up in Browser (incl. failed dependency Keras)
Install Docker way: Jupyter install failed...
Trying the docker way. Would be nice to have a container, so more people could follow.
I got a functional container with TensorFlow + Keras from here:
https://blog.thoughtram.io/machine-learning/2016/09/23/beginning-ml-with-keras-and-tensorflow.html
Now I have a running TensorFlow with Keras but no jupyter notebook option.
Unfortunately 'pip install jupyter' in the environment leads to errors too.
So still no success.
Does someone has a Docker container with TensorFlow + Keras + Jupitor Notebook?
Update: Found an all in one docker image here:
https://github.com/floydhub/dl-docker (Python2 and iTouch Kernel)
docker run -it -p 192.168.99.100:8888:8888 -p 192.168.99.100:6006:6006 -v /sharedfolder:/root/sharedfolder floydhub/dl-docker:cpu jupyter notebook
...does not show the example (empty notebook)...sadly giving up.
Update:
Turns out Docker on Win needs a special syntax....
docker run -it -p 192.168.99.100:8888:8888 -p 192.168.99.100:6006:6006 -v //c/Users//sharedfolder:/root/sharedfolder floydhub/dl-docker:cpu jupyter notebook
...finally does the trick....but after a while in the browser I get this:
The kernel has died, and the automatic restart has failed. It is possible the kernel cannot be restarted. If you are not able to restart the kernel, you will still be able to save the notebook, but running code will no longer work until the notebook is reopened.
What a disaster after such a long journey!!!
Which Kernel do we need?
The text was updated successfully, but these errors were encountered: