--- id: skfolio version: "0.20.2" license: BSD 3-Clause License Copyright (c) 2023-2026 The skfolio developers. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that… (full text in the JSON record) license_treatment: permissive maintenance: active --- # skfolio — Portfolio optimization built on top of scikit-learn License: permissive · Maintenance: active · Downloads: 92.0K/mo ## What it is and what it does skfolio is a machine-learning-focused portfolio optimization framework built on scikit-learn's API. It addresses shortcomings in classical mean-variance optimization by offering a unified toolkit for model selection, validation, and parameter tuning while mitigating overfitting and data leakage. The library provides naive allocation strategies (equal-weight, inverse-volatility), convex optimization methods (mean-risk, risk budgeting, maximum diversification), clustering-based approaches (hierarchical risk parity), and ensemble techniques. It also includes estimators for expected returns, covariance matrices, distributions, and priors, plus cross-validation and hyperparameter tuning compatible with scikit-learn's ecosystem. The package is designed for quantitative finance practitioners and researchers who need to experiment with multiple portfolio construction methods and compare their out-of-sample performance. Its dependencies—numpy, scipy, pandas, scikit-learn, plotly, cvxpy-base, and clarabel—provide numerical computing, optimization, data handling, and visualization. The library targets Python 3.10 and later and is actively maintained with recent releases. Use it for: - Build and backtest mean-risk portfolio models with different covariance estimators and risk measures. - Compare naive allocation strategies against optimized portfolios using walk-forward or purged cross-validation. - Construct hierarchical risk parity or equal-risk-contribution portfolios for diversification. - Stress-test portfolio allocations under different market regimes or synthetic scenarios. - Tune portfolio optimization hyperparameters (e.g., regularization, constraints) via grid or randomized search. - Estimate expected returns and covariance using shrinkage, denoising, or regime-adjusted methods. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. skfolio is a Python library for portfolio optimization and risk management that integrates with scikit-learn to build, tune, cross-validate, and stress-test portfolio models using a unified interface. Yes. skfolio is actively maintained, has no known vulnerabilities, uses a permissive license, and offers low install friction. It is well-suited for anyone building quantitative portfolio models in Python who wants scikit-learn-style workflows, multiple optimization methods, and robust cross-validation. The 2101 GitHub stars and recent release cycle signal a mature, community-backed project. Install it if you need portfolio optimization; skip it if you only need basic mean-variance calculations or prefer a different API. ## Install pip install skfolio uv add skfolio poetry add skfolio ## Installing skfolio Before you install: Low install friction with a pure-Python wheel and eight well-established dependencies (numpy, scipy, pandas, scikit-learn, plotly, cvxpy-base, clarabel, joblib). Actively maintained with a release 1 day old and 2101 GitHub stars. License in practice: Distributed under the permissive BSD 3-Clause License, which permits commercial and private use with minimal restrictions—only requiring retention of copyright and license text in source distributions. Quickstart: pip install skfolio from skfolio.optimization import MeanRisk from skfolio.datasets import load_sp500_dataset prices = load_sp500_dataset() model = MeanRisk() model.fit(prices) Requires Python >= 3.10; cvxpy-base and clarabel are compiled dependencies that may require a C compiler or prebuilt wheels on some platforms. Verify before relying: - Whether the library handles missing data or late-inception assets automatically or requires preprocessing. - Performance characteristics and scalability limits for large universes of assets or long time series. - Whether enterprise support from Skfolio Labs is included or requires a separate contract. ## Package facts - License: BSD 3-Clause License Copyright (c) 2023-2026 The skfolio developers. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that… (full text in the JSON record) (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 92.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags portfolio optimization python, mean-variance optimization library, risk management asset allocation, scikit-learn portfolio models, hierarchical risk parity, convex portfolio optimization, portfolio backtesting framework, covariance estimation finance, portfolio-optimization, quantitative-finance, scikit-learn-compatible [View on SkillFed](https://skillfed.io/packages/skfolio) · [View on PyPI](https://pypi.org/project/skfolio/)