-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Adam Li <[email protected]>
- Loading branch information
Showing
7 changed files
with
419 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule sklearn_fork
updated
123 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from .hyppo import make_quadratic_classification | ||
from .multiview import make_gaussian_mixture, make_joint_factor_model |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import numpy as np | ||
|
||
|
||
def make_quadratic_classification(n_samples: int, n_features: int, noise=False, seed=None): | ||
"""Simulate classification data from a quadratic model. | ||
This is a form of the simulation used in :footcite:`panda2018learning`. | ||
Parameters | ||
---------- | ||
n_samples : int | ||
The number of samples to generate. | ||
n_features : int | ||
The number of dimensions in the dataset. | ||
noise : bool, optional | ||
Whether or not to add noise, by default False. | ||
seed : int, optional | ||
Random seed, by default None. | ||
Returns | ||
------- | ||
x : array-like, shape (n_samples, n_features) | ||
Data array. | ||
v : array-like, shape (n_samples,) | ||
Target array of 1's and 0's. | ||
References | ||
---------- | ||
.. footbibliography:: | ||
""" | ||
rng = np.random.default_rng(seed) | ||
|
||
x = rng.standard_normal(size=(n_samples, n_features)) | ||
coeffs = np.array([np.exp(-0.0325 * (i + 24)) for i in range(n_features)]) | ||
eps = rng.standard_normal(size=(n_samples, n_features)) | ||
|
||
x_coeffs = x * coeffs | ||
y = x_coeffs**2 + noise * eps | ||
|
||
# generate the classification labels | ||
n1 = x.shape[0] | ||
n2 = y.shape[0] | ||
v = np.vstack([np.zeros((n1, 1)), np.ones((n2, 1))]) | ||
x = np.vstack((x, y)) | ||
return x, v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
python_sources = [ | ||
'__init__.py', | ||
'multiview.py', | ||
'hyppo.py', | ||
] | ||
|
||
py3.install_sources( | ||
python_sources, | ||
pure: false, | ||
subdir: 'sktree/datasets' | ||
) |
Oops, something went wrong.