Deep Learning project build from scratch: Stock Predictor (1)
Why we’re starting this project, how we gonna do it, and what will we produce?
Day 1: Application Development — Front-end
A. Preface
For all the seekers aiming to find some instant answers for your development — this is not for you. This series is not denoted as hands-on articles that teaches you to build your deep learning project without meandering divergence which must be worth recorded. This is exactly why we are starting this project. We see development as a journey, maybe a super meandering one. We believe that this trail-and-error journey is worth recording by our own words, and hope this series of articles may help you through the tough days.
When you fail, hope these articles will sent a message for us: You are not alone, we’ve got your back. Try again.
To make the series more likely to be like most of the beginners in development of software, we choose to develop an application which we are lack of experience. We choose to be recording the REAL error we had made, some may be extremely stupid, but that’s simply why we are producing this. If there is anything you want to say, please leave a comment below. We will be grateful to answer your questions or have some chat with you.
Anyway, let us begin.
B. Plan
First, let us talk about how we structure our developing plan.
1. Application (Front-end)
2. Data storage (Back-end)
3. Deep learning Model (Analysis)
These three components will provide basic operation of our scheme. The developing order is decided to be 1–2–3. The model comparison part will be included after the first prototype be finished. By the way, the development due is set at 13/09/20 in the first place.
C. Developing Application (Front-end)
a. Environment
We are used to pick Python3 for our developing language. Therefore, to make our lives easier, we tend to use Python3 to construct the front-end application this time. On the other hand, using Python3 is for the better integration to our deep learning model. Comparing between Tkinter, PyGame, PyQt5 these three application developing frameworks, we choose PyQt5 to take the advantage for crossing platforms.
First, install PyQt5 and link it to PyCharm (step-by-step linking process). If you are interrupted by the error in figure 1, you could install Microsoft C++ Build Tools at the beginning, and download MSVC v140 VS 2015 C++ in the Individaul Components and click Modify (see Fig.2). There is something worth mentioning here: when create a new PyCharm project, you must choose the right Base interpreter — the python under Anaconda3! By the right selection, the package installing by pip can be paired. (To know the path of pip, key in: pip show pip in the Command Prompt, showed in Fig.3)
If the installing process is all done but your Qt Designer cannot be initialized (like me), you may duplicate plugins folder in the pyqt5_tools to Bin (see Fig.4). (The problem may be your designer.exe is in pyqt5_tools/Qt/Bin.)
Then we’re finish with the environment.
b. Test
Next, let us do some exercises. If we want to plug a display button, first create a Main Window (Fig.5), then dash a Push Button and Label from toolbar at the right-hand side on the table. You can change the objectName to pushButton (Fig.6).
Next, to archive more efficiently, the .py file need to be rewrite by UI file. To make this happen, select the archive path to the project, the .ui file will be constructed automatically. Then, right click the .ui file, select PyUIC to get a .py file. (Fig.7) Then we’re done.
The following is the content of .py file:
But our main program cannot be written in this .py file. Otherwise, every update will be rewrite! Create a new Function.py, then we can make the button we have crated display text.
The following are the codes in Function.py:
Finally, let’s run our Function.py. (Fig.8)
Work complete.
In the next article, we will practice more on the Qt Designer.
If you like this article, you know what to do, just smash the follow button and leave a comment below.
We’re Craig & Jason, see you next time.