Documentation
¶
Overview ¶
qnetwork.go
replaybuffer.go
train.go
utils.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Activation ¶
Activation represents an activation function
type DQN ¶
type DQN struct {
// contains filtered or unexported fields
}
DQN represents the Deep Q-Learning algorithm.
func NewDQN ¶
func NewDQN(inputSize, hiddenSize, outputSize, bufferSize int, gamma, epsilon, learningRate float64, activation Activation) *DQN
NewDQN initializes a new DQN instance.
func (*DQN) EpsilonGreedyPolicy ¶
EpsilonGreedyPolicy selects an action using epsilon-greedy strategy.
type Experience ¶
Experience represents a single experience tuple.
type QNetwork ¶
type QNetwork struct {
// contains filtered or unexported fields
}
QNetwork represents a simple neural network for Q-value approximation.
func NewQNetwork ¶
func NewQNetwork(inputSize, hiddenSize, outputSize int, activation Activation) *QNetwork
NewQNetwork initializes a new QNetwork with random weights.
type ReplayBuffer ¶
type ReplayBuffer struct {
// contains filtered or unexported fields
}
ReplayBuffer stores experiences for training.
func NewReplayBuffer ¶
func NewReplayBuffer(size int) *ReplayBuffer
NewReplayBuffer initializes a new ReplayBuffer.
func (*ReplayBuffer) Add ¶
func (rb *ReplayBuffer) Add(exp Experience)
Add adds a new experience to the buffer.
func (*ReplayBuffer) Sample ¶
func (rb *ReplayBuffer) Sample(batchSize int) []Experience
Sample returns a batch of experiences.
Click to show internal directories.
Click to hide internal directories.