problem: add top 10 drawdown comparison table in the backtest result, increase the visualization plots/tables in the backtest result
if the segments code need update, please return the full updated segments code, no need import or other stuff, only the full version of the updated segment

### Extracted Code Segments

#### 1. **File: `portfolio_optimizer.py`**
   - **Function: `display_portfolio_vs_benchmark`**
     - **Relevance:** This function is directly related to the problem of increasing visualization plots/tables in the backtest result. It enhances the display function for Portfolio vs Benchmark comparison with improved visualizations and UX.
     - **Code Segment:**
       ```python
       def display_portfolio_vs_benchmark(results):
           """
           Enhanced display function for Portfolio vs Benchmark comparison with improved visualizations and UX.
           """
           # Extract data from results
           returns = results['returns']
           cum_returns = results['cum_returns']
           weights = results['weights']
           price_data = results['price_data']
           available_selected = results['available_selected']
           metrics = results['metrics']
           benchmark_metrics = results['benchmark_metrics']
           benchmark_returns = results['benchmark_returns']
           benchmark_cum_returns = results['benchmark_cum_returns']

           # Define a consistent theme for all plots
           THEMES = {
               'plotly_dark': 'plotly_dark',
               'plotly_light': 'plotly_white'
           }
           selected_theme = THEMES.get('plotly_light')  # Change as needed

           # Create tabs for better organization
           main_tab, metrics_tab, risk_tab, analysis_tab, insights_tab = st.tabs([
               "📈 Main Charts", "📊 Performance Metrics", "🎯 Risk Analysis", "🔍 Deep Analysis", "🧠 Metric-Based Insights"
           ])

           with main_tab:
               st.header("🔹 Portfolio vs Benchmark Overview")
               col1, col2 = st.columns([2, 1])
               with col1:
                   st.subheader("Portfolio Composition")
                   fig_composition = px.pie(
                       values=weights,
                       names=price_data.columns,
                       title="Current Portfolio Allocation",
                       template=selected_theme,
                       hole=0.4
                   )
                   fig_composition.update_traces(textinfo='percent+label')
                   st.plotly_chart(fig_composition, use_container_width=True)

               with col2:
                   st.subheader("Key Performance Indicators")
                   metrics_display = {
                       "Total Return": f"{(cum_returns.iloc[-1] - 1) * 100:.2f}%",
                       "Annualized Return": metrics.get('Annualized Return (CAGR)', 'N/A'),
                       "Sharpe Ratio": metrics.get('Sharpe Ratio', 'N/A'),
                       "Max Drawdown": metrics.get('Maximum Drawdown', 'N/A')
                   }
                   for metric, value in metrics_display.items():
                       st.metric(metric, value)

               # Enhanced Cumulative Returns Plot with Interactive Features
               st.subheader("Cumulative Returns Comparison")
               fig_returns = go.Figure()
               fig_returns.add_trace(go.Scatter(
                   x=cum_returns.index,
                   y=cum_returns,
                   name="Portfolio",
                   line=dict(color='cyan', width=2),
                   hovertemplate='%{y:.2f}'
               ))
               fig_returns.add_trace(go.Scatter(
                   x=benchmark_cum_returns.index,
                   y=benchmark_cum_returns,
                   name="Benchmark",
                   line=dict(color='orange', width=2, dash='dash'),
                   hovertemplate='%{y:.2f}'
               ))
               fig_returns.update_layout(
                   template=selected_theme,
                   hovermode='x unified',
                   height=500,
                   xaxis_title='Date',
                   yaxis_title='Cumulative Returns',
                   legend=dict(x=0.01, y=0.99)
               )
               st.plotly_chart(fig_returns, use_container_width=True)

               # Interactive Summary Recommendations
               create_summary_recommendations('overview', metrics=metrics)
       ```

#### 2. **File: `portfolio_optimizer.py`**
   - **Function: `display_portfolio_vs_portfolio`**
     - **Relevance:** This function is also directly related to the problem of increasing visualization plots/tables in the backtest result. It displays comparison between two portfolios with enhanced UI/UX.
     - **Code Segment:**
       ```python
       def display_portfolio_vs_portfolio(results, portfolio1, portfolio2):
           """Displays comparison between two portfolios with enhanced UI/UX."""
           # Extract data from results
           returns_a = results.get('returns_a', pd.Series(dtype=float))
           returns_b = results.get('returns_b', pd.Series(dtype=float))
           cum_returns_a = results.get('cum_returns_a', pd.Series(dtype=float))
           cum_returns_b = results.get('cum_returns_b', pd.Series(dtype=float))
           weights_a = results.get('weights_a', [])
           weights_b = results.get('weights_b', [])
           price_data_a = results.get('price_data_a', pd.DataFrame())
           price_data_b = results.get('price_data_b', pd.DataFrame())
           metrics_a = results.get('metrics_a', {})
           metrics_b = results.get('metrics_b', {})

           # Define available_a and available_b based on price data columns
           available_a = list(price_data_a.columns)
           available_b = list(price_data_b.columns)

           # Ensure that available_a and available_b are not empty
           if not available_a:
               st.error(f"No available data for Portfolio '{portfolio1}'.")
               return
           if not available_b:
               st.error(f"No available data for Portfolio '{portfolio2}'.")
               return

           # Define a consistent theme for all plots
           THEMES = {
               'plotly_dark': 'plotly_dark',
               'plotly_light': 'plotly_white'
           }
           selected_theme = THEMES.get('plotly_light')  # Change as needed

           # Create tabs for better organization
           overview_tab, comparison_tab, risk_tab, analysis_tab = st.tabs([
               "📊 Overview", "🔄 Comparison", "🎯 Risk Analysis", "🔍 Deep Analysis"
           ])

           with overview_tab:
               st.header("🔹 Portfolio Overview")
               col1, col2 = st.columns([1,1])
               
               with col1:
                   st.subheader(f"{portfolio1} Composition")
                   fig_comp_a = px.pie(
                       values=weights_a,
                       names=price_data_a.columns,
                       title=f"{portfolio1} Allocation",
                       template=selected_theme,
                       hole=0.4,
                       color_discrete_sequence=px.colors.sequential.Blues
                   )
                   fig_comp_a.update_traces(textinfo='percent+label')
                   st.plotly_chart(fig_comp_a, use_container_width=True)

                   # Key metrics for portfolio 1
                   metrics_display_a = {
                       "Total Return": f"{(cum_returns_a.iloc[-1] - 1) * 100:.2f}%",
                       "Annualized Return": metrics_a.get('Annualized Return (CAGR)', 'N/A'),
                       "Sharpe Ratio": metrics_a.get('Sharpe Ratio', 'N/A'),
                       "Max Drawdown": metrics_a.get('Maximum Drawdown', 'N/A')
                   }
                   st.subheader(f"{portfolio1} Key Metrics")
                   for metric, value in metrics_display_a.items():
                       st.metric(f"{metric}", value)

               with col2:
                   st.subheader(f"{portfolio2} Composition")
                   fig_comp_b = px.pie(
                       values=weights_b,
                       names=price_data_b.columns,
                       title=f"{portfolio2} Allocation",
                       template=selected_theme,
                       hole=0.4,
                       color_discrete_sequence=px.colors.sequential.Oranges
                   )
                   fig_comp_b.update_traces(textinfo='percent+label')
                   st.plotly_chart(fig_comp_b, use_container_width=True)

                   # Key metrics for portfolio 2
                   metrics_display_b = {
                       "Total Return": f"{(cum_returns_b.iloc[-1] - 1) * 100:.2f}%",
                       "Annualized Return": metrics_b.get('Annualized Return (CAGR)', 'N/A'),
                       "Sharpe Ratio": metrics_b.get('Sharpe Ratio', 'N/A'),
                       "Max Drawdown": metrics_b.get('Maximum Drawdown', 'N/A')
                   }
                   st.subheader(f"{portfolio2} Key Metrics")
                   for metric, value in metrics_display_b.items():
                       st.metric(f"{metric}", value)

               # Cumulative Returns Comparison with Interactive Features
               st.subheader("Cumulative Returns Comparison")
               fig_returns = go.Figure()
               fig_returns.add_trace(go.Scatter(
                   x=cum_returns_a.index,
                   y=cum_returns_a,
                   name=portfolio1,
                   line=dict(color='cyan', width=2),
                   hovertemplate='%{y:.2f}'
               ))
               fig_returns.add_trace(go.Scatter(
                   x=cum_returns_b.index,
                   y=cum_returns_b,
                   name=portfolio2,
                   line=dict(color='orange', width=2, dash='dash'),
                   hovertemplate='%{y:.2f}'
               ))
               fig_returns.update_layout(
                   template=selected_theme,
                   hovermode='x unified',
                   height=500,
                   xaxis_title='Date',
                   yaxis_title='Cumulative Returns',
                   legend=dict(x=0.01, y=0.99)
               )
               st.plotly_chart(fig_returns, use_container_width=True)

               # Interactive Portfolio Comparison Summary
               create_portfolio_comparison_summary(
                   portfolio1_name=portfolio1,
                   portfolio2_name=portfolio2,
                   metrics_a=metrics_a,
                   metrics_b=metrics_b
               )
       ```

#### 3. **File: `portfolio_optimizer.py`**
   - **Function: `display_drawdowns`**
     - **Relevance:** This function is relevant to the problem of adding a top 10 drawdown comparison table in the backtest result. It displays drawdown details for the portfolio and benchmark.
     - **Code Segment:**
       ```python
       def display_drawdowns(cum_returns, benchmark_cum_returns):
           """Displays drawdown details for portfolio and benchmark."""
           st.markdown("### 📈 Drawdowns for Portfolio")
           portfolio_drawdowns = get_drawdown_details(cum_returns)
           if portfolio_drawdowns:
               st.table(pd.DataFrame(portfolio_drawdowns))
           else:
               st.write("No drawdowns detected for the portfolio.")

           if not benchmark_cum_returns.empty:
               st.markdown("### 📈 Drawdowns for Benchmark")
               benchmark_drawdowns = get_drawdown_details(benchmark_cum_returns)
               if benchmark_drawdowns:
                   st.table(pd.DataFrame(benchmark_drawdowns))
               else:
                   st.write("No drawdowns detected for the benchmark.")
           else:
               st.write("Benchmark data not available for drawdown analysis.")
       ```

### Explanation

1. **`display_portfolio_vs_benchmark` Function:**
   - This function enhances the display of backtest results for a portfolio compared to a benchmark. It includes:
     - **Pie Chart:** Visualizes the portfolio composition.
     - **Key Performance Indicators:** Displays key metrics like Total Return, Annualized Return, Sharpe Ratio, and Max Drawdown.
     - **Cumulative Returns Comparison:** Plots the cumulative returns of the portfolio and benchmark over time.
     - **Interactive Summary Recommendations:** Provides context-specific summary and recommendations.

2. **`display_portfolio_vs_portfolio` Function:**
   - This function enhances the display of backtest results for a comparison between two portfolios. It includes:
     - **Pie Charts:** Visualizes the composition of both portfolios.
     - **Key Metrics:** Displays key performance indicators for both portfolios.
     - **Cumulative Returns Comparison:** Plots the cumulative returns of both portfolios over time.
     - **Interactive Portfolio Comparison Summary:** Provides a comprehensive summary and actionable insights based on the comparison.

3. **`display_drawdowns` Function:**
   - This function is specifically relevant to the problem of adding a top 10 drawdown comparison table in the backtest result. It displays drawdown details for both the portfolio and the benchmark, helping users understand the historical drawdown characteristics of their portfolios.

These functions collectively address the problem by enhancing the visualization and presentation of backtest results, making it easier for users to interpret and analyze the performance of their portfolios.