Skip to content

Commit

Permalink
Merge branch 'release/0.8.1'
Browse files Browse the repository at this point in the history
Fix packaging.
  • Loading branch information
vnmabus committed Jan 26, 2023
2 parents f59540e + ab3b986 commit eb0c817
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 81 deletions.
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

1 change: 0 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'sphinx.ext.mathjax',
'sphinx_rtd_theme',
'sphinx_gallery.gen_gallery',
'sphinx.ext.intersphinx',
'sphinx.ext.doctest',
Expand Down
11 changes: 8 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ classifiers = [
dynamic = ["version"]

dependencies = [
"cython",
"dcor",
"fdasrsf>=2.2.0",
"findiff",
Expand Down Expand Up @@ -58,5 +57,11 @@ documentation = "https://fda.readthedocs.io"
repository = "https://github.com/GAA-UAM/scikit-fda"

[build-system]
# Minimum requirements for the build system to execute.
requires = ["setuptools", "wheel"]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
include = ["skfda*"]

[tool.setuptools.dynamic]
version = {attr = "skfda.__version__"}
2 changes: 1 addition & 1 deletion readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ sphinx:

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.8
version: "3.8"
install:
- requirements: readthedocs-requirements.txt
- method: pip
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ matplotlib
numpy
scipy
setuptools
Cython
scikit-learn
multimethod>=1.2
findiff
38 changes: 0 additions & 38 deletions setup.py

This file was deleted.

16 changes: 1 addition & 15 deletions skfda/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,4 @@
concatenate as concatenate,
)

try:
with open(
_os.path.join(
_os.path.dirname(__file__),
'..',
'VERSION',
),
'r',
) as version_file:
__version__ = version_file.read().strip()
except IOError as e:
if e.errno != _errno.ENOENT:
raise

__version__ = "0.0"
__version__ = "0.8.1"
10 changes: 5 additions & 5 deletions skfda/misc/metrics/_mahalanobis.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ def fit(

if self.eigenvalues is None or self.eigenvectors is None:
fpca = FPCA(
self.n_components,
self.centering,
self.regularization,
self.weights,
self.components_basis,
n_components=self.n_components,
centering=self.centering,
regularization=self.regularization,
components_basis=self.components_basis,
_weights=self.weights,
)
fpca.fit(X)
self.eigenvalues_ = fpca.explained_variance_
Expand Down
31 changes: 15 additions & 16 deletions skfda/preprocessing/dim_reduction/_fpca.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class FPCA( # noqa: WPS230 (too many public attributes)
def __init__(
self,
n_components: int = 3,
*,
centering: bool = True,
regularization: Optional[L2Regularization[FData]] = None,
components_basis: Optional[Basis] = None,
Expand Down Expand Up @@ -354,27 +355,25 @@ def _fit_grid(
regularization=self.regularization,
)

basis_matrix = basis.data_matrix[..., 0]
if regularization_matrix is not None:
basis_matrix += regularization_matrix
# See issue #497 for more information about this approach
factorization_matrix = weights_matrix.astype(float)
if self.regularization is not None:
factorization_matrix += regularization_matrix

fd_data = np.linalg.solve(
basis_matrix.T,
fd_data.T,
).T
# Tranpose of the Cholesky decomposition
Lt = np.linalg.cholesky(factorization_matrix).T

# see docstring for more information
final_matrix = fd_data @ np.sqrt(weights_matrix)
new_data_matrix = fd_data @ weights_matrix
new_data_matrix = np.linalg.solve(Lt.T, new_data_matrix.T).T

pca = PCA(n_components=self.n_components)
pca.fit(final_matrix)
pca.fit(new_data_matrix)

components = pca.components_
components = np.linalg.solve(Lt, pca.components_.T).T

self.components_ = X.copy(
data_matrix=np.transpose(
np.linalg.solve(
np.sqrt(weights_matrix),
np.transpose(pca.components_),
),
),
data_matrix=components,
sample_names=(None,) * self.n_components,
)

Expand Down

0 comments on commit eb0c817

Please sign in to comment.