Skip to content

Commit

Permalink
Merge pull request #42 from skfolio/feature/no-issue/skfolio-datasets
Browse files Browse the repository at this point in the history
[ENH] Move datasets to another repo (skfolio-datasets)
  • Loading branch information
HugoDelatte committed Mar 13, 2024
2 parents 4982e27 + f7a34b5 commit c10158b
Show file tree
Hide file tree
Showing 12 changed files with 8 additions and 1,026 deletions.
Binary file removed datasets/ftse100_dataset.csv.gz
Binary file not shown.
Binary file removed datasets/nasdaq_dataset.csv.gz
Binary file not shown.
5 changes: 4 additions & 1 deletion src/skfolio/datasets/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@ def download_dataset(
DataFrame with each row representing one observation and each column
representing the asset price of a given observation.
"""
url = f"https://github.com/skfolio/skfolio/raw/main/datasets/{data_filename}.csv.gz"
url = (
f"https://github.com/skfolio/skfolio-datasets/raw/main/"
f"datasets/{data_filename}.csv.gz"
)

data_home = get_data_home(data_home=data_home)
filepath = os.path.join(data_home, f"{data_filename}.pkz")
Expand Down
1 change: 0 additions & 1 deletion src/skfolio/distance/_distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# Author: Hugo Delatte <delatte.hugo@gmail.com>
# License: BSD 3 clause


import numpy as np
import numpy.typing as npt
import pandas as pd
Expand Down
1 change: 0 additions & 1 deletion src/skfolio/measures/_measures.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# Gini mean difference and OWA GMD weights features are derived
# from Riskfolio-Lib, Copyright (c) 2020-2023, Dany Cajas, Licensed under BSD 3 clause.


import numpy as np
import scipy.optimize as sco

Expand Down
1 change: 0 additions & 1 deletion src/skfolio/optimization/cluster/hierarchical/_hrp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# The risk measure generalization and constraint features are derived
# from Riskfolio-Lib, Copyright (c) 2020-2023, Dany Cajas, Licensed under BSD 3 clause.


import numpy as np
import numpy.typing as npt
import pandas as pd
Expand Down
6 changes: 3 additions & 3 deletions src/skfolio/optimization/convex/_mean_risk.py
Original file line number Diff line number Diff line change
Expand Up @@ -889,9 +889,9 @@ def fit(self, X: npt.ArrayLike, y: npt.ArrayLike | None = None) -> "MeanRisk":
self.covariance_uncertainty_set_estimator
)
self.covariance_uncertainty_set_estimator_.fit(X, y)
args[
arg_name
] = self.covariance_uncertainty_set_estimator_.uncertainty_set_
args[arg_name] = (
self.covariance_uncertainty_set_estimator_.uncertainty_set_
)
else:
args[arg_name] = getattr(self, arg_name)

Expand Down
2 changes: 1 addition & 1 deletion src/skfolio/population/_population.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Population module.
"""Population module.
A population is a collection of portfolios.
"""

Expand Down
1 change: 0 additions & 1 deletion src/skfolio/portfolio/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
# the class attributes with the argument name preceded by the measure name and
# separated by '_'.


import warnings
from abc import abstractmethod
from typing import ClassVar
Expand Down
1 change: 0 additions & 1 deletion src/skfolio/portfolio/_portfolio.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
# Author: Hugo Delatte <delatte.hugo@gmail.com>
# License: BSD 3 clause


import numbers
from typing import ClassVar

Expand Down
1,001 changes: 0 additions & 1,001 deletions tests/data/covariance.csv

This file was deleted.

15 changes: 0 additions & 15 deletions tests/test_utils/test_stats.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
from pathlib import Path

import numpy as np
import pandas as pd
import pytest
import scipy.cluster.hierarchy as sch
import scipy.spatial.distance as scd
Expand Down Expand Up @@ -72,12 +69,6 @@ def linkage_matrix(distance):
return linkage_matrix


@pytest.fixture(scope="module")
def non_psd_cov():
file = Path(Path(__file__).parent.parent, "data", "covariance.csv")
return pd.read_csv(file, sep=",").to_numpy()


def test_n_bins_freedman(returns):
n_bins = n_bins_freedman(returns)
assert n_bins == 329
Expand All @@ -97,12 +88,6 @@ def test_cov_nearest(nasdaq_X):
assert is_cholesky_dec(cov2)


def test_cov_nearest_cov_non_psd(non_psd_cov):
assert not is_cholesky_dec(non_psd_cov)
cov = cov_nearest(non_psd_cov)
assert is_cholesky_dec(cov)


def test_corr_nearest_psd():
x = np.array([[1, -0.2, -0.9], [-0.2, 1, -0.2], [-0.9, -0.2, 1]])
y = cov_nearest(x, higham=True)
Expand Down

0 comments on commit c10158b

Please sign in to comment.