universal-portfolios icon indicating copy to clipboard operation
universal-portfolios copied to clipboard

Convergence Issue: "Converged, but not successfully." and Weight Sum Not Equal to 1

Open catgrandpas opened this issue 1 year ago • 3 comments

I have encountered an issue while using the Universal Portfolio library. The optimization process seems to converge, but it is marked as unsuccessful. Additionally, I've noticed that the sum of weights does not equal 1.

Expected Behavior: I expect the optimization process to converge successfully, and the sum of weights should be equal to 1.

Actual Behavior: The optimization process prints "Converged, but not successfully." and the sum of weights is not equal to 1.

catgrandpas avatar Dec 07 '23 08:12 catgrandpas

This is often caused by bad data. I'd check if you don't have any insane outliers in your data. I can't look into this if you don't post a replicable example.

Marigold avatar Dec 07 '23 10:12 Marigold

I want to explore the impact of different metrics on the BCRP model. I found that, except for 'return,' which consistently converges to the optimal solution, other metrics tend to converge to local optima.

Below is a part of my code: @metrics = ['return', 'drawdown', 'ulcer', 'sharpe','sortino'] for metric in metrics: # Run the BCRP model and calculate weights algo = BCRP(metric=metric) result = algo.run(predicted_prices) weights = result.weights # Calculate returns returns = pyfolio_backtest(weights, dff_test.set_index('date'))[0]['Annual return'] # Update the best metric if returns > best_return: best_return = returns best_metric = metric best_metric_per_period.append(best_metric)

catgrandpas avatar Dec 07 '23 15:12 catgrandpas

I found that, except for 'return,' which consistently converges to the optimal solution, other metrics tend to converge to local optima.

That's how BCRP works by definition - it finds weights that maximize return. There are no guarantees for other metrics.

Marigold avatar Dec 16 '23 13:12 Marigold