Skip to content

Commit

Permalink
fix(docs): docs seo
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoDelatte committed Dec 21, 2023
1 parent 32e7b61 commit 136c7d1
Show file tree
Hide file tree
Showing 13 changed files with 239 additions and 173 deletions.
1 change: 1 addition & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: '3.10'
cache: 'pip'

- name: Upgrade pip
run: python -m pip install --upgrade pip
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,14 @@ jobs:
uses: python-semantic-release/python-semantic-release@v8.5.1
with:
github_token: ${{ steps.generate_token.outputs.token }}
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
# NOTE: DO NOT wrap the conditional in ${{ }} as it will always evaluate to true.
# See https://github.com/actions/runner/issues/1173
if: steps.release.outputs.released == 'true'
with:
repository-url: https://test.pypi.org/legacy/
# with:
# repository-url: https://test.pypi.org/legacy/

- name: Publish package distributions to GitHub Releases
uses: python-semantic-release/upload-to-gh-release@main
Expand All @@ -53,5 +51,3 @@ jobs:
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ steps.generate_token.outputs.token }}
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
12 changes: 6 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
strategy:
fail-fast: false # to not fail all combinations if just one fail
matrix:
os: [ubuntu-latest] #[ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.10'] #['3.10', '3.11', '3.12']
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4
Expand All @@ -23,6 +23,7 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Upgrade pip
run: python -m pip install --upgrade pip
Expand All @@ -34,8 +35,7 @@ jobs:
run: ruff --output-format=github

- name: Run and write pytest
# run: pytest --cov=./ --cov-report=xml
run: pytest tests/test_metrics
run: pytest --cov=./ --cov-report=xml

# - name: Upload coverage reports to Codecov
# uses: codecov/codecov-action@v3
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ Ready to contribute? Here's how to set yourself up for local development.
$ git clone git@github.com:your_name_here/skfolio.git
```

3. Install the project in development mode:
3. Install the project in development mode with the tests and linting dependencies:

```shell
$ pip install --editable .[dev]
$ pip install --editable .[tests]
```

4. Create a branch for local development:
Expand Down
27 changes: 21 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@ It provides a unified interface and `sklearn` compatible tools to build, tune an
cross-validate portfolio models. It is distributed under the 3-Clause BSD license.

.. image:: https://raw.githubusercontent.com/skfolio/skfolio/master/docs/_static/expo.jpg
:target: https://skfolio.github.io/skfolio/auto_examples/index.html
:target: https://skfolio.github.io/skfolio/auto_examples/

Important links
~~~~~~~~~~~~~~~

- Documentation: https://skfolio.github.io/skfolio/
- Tutorials: https://skfolio.github.io/skfolio/auto_examples/index.html
- GitHub Repo: https://github.com/skfolio/skfolio
- Examples: https://skfolio.github.io/skfolio/auto_examples/
- User Guide: https://skfolio.github.io/skfolio/user_guide/
- GitHub Repo: https://github.com/skfolio/skfolio/

Installation
~~~~~~~~~~~~
Expand Down Expand Up @@ -255,13 +256,15 @@ Fit on Training Set
.. code-block:: python
model.fit(X_train)
print(model.weights_)
Predict on Test Set
-------------------
.. code-block:: python
portfolio = model.predict(X_test)
print(portfolio.annualized_sharpe_ratio)
print(portfolio.summary())
Expand Down Expand Up @@ -357,7 +360,9 @@ Randomized Search of the L2 Norm
},
)
randomized_search.fit(X_train)
best_model = randomized_search.best_estimator_
print(best_model.weights_)
Expand Down Expand Up @@ -387,7 +392,9 @@ Grid Search on Embedded Parameters
},
)
gs.fit(X)
best_model = gs.best_estimator_
print(best_model.weights_)
Expand All @@ -414,7 +421,9 @@ Factor Model
model.fit(X_train, y_train)
print(model.weights_)
portfolio = model.predict(X_test)
print(portfolio.calmar_ratio)
print(portfolio.summary())
Expand Down Expand Up @@ -453,6 +462,7 @@ Pre-Selection Pipeline
]
)
model.fit(X_train)
portfolio = model.predict(X_test)
Expand All @@ -465,6 +475,7 @@ K-fold Cross-Validation
model = MeanRisk()
mmp = cross_val_predict(model, X_test, cv=KFold(n_splits=5))
# mmp is the predicted MultiPeriodPortfolio object composed of 5 Portfolios (1 per testing fold)
mmp.plot_cumulative_returns()
print(mmp.summary()
Expand All @@ -474,9 +485,13 @@ Combinatorial Purged Cross-Validation
.. code-block:: python
model = MeanRisk()
cv = CombinatorialPurgedCV(n_folds=10, n_test_folds=2)
print(cv.get_summary(X_train))
population = cross_val_predict(model, X_train, cv=cv)
population.plot_distribution(
measure_list=[RatioMeasure.SHARPE_RATIO, RatioMeasure.SORTINO_RATIO]
)
Expand All @@ -487,8 +502,8 @@ Combinatorial Purged Cross-Validation
Recognition
~~~~~~~~~~~
We would like to thanks all contributors behind the packages skfolio directly depends on
like Scikit-Learn and cvxpy but also the contributors of the following packages that
We would like to thanks all contributors behind our direct dependencies like
scikit-learn and cvxpy but also the contributors of the following packages that
were a source of inspiration:
* PyPortfolioOpt
Expand All @@ -502,7 +517,7 @@ were a source of inspiration:
Citation
~~~~~~~~
If you use scikit-learn in a scientific publication, we would appreciate citations:
If you use skfolio in a scientific publication, we would appreciate citations:
Bibtex entry::
Expand Down
11 changes: 11 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
"sphinx_gallery.gen_gallery",
"sphinx-prompt",
"sphinx.ext.mathjax",
"sphinxext.opengraph",
"sphinx_sitemap"
]

# Produce `plot::` directives for examples that contain `import matplotlib` or
Expand Down Expand Up @@ -96,10 +98,19 @@
# If true, '()' will be appended to :func: etc. cross-reference text.
add_function_parentheses = False

# -- sphinxext-opengraph ----------------------------------------------------

ogp_site_url = "https://skfolio.github.io/skfolio"
ogp_image = "https://skfolio.github.io/skfolio/_images/expo.jpg"
ogp_enable_meta_description = True

# -- autosummary -------------------------------------------------------------

autosummary_generate = True

# -- sphinx_sitemap -------------------------------------------------------------
html_baseurl = 'https://skfolio.github.io/skfolio/'

# -- Internationalization ----------------------------------------------------

# specifying the natural language populates some key tags
Expand Down

0 comments on commit 136c7d1

Please sign in to comment.