skillfed

skfolio

Portfolio optimization built on top of scikit-learn

skfolio v0.20.2 92.0K downloads/30d#13,485 on PyPI2,101
Permissive 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) Active released

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 on this page — 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

skfolio on PyPI

pip

pip install skfolio

uv

uv add skfolio

poetry

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 the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 8 — numpy, scipy, pandas, cvxpy-base, clarabel, scikit-learn, joblib, plotly
Maintenance actively maintained — 1 days since the last release
Last repo commit
First released
Downloads 92,039/month — #13,485 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: skfolio-0.20.2-py3-none-any.whl

Keywords: portfolio, optimization, optimisation, finance, asset, allocation, quantitative, quant, investment, strategy, machine-learning, scikit-learn, data-mining, data-science

Intended Audience :: DevelopersIntended Audience :: Financial and Insurance IndustryIntended Audience :: Science/ResearchLicense :: OSI Approved :: BSD LicenseOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: UnixProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Topic :: Office/Business :: Financial :: InvestmentTopic :: Scientific/Engineering :: MathematicsTopic :: Software Development

Tags

portfolio optimization pythonmean-variance optimization libraryrisk management asset allocationscikit-learn portfolio modelshierarchical risk parityconvex portfolio optimizationportfolio backtesting frameworkcovariance estimation finance
portfolio-optimizationquantitative-financescikit-learn-compatible

More Software Development packages