AI4Finance-Foundation / AI4Finance-Foundation/ElegantRL

A qusetion about the code of 'ActorSAC' class in net.py

Đang mở
#296 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
dicussion
Ngôn ngữ chính
Python
Star
4.4k
Fork
978
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I'm confused why we use 'logprob = dist.log_prob(a_avg)' instead of 'logprob = dist.log_prob(action)' in line 247 of elegantrl/agents/net.py. I think the latter is consistent to the original paper. Is using the former better in experiment?

````
def get_action_logprob(self, state):
state = self.state_norm(state)
s_enc = self.net_s(state) # encoded state
a_avg, a_std_log = self.net_a(s_enc).chunk(2, dim=1)
a_std = a_std_log.clamp(-16, 2).exp()
dist = Normal(a_avg, a_std)
action = dist.rsample()
action_tanh = action.tanh()
logprob = dist.log_prob(a_avg)
logprob -= (-action_tanh.pow(2) + 1.000001).log() # fix logprob using the derivative of action.tanh()
return action_tanh, logprob.sum(1)
````

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.