Updated lines 463-494 with: # Clean the State_2D column to remove any extra characters or spaces df['State_2D'] = df['State_2D'].str.replace(r'[^\d,]', '', regex=True) # Split the cleaned State_2D into separate columns df[['x', 'y']] = df['State_2D'].str.split(',', expand=True).astype(int) # 1. Compare State_2D and Extrinsic Reward fig1 = px.bar(df, x='State_2D', y='Extrinsic Reward', title='Comparison of State_2D and Extrinsic Reward', labels={'State_2D': 'State 2D', 'Extrinsic Reward': 'Extrinsic Reward'}) # 2. Compare Intrinsic Reward | Extrinsic Reward | State_2D fig2 = px.scatter(df, x='Intrinsic Reward', y='Extrinsic Reward', color='State_2D', title='Comparison of Intrinsic Reward, Extrinsic Reward, and State_2D', labels={'Intrinsic Reward': 'Intrinsic Reward', 'Extrinsic Reward': 'Extrinsic Reward', 'State_2D': 'State 2D'}) # 3. Compare Total Reward | Intrinsic Reward | Extrinsic Reward | State_2D fig3 = px.scatter_3d(df, x='Total Reward', y='Intrinsic Reward', z='Extrinsic Reward', color='State_2D', title='Comparison of Total Reward, Intrinsic Reward, Extrinsic Reward, and State_2D', labels={'Total Reward': 'Total Reward', 'Intrinsic Reward': 'Intrinsic Reward', 'Extrinsic Reward': 'Extrinsic Reward', 'State_2D': 'State 2D'}) # 4. Compare State_2D and Total Reward fig4 = px.bar(df, x='State_2D', y='Total Reward', title='Comparison of State_2D and Total Reward', labels={'State_2D': 'State 2D', 'Total Reward': 'Total Reward'}) # Display the visualizations using Streamlit st.title('Intrinsic Analysis Visualizations') st.plotly_chart(fig1) st.plotly_chart(fig2) st.plotly_chart(fig3) st.plotly_chart(fig4)
verified