-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add beginning of nnqp implementation. * Add current work * Add current work refactoring nnqp and nnls. * Add constraint integration with working tests for unconstrained case. * Add test with constraints * Change constraint API and refactor test with pytest.mark.parametrize * Fix interaction test * Add current work on lower bound constraints * Add separate build for windows * Change versioning to be localized to __init__.py with partial import. * Add starting code for qcp sood * Add glinternet docs * Add windows into build workflow * Add a few more flags for windows * Add changes to pass clang on stringent build * Add MAMBA_ROOT_PREFIX to GITHUB_ENV * Add separate conda handling for windows * Specify bash for windows * Add debug on finding conda * Add find on $CONDA * Add debug on MAMBA_ROOT_PREFIX within CIBW * Check MAMBA_ROOT_PREFIX from non-micromamba shell * Update cibuildwheel * Add environment variable to CIBW_ENVIRONMENT * Help Linux build with MAMBA_ROOT_PREFIX * Add debug on include for eigen3 * Find eigen3 in prefix * Add conda create in linux * Add to conda to path * Add fresh install of conda * Install wget omg * Change to apt-get * Access host file system instead * Try adding as environment to CIBW * Ignore warnings for msvc around all pybind11 related things * Make paths general and warnings compiler specific * Add debug on prefix for windows * Find eigen3 * Add new setup to adjust for windows mamba pathing * Remove stringent build on windows * Change all openmp loops to be signed and u_char -> uint8_t * Change all u_char * Change 0/0 to inf to bypass msvc error * Set warning to 0 not 1 and set MACOSX_DEPLOYMENT_TARGET to 10.9 * Remove cibw_before_build and runtime_library_dirs * Add no deps and add back runtime dirs * Add relaxed msvc warnings * Ignore C4566 * Add correct syntax * Ignore conversion or truncation * Ignore more conversions and helps with left-shift warning * Ignore openmp clauses being ignored * Add final build fixes and update version * Clean-up from review 1 * Add more warnings about constraints * Add a cleaner hack for reading __version__ * Fix build error on unused params * Fix build errors 2
- Loading branch information
1 parent
24a771e
commit ca3124b
Showing
63 changed files
with
4,438 additions
and
2,142 deletions.
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
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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
include VERSION | ||
graft adelie | ||
|
||
global-exclude *.so | ||
|
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
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,68 @@ | ||
from .adelie_core.constraint import ( | ||
ConstraintBase32, | ||
ConstraintBase64, | ||
) | ||
from .glm import _coerce_dtype | ||
from . import adelie_core as core | ||
from typing import Union | ||
import numpy as np | ||
|
||
|
||
def lower( | ||
b: np.ndarray, | ||
*, | ||
max_iters: int =100, | ||
tol: float =1e-7, | ||
nnls_max_iters: int =10000, | ||
nnls_tol: float =1e-7, | ||
dtype: Union[np.float32, np.float64] =None, | ||
): | ||
"""Creates a lower bound constraint. | ||
The lower bound constraint is given by :math:`x \\geq -b` where :math:`b \\geq 0`. | ||
Parameters | ||
---------- | ||
b : (d,) np.ndarray | ||
Lower bound. | ||
max_iters: int, optional | ||
Maximum number of proximal Newton iterations. | ||
Default is ``100``. | ||
tol : float, optional | ||
Convergence tolerance for proximal Newton. | ||
Default is ``1e-7``. | ||
nnls_max_iters: int, optional | ||
Maximum number of non-negative least squares iterations. | ||
Default is ``10000``. | ||
nnls_tol: float, optional | ||
Maximum number of non-negative least squares iterations. | ||
Default is ``1e-7``. | ||
dtype : Union[np.float32, np.float64], optional | ||
The underlying data type. | ||
If ``None``, it is inferred from ``b``, | ||
in which case ``b`` must have an underlying data type of | ||
``np.float32`` or ``np.float64``. | ||
Default is ``None``. | ||
Returns | ||
------- | ||
wrap | ||
Wrapper constraint object. | ||
See Also | ||
-------- | ||
adelie.adelie_core.constraint.ConstraintLowerUpper64 | ||
""" | ||
b, dtype = _coerce_dtype(b, dtype) | ||
|
||
core_base = { | ||
np.float32: core.constraint.ConstraintLowerUpper32, | ||
np.float64: core.constraint.ConstraintLowerUpper64, | ||
}[dtype] | ||
|
||
class _lower(core_base): | ||
def __init__(self): | ||
self._b = np.array(b, copy=True, dtype=dtype) | ||
core_base.__init__(self, -1, self._b, max_iters, tol, nnls_max_iters, nnls_tol) | ||
|
||
return _lower() |
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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
from .adelie_core.optimization import ( | ||
search_pivot, | ||
symmetric_penalty, | ||
nnls_cov_full, | ||
nnls_naive, | ||
StateNNLS, | ||
StateNNQPFull, | ||
) |
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
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
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
Oops, something went wrong.