Policy Heatmap Calculator

Visualize deterministic and stochastic policies, analyze Q-values, entropy, confidence, rewards, and policy changes across customizable reinforcement learning environments with interactive exports and diagnostics instantly.

Policy analysis results
Usable states
0
Average entropy
0
Average confidence
0%
Changed policy states
0%
Estimated policy return
Expected steps
Tied states
0
Policy agreement

Diagnostics

  • Generate or import a policy to see diagnostics.

Policy matrix

No policy calculated yet.

Calculated state results

State Row Column Selected action Action probability Maximum Q-value State value Reward Entropy Confidence Status Previous action Changed
Environment and policy configuration
Heatmap appearance
State editor

Enter Q-values and probabilities in the same action order shown above the table. Separate values with commas.

Action order: Up, Right, Down, Left
State Row Column Reward State value Visits Status Q-values Probabilities
Import, comparison, and policy evolution

Bulk policy import

Baseline comparison


Policy evolution controls

Formula used
Greedy policy: π(s) = arg maxₐ Q(s,a) Epsilon-greedy: π(a|s) = 1 - ε + ε/|A| for greedy actions π(a|s) = ε/|A| for other actions Softmax: π(a|s) = exp(Q(s,a)/τ) / Σᵦ exp(Q(s,b)/τ) Policy entropy: H(π(·|s)) = -Σₐ π(a|s) log₂ π(a|s) Confidence: C(s) = maxₐ π(a|s) Policy change: Change(s) = 1 when current action differs from baseline action One-step policy improvement: Qₙₑw(s,a) = (1 - α)Q(s,a) + α[r(s′) + γV(s′)]
How to use
  1. Choose grid dimensions and the available action set.
  2. Select a policy rule, exploration rate, and temperature.
  3. Build the grid, then edit rewards, values, statuses, Q-values, and probabilities.
  4. Select the heatmap metric and display options.
  5. Calculate the policy to view arrows, diagnostics, tables, and summary metrics.
  6. Snapshot a baseline to compare action changes and agreement.
  7. Use evolution controls to apply repeated policy-improvement steps.
  8. Export the report, chart, CSV, JSON, or PDF.
Example data
State Reward Status Q-values: Up, Right, Down, Left
S0 -0.04 Start 0.20, 0.65, 0.10, 0.05
S3 1.00 Goal 0, 0, 0, 0
S5 0 Obstacle 0, 0, 0, 0
S7 -1.00 Terminal 0, 0, 0, 0
Frequently asked questions

What does a policy heatmap show?

It shows the preferred action for each environment state. Colors can represent Q-values, rewards, entropy, confidence, values, visits, or policy changes.

How are greedy actions selected?

The calculator selects actions having the largest Q-value. Ties can show every optimal action, choose the first, or choose randomly.

What is policy confidence?

Confidence is the largest action probability within a state. Higher confidence indicates a more decisive policy distribution.

What does high policy entropy mean?

High entropy means action probabilities are broadly distributed. The policy is more uncertain or exploratory in that state.

Can stochastic policies be displayed?

Yes. Enter action probabilities or use epsilon-greedy and softmax conversion. Secondary actions can appear above a probability threshold.

How does the baseline comparison work?

A baseline stores earlier selected actions. The calculator then reports changed states, agreement, and a policy difference heatmap.

What does the evolution step calculate?

It applies a one-step reward and discounted-value update. This demonstrates repeated policy improvement within the configured grid.

How are obstacles handled?

Obstacle cells are excluded from policy calculations and rendering values. Movement into obstacles follows the selected boundary behavior.

Can I import policies from another tool?

Yes. Import JSON or CSV containing states, rewards, values, visits, statuses, Q-values, and action probabilities.

Which reinforcement-learning methods are supported?

The visualization accepts policies from Q-learning, SARSA, policy iteration, value iteration, Monte Carlo, actor-critic, and custom methods.

Related Calculators

Episode Reward CurveAverage Reward CurveEpisode Length PlotExploration Rate CurveValue Function HeatmapQ-Value PlotState-Transition DiagramRegret CurveSuccess Rate Curve

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.