hungchun-lin / Stock-price-prediction-using-GAN

In this project, we will compare two algorithms for stock prediction. First, we will utilize the Long Short Term Memory(LSTM) network to do the Stock Market Prediction. LSTM is a powerful method that is capable of learning order dependence in sequence prediction problems. Furthermore, we will utilize Generative Adversarial Network(GAN) to make the prediction. LSTM will be used as a generator, and CNN as a discriminator. In addition, Natural Language Processing(NLP) will also be used in this project to analyze the influence of News on stock prices.
MIT License
227 stars 102 forks source link

Outstanding project + a naive comment #7

Open limoon20 opened 3 years ago

limoon20 commented 3 years ago

Hello Hungchun, thank you for sharing this outstanding tool. I have added two lines to your code (in my PC, do not panic :-) ) data_preprocessing.py, i.e. np.save('test_predict_index.npy', test_predict_index) np.save('train_predict_index.npy', train_predict_index) Because, "baseline_LSTM.py" was complaining that it could not find them. Please, let me know if there is a more elegant way to solve this issue. Thank you for your time, LM

IWantDayDayUp commented 3 years ago

Hello Hungchun, thank you for sharing this outstanding tool. I have added two lines to your code (in my PC, do not panic :-) ) data_preprocessing.py, i.e. np.save('test_predict_index.npy', test_predict_index) np.save('train_predict_index.npy', train_predict_index) Because, "baseline_LSTM.py" was complaining that it could not find them. Please, let me know if there is a more elegant way to solve this issue. Thank you for your time, LM

Hi, dear limoon20 May i ask you a question, please? I have downloaded this source code and tested it on my PC. But , there is a problem which is located on {4.Basic_GAN.py, function: ''train_step(self, real_x, real_y, yc)'', line no.83}. The error information is :"Input 'b' of 'MatMul' Op has type float32 that does not match type float64 of argument 'a'." And i don't know how to fix it. Have you encountered a similar problem when you run 4.Basic_GAN.py? Thank you very much.

limoon20 commented 3 years ago

 

Hi,

no, I did not see those error messages in my runs.

But, I get a couple of warnings related with CUDA, tensorflow and my NVIDIA drivers.

It is my PC, not Hungchun's code.

The second one is:

"Gtk-Message: 08:44:36.294: GtkDialog mapped without a transient parent. This is discouraged."

However, the code runs fine and I can see the plots of the D_, and G_losses, and the result of the training, i.e. "Real and Predicted Price versus Date".

Cordially,

LM

 

P.S. I suggest you to open a new case in "Issues".

 

Sent: Friday, May 14, 2021 at 12:38 AM From: "再也不敢" @.> To: "hungchun-lin/Stock-price-prediction-using-GAN" @.> Cc: "limoon20" @.>, "Author" @.> Subject: Re: [hungchun-lin/Stock-price-prediction-using-GAN] Outstanding project + a naive comment (#7)

 

Hello Hungchun, thank you for sharing this outstanding tool. I have added two lines to your code (in my PC, do not panic :-) ) data_preprocessing.py, i.e. np.save('test_predict_index.npy', test_predict_index) np.save('train_predict_index.npy', train_predict_index) Because, "baseline_LSTM.py" was complaining that it could not find them. Please, let me know if there is a more elegant way to solve this issue. Thank you for your time, LM

Hi, dear limoon20 May i ask you a question, please? I have downloaded this source code and tested it on my PC. But , there is a problem which is located on {4.Basic_GAN.py, function: ''train_step(self, real_x, real_y, yc)'', line no.83}. The error information is :"Input 'b' of 'MatMul' Op has type float32 that does not match type float64 of argument 'a'." And i don't know how to fix it. Have you encountered a similar problem when you run 4.Basic_GAN.py? Thank you very much.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

IWantDayDayUp commented 3 years ago

@limoon20 I think it is my PC python environment that is not suitable for the code.

Could you share the 'requirments.txt' with me so that I can get right environmental to run the code? If you can, please contact me with the email: xuem7294@gmail.com. Thanks in advance.

limoon20 commented 3 years ago

I am running Hungchun's codes with Python3.9.

Sometimes (with other codes) I have to run them with P. 3.6 or even 2.x.

So try different versions. But, make sure that the rest of the packages are compatible (or installed) with the same version.

Good luck,

LM

   

Sent: Friday, May 14, 2021 at 11:21 PM From: "再也不敢" @.> To: "hungchun-lin/Stock-price-prediction-using-GAN" @.> Cc: "limoon20" @.>, "Mention" @.> Subject: Re: [hungchun-lin/Stock-price-prediction-using-GAN] Outstanding project + a naive comment (#7)

 

@limoon20 I think it is my PC python environment that is not suitable for the code.

Could you share the 'requirments.txt' with me so that I can get right environmental to run the code? If you can, please contact me with the email: @.*** Thanks in advance.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

IWantDayDayUp commented 3 years ago

@limoon20 I can’t tell you how grateful I am. How can I thank you enough ! The code is working perfectly. Thank you again.

thedarkrider69 commented 3 years ago

hi everyone

you need to import os and select the directory wich contain your data,

add this

import os os.chdir("write here path")

see u

Liuyiben commented 3 years ago

@IWantDayDayUp 你好,我运行代码也遇到了跟你一样的错误,你是如何解决的,求告知,万分感谢!!

IWantDayDayUp commented 3 years ago

你好, 最近没看邮箱, 不好意思

代码是可以正常运行的, 我用的环境是 python 3.6和3.8 睡一觉起来就能正常运行(狗头) 我其实没做啥, 很抱歉没有实质性的解决方法 建议换python版本多试几次 祝好运

------------------ 原始邮件 ------------------ 发件人: "hungchun-lin/Stock-price-prediction-using-GAN" @.>; 发送时间: 2021年10月26日(星期二) 晚上8:26 @.>; @.**@.>; 主题: Re: [hungchun-lin/Stock-price-prediction-using-GAN] Outstanding project + a naive comment (#7)

@IWantDayDayUp 你好,我运行代码也遇到了跟你一样的错误,你是如何解决的,求告知,万分感谢!!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

Liuyiben commented 3 years ago

哈哈,谢谢,我已经解决了。请问你们通过添加强化学习超参数优化的这个问题解决了吗?如果解决了能否分享下代码,万分感谢!!

------------------ 原始邮件 ------------------ 发件人: "hungchun-lin/Stock-price-prediction-using-GAN" @.>; 发送时间: 2021年10月31日(星期天) 中午1:17 @.>; @.**@.>; 主题: Re: [hungchun-lin/Stock-price-prediction-using-GAN] Outstanding project + a naive comment (#7)

你好, 最近没看邮箱, 不好意思

代码是可以正常运行的, 我用的环境是 python 3.6和3.8 睡一觉起来就能正常运行(狗头) 我其实没做啥, 很抱歉没有实质性的解决方法 建议换python版本多试几次 祝好运

------------------ 原始邮件 ------------------ 发件人: "hungchun-lin/Stock-price-prediction-using-GAN" @.>; 发送时间: 2021年10月26日(星期二) 晚上8:26 @.>; @.**@.>; 主题: Re: [hungchun-lin/Stock-price-prediction-using-GAN] Outstanding project + a naive comment (#7)

@IWantDayDayUp 你好,我运行代码也遇到了跟你一样的错误,你是如何解决的,求告知,万分感谢!!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

nikeybanna commented 2 years ago

Hello @limoon20 I have certain error in running the code in 4.Basic_GAN.py

when running this code

if name == 'main': input_dim = X_train.shape[1] feature_size = X_train.shape[2] output_dim = y_train.shape[1]

For Bayesian

opt = {"lr": 0.00016, "epoch": 165, 'bs': 128} generator = make_generator_model(X_train.shape[1], output_dim, X_train.shape[2]) discriminator = make_discriminator_model() gan = GAN(generator, discriminator, opt) Predicted_price, Real_price, RMSPE = gan.train(X_train, y_train, yc_train, opt)

error showing AttributeError Traceback (most recent call last) ~\AppData\Local\Temp/ipykernel_1848/1524428345.py in 4 discriminator = make_discriminator_model() 5 gan = GAN(generator, discriminator, opt) ----> 6 Predicted_price, Real_price, RMSPE = gan.train(X_train, y_train, yc_train, opt)

AttributeError: 'GAN' object has no attribute 'train'

please provide me solution or give the link of your project so that I can see the code and built the model on my pc

sealovecosmos commented 2 months ago

你们好,我想问一下,yc在程序中,目的是做什么的?