TroglodyteDerivations
commited on
Commit
•
2cffe87
1
Parent(s):
d2de365
Updated lines 348-382 with: # Visualization with the origin initializing at the top-left corner # Goal tiles should appear on the bottom right at two sets of coordinates located at (4,5) and (5,4) # Aggregate the data to count the number of visits to each State_2D visitation_counts = df['State_2D'].value_counts().reset_index() visitation_counts.columns = ['State_2D', 'Visitation_Count'] # Clean the State_2D column to remove any extra characters or spaces visitation_counts['State_2D'] = visitation_counts['State_2D'].str.replace(r'[^\d,]', '', regex=True) # Split the cleaned State_2D into separate columns visitation_counts[['x', 'y']] = visitation_counts['State_2D'].str.split(',', expand=True).astype(int) # Invert the y-coordinates to match the desired orientation grid_size = 6 visitation_counts['y'] = grid_size - 1 - visitation_counts['y'] # Create a 6x6 grid with zero visitation counts for all positions heatmap_data = pd.DataFrame({ 'x': [x for x in range(grid_size) for y in range(grid_size)], 'y': [y for x in range(grid_size) for y in range(grid_size)], 'Visitation_Count': 0 }) # Merge the visitation counts with the grid data heatmap_data = heatmap_data.merge(visitation_counts, on=['x', 'y'], how='left').fillna(0) # Create the Plotly heatmap fig = px.density_heatmap(heatmap_data, x='x', y='y', z='Visitation_Count_y', title='Goal Position Visitation Counts Heatmap', labels={'x': 'X Coordinate', 'y': 'Y Coordinate', 'Visitation_Count_y': 'Visitation Count'}, nbinsx=grid_size, nbinsy=grid_size) # Display the heatmap using Streamlit with a unique key st.title('Goal Position Visitation Counts Heatmap Visualization') st.plotly_chart(fig, key='unique_heatmap_key')
Browse files
app.py
CHANGED
@@ -260,6 +260,7 @@ fig = px.bar(visitation_counts, x='State_2D', y='Visitation_Count',
|
|
260 |
st.title('Goal Position Visitation Counts Visualization')
|
261 |
st.plotly_chart(fig)
|
262 |
|
|
|
263 |
# Visualization only includes the (4,5) and (5,4) 6 x 6 Grid Map Positions
|
264 |
# Aggregate the data to count the number of visits to each State_2D
|
265 |
#visitation_counts = df['State_2D'].value_counts().reset_index()
|
@@ -279,6 +280,7 @@ st.plotly_chart(fig)
|
|
279 |
# Display the heatmap using Streamlit
|
280 |
#st.title('Goal Position Visitation Counts Heatmap Visualization')
|
281 |
#st.plotly_chart(fig)
|
|
|
282 |
|
283 |
df = pd.read_csv('intrinsic_analysis.csv')
|
284 |
st.write("Intrinsic Analysis DataFrame:")
|
@@ -310,6 +312,41 @@ fig = px.density_heatmap(visitation_counts, x='x', y='y', z='Visitation_Count',
|
|
310 |
st.title('Goal Position Visitation Counts Heatmap Visualization')
|
311 |
st.plotly_chart(fig, key='unique_heatmap_key')
|
312 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
313 |
# Aggregate the data to count the number of visits to each State_2D
|
314 |
visitation_counts = df['State_2D'].value_counts().reset_index()
|
315 |
visitation_counts.columns = ['State_2D', 'Visitation_Count']
|
@@ -320,8 +357,11 @@ visitation_counts['State_2D'] = visitation_counts['State_2D'].str.replace(r'[^\d
|
|
320 |
# Split the cleaned State_2D into separate columns
|
321 |
visitation_counts[['x', 'y']] = visitation_counts['State_2D'].str.split(',', expand=True).astype(int)
|
322 |
|
323 |
-
#
|
324 |
grid_size = 6
|
|
|
|
|
|
|
325 |
heatmap_data = pd.DataFrame({
|
326 |
'x': [x for x in range(grid_size) for y in range(grid_size)],
|
327 |
'y': [y for x in range(grid_size) for y in range(grid_size)],
|
@@ -337,6 +377,6 @@ fig = px.density_heatmap(heatmap_data, x='x', y='y', z='Visitation_Count_y',
|
|
337 |
labels={'x': 'X Coordinate', 'y': 'Y Coordinate', 'Visitation_Count_y': 'Visitation Count'},
|
338 |
nbinsx=grid_size, nbinsy=grid_size)
|
339 |
|
340 |
-
# Display the heatmap using Streamlit
|
341 |
st.title('Goal Position Visitation Counts Heatmap Visualization')
|
342 |
-
st.plotly_chart(fig)
|
|
|
260 |
st.title('Goal Position Visitation Counts Visualization')
|
261 |
st.plotly_chart(fig)
|
262 |
|
263 |
+
# Duplicate Goal Visitation visualization
|
264 |
# Visualization only includes the (4,5) and (5,4) 6 x 6 Grid Map Positions
|
265 |
# Aggregate the data to count the number of visits to each State_2D
|
266 |
#visitation_counts = df['State_2D'].value_counts().reset_index()
|
|
|
280 |
# Display the heatmap using Streamlit
|
281 |
#st.title('Goal Position Visitation Counts Heatmap Visualization')
|
282 |
#st.plotly_chart(fig)
|
283 |
+
# Duplicate Goal Visitation visualization
|
284 |
|
285 |
df = pd.read_csv('intrinsic_analysis.csv')
|
286 |
st.write("Intrinsic Analysis DataFrame:")
|
|
|
312 |
st.title('Goal Position Visitation Counts Heatmap Visualization')
|
313 |
st.plotly_chart(fig, key='unique_heatmap_key')
|
314 |
|
315 |
+
# Populates goal tiles at the top right corner at positions (4,5) and (5,4)
|
316 |
+
# Aggregate the data to count the number of visits to each State_2D
|
317 |
+
#visitation_counts = df['State_2D'].value_counts().reset_index()
|
318 |
+
#visitation_counts.columns = ['State_2D', 'Visitation_Count']
|
319 |
+
|
320 |
+
# Clean the State_2D column to remove any extra characters or spaces
|
321 |
+
#visitation_counts['State_2D'] = visitation_counts['State_2D'].str.replace(r'[^\d,]', '', regex=True)
|
322 |
+
|
323 |
+
# Split the cleaned State_2D into separate columns
|
324 |
+
#visitation_counts[['x', 'y']] = visitation_counts['State_2D'].str.split(',', expand=True).astype(int)
|
325 |
+
|
326 |
+
# Create a 6x6 grid with zero visitation counts for all positions
|
327 |
+
#grid_size = 6
|
328 |
+
#heatmap_data = pd.DataFrame({
|
329 |
+
#'x': [x for x in range(grid_size) for y in range(grid_size)],
|
330 |
+
#'y': [y for x in range(grid_size) for y in range(grid_size)],
|
331 |
+
#'Visitation_Count': 0
|
332 |
+
#})
|
333 |
+
|
334 |
+
# Merge the visitation counts with the grid data
|
335 |
+
#heatmap_data = heatmap_data.merge(visitation_counts, on=['x', 'y'], how='left').fillna(0)
|
336 |
+
|
337 |
+
# Create the Plotly heatmap
|
338 |
+
#fig = px.density_heatmap(heatmap_data, x='x', y='y', z='Visitation_Count_y',
|
339 |
+
#title='Goal Position Visitation Counts Heatmap',
|
340 |
+
#labels={'x': 'X Coordinate', 'y': 'Y Coordinate', 'Visitation_Count_y': 'Visitation Count'},
|
341 |
+
#nbinsx=grid_size, nbinsy=grid_size)
|
342 |
+
|
343 |
+
# Display the heatmap using Streamlit
|
344 |
+
#st.title('Goal Position Visitation Counts Heatmap Visualization')
|
345 |
+
#st.plotly_chart(fig)
|
346 |
+
# Populates goal tiles at the top right corner at positions (4,5) and (5,4)
|
347 |
+
|
348 |
+
# Visualization with the origin initializing at the top-left corner
|
349 |
+
# Goal tiles should appear on the bottom right at two sets of coordinates located at (4,5) and (5,4)
|
350 |
# Aggregate the data to count the number of visits to each State_2D
|
351 |
visitation_counts = df['State_2D'].value_counts().reset_index()
|
352 |
visitation_counts.columns = ['State_2D', 'Visitation_Count']
|
|
|
357 |
# Split the cleaned State_2D into separate columns
|
358 |
visitation_counts[['x', 'y']] = visitation_counts['State_2D'].str.split(',', expand=True).astype(int)
|
359 |
|
360 |
+
# Invert the y-coordinates to match the desired orientation
|
361 |
grid_size = 6
|
362 |
+
visitation_counts['y'] = grid_size - 1 - visitation_counts['y']
|
363 |
+
|
364 |
+
# Create a 6x6 grid with zero visitation counts for all positions
|
365 |
heatmap_data = pd.DataFrame({
|
366 |
'x': [x for x in range(grid_size) for y in range(grid_size)],
|
367 |
'y': [y for x in range(grid_size) for y in range(grid_size)],
|
|
|
377 |
labels={'x': 'X Coordinate', 'y': 'Y Coordinate', 'Visitation_Count_y': 'Visitation Count'},
|
378 |
nbinsx=grid_size, nbinsy=grid_size)
|
379 |
|
380 |
+
# Display the heatmap using Streamlit with a unique key
|
381 |
st.title('Goal Position Visitation Counts Heatmap Visualization')
|
382 |
+
st.plotly_chart(fig, key='unique_heatmap_key')
|