Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions packages/fastcan/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package:
name: fastcan
version: 0.4.1
top-level:
- fastcan
source:
url: https://files.pythonhosted.org/packages/source/f/fastcan/fastcan-0.4.1.tar.gz
sha256: a4d3b285671920ed413462a4a3536794f494cd4373501a68f6820e1ecb151fbe
requirements:
run:
- scikit-learn
test:
imports:
- fastcan
about:
home: https://github.com/scikit-learn-contrib/fastcan
PyPI: https://pypi.org/project/fastcan
summary: A fast canonical-correlation-based greedy search algorithm
license: MIT
extra:
recipe-maintainers:
- MatthewSZhang
38 changes: 38 additions & 0 deletions packages/fastcan/test_fastcan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import pytest
from pytest_pyodide import run_in_pyodide


@pytest.mark.driver_timeout(60)
@run_in_pyodide(packages=["fastcan"])
def test_fastcan(selenium):
from fastcan import FastCan
from sklearn.datasets import make_classification
from sklearn.linear_model import LinearRegression
n_samples = 200
n_features = 20
n_classes = 8
n_informative = 5

X, y = make_classification(
n_samples=n_samples,
n_features=n_features,
n_informative=n_informative,
n_redundant=0,
n_repeated=0,
n_classes=n_classes,
n_clusters_per_class=1,
flip_y=0.0,
class_sep=10,
shuffle=False,
random_state=0,
)

reg = LinearRegression().fit(X[:, :n_informative], y)
gtruth_ssc = reg.score(X[:, :n_informative], y)

correlation_filter = FastCan(
n_features_to_select=n_informative,
)
correlation_filter.fit(X, y)
ssc = correlation_filter.scores_.sum()
assert abs(ssc - gtruth_ssc) < 1e-5
Loading