Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
catgrandpas opened this issue Dec 7, 2023 · 3 comments

Comments

@catgrandpas
Copy link

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.

@Marigold
Copy link
Owner

Marigold commented Dec 7, 2023

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.

@catgrandpas
Copy link
Author

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)

@Marigold
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants