Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
yixuan committed Oct 28, 2024
2 parents ed11657 + b5e13c5 commit 4d84c9c
Show file tree
Hide file tree
Showing 52 changed files with 3,808 additions and 979 deletions.
36 changes: 12 additions & 24 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,28 @@
name: Build

on: [push, pull_request]
# on: [push, pull_request]
on:
push:
paths-ignore:
- .gitignore
- README.md
- LICENSE
- doc/

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-2019]
os: [ubuntu-latest, windows-latest]

steps:
# Install poetry
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry

# Used to host poetry
- uses: actions/setup-python@v3
- name: Lock and install dependencies
run: |
poetry lock
poetry install
- name: Build and build sdist package
run: |
poetry run python setup.py build
poetry run python setup.py sdist
- name: Build wheel package
run: poetry run python setup.py bdist_wheel

- name: Build wheels for more general OS
run: poetry build --format=wheel

- uses: pypa/cibuildwheel@v2.16

- uses: actions/upload-artifact@v4
with:
name: rehline-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./dist
path: ./wheelhouse/*.whl
15 changes: 14 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,17 @@ eigen3.zip

# Package sdist
*.tar.gz
*.whl
*.whl

.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix
223 changes: 223 additions & 0 deletions .ipynb_checkpoints/FairSVM-checkpoint.ipynb

Large diffs are not rendered by default.

123 changes: 123 additions & 0 deletions .ipynb_checkpoints/QR-checkpoint.ipynb

Large diffs are not rendered by default.

110 changes: 110 additions & 0 deletions .ipynb_checkpoints/SVM-checkpoint.ipynb

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{
"esbonio.sphinx.confDir": ""
"esbonio.sphinx.confDir": "",
"files.associations": {
"random": "cpp",
"type_traits": "cpp",
"tuple": "cpp",
"utility": "cpp"
}
}
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.0)
project(rehline LANGUAGES CXX)

set(PYBIND11_FINDPYTHON ON)
find_package(pybind11 CONFIG REQUIRED)

pybind11_add_module(rehline MODULE src/rehline.cpp)

install(TARGETS rehline DESTINATION .)
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# ReHLine <a href="https://github.com/softmin/ReHLine"><img src="doc/source/logo.png" align="right" height="138" /></a>
# ReHLine <a href="https://github.com/softmin/ReHLine"><img src="doc/source/figs/logo.png" align="right" height="138" /></a>

**ReHLine** is designed to be a computationally efficient and practically useful software package for large-scale empirical risk minimization (ERM) problems.

- GitHub repo: [https://github.com/softmin/ReHLine-python](https://github.com/softmin/ReHLine-python)
- Documentation: [https://rehline-python.readthedocs.io](https://rehline-python.readthedocs.io)
- Project homepage: [https://rehline.github.io](https://rehline.github.io)
- GitHub repo: [https://github.com/softmin/ReHLine-python](https://github.com/softmin/ReHLine-python)
- PyPi: [https://pypi.org/project/rehline](https://pypi.org/project/rehline)
- Open Source: [MIT license](https://opensource.org/licenses/MIT)
- Paper: [NeurIPS | 2023](https://openreview.net/pdf?id=3pEBW2UPAD)
<!-- - Open Source: [MIT license](https://opensource.org/licenses/MIT) -->


The **ReHLine** solver has four appealing
"linear properties":
Expand All @@ -16,6 +18,7 @@ The **ReHLine** solver has four appealing
- The optimization algorithm has a provable linear convergence rate.
- The per-iteration computational complexity is linear in the sample size.

<!--
## 📝 Formulation
**ReHLine** is designed to address the empirical regularized ReLU-ReHU minimization problem, named *ReHLine optimization*, of the following form:
Expand All @@ -38,7 +41,7 @@ $$
This formulation has a wide range of applications spanning various fields, including statistics, machine learning, computational biology, and social studies. Some popular examples include SVMs with fairness constraints (FairSVM), elastic net regularized quantile regression (ElasticQR), and ridge regularized Huber minimization (RidgeHuber).
![](./figs/tab.png)
![](./figs/tab.png) -->

## ⌛ Benchmark (powered by benchopt)

Expand Down
85 changes: 0 additions & 85 deletions build.py

This file was deleted.

Binary file added dist/rehline-0.0.4.dev0-py3.10-linux-x86_64.egg
Binary file not shown.
11 changes: 0 additions & 11 deletions doc/_templates/autoapi/index.rst

This file was deleted.

12 changes: 0 additions & 12 deletions doc/requirements.txt

This file was deleted.

33 changes: 0 additions & 33 deletions doc/source/README.md

This file was deleted.

16 changes: 16 additions & 0 deletions doc/source/_static/css/label.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.summarylabel {
background-color: var(--color-foreground-secondary);
color: var(--color-background-secondary);
font-size: 70%;
padding-left: 2px;
padding-right: 2px;
border-radius: 3px;
vertical-align: 15%;
padding-bottom: 2px;
filter: opacity(40%);
}


table.summarytable {
width: 100%;
}
12 changes: 12 additions & 0 deletions doc/source/_templates/autoapi/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
API Reference
=============

This page contains auto-generated API reference documentation.

.. toctree::
:titlesonly:

{% for page in pages %}
{{ page.include_path }}
{% endfor %}

68 changes: 68 additions & 0 deletions doc/source/_templates/autoapi/macros.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{# AutoApiSummary replacement macro #}
{#
The intent of this macro is to replace the autoapisummary directive with the following
improvements:
1) Method signature is generated without typing annotation regardless of the value of
`autodoc_typehints`
2) Properties are treated like attribute (but labelled as properties).
3) Label are added as summary prefix to indicate if the member is a property, class
method, or static method.

Copyright: Antoine Beyeler, 2022
License: MIT
#}

{# Renders an object's name with a proper reference and optional signature.

The signature is re-generated from obj.obj.args, which is undocumented but is the
only way to have a type-less signature if `autodoc_typehints` is `signature` or
`both`. #}
{% macro _render_item_name(obj, sig=False) -%}
:py:obj:`{{ obj.name }} <{{ obj.id }}>`
{%- if sig -%}
\ (
{%- for arg in obj.obj.args -%}
{%- if arg[0] %}{{ arg[0]|replace('*', '\*') }}{% endif -%}{{ arg[1] -}}
{%- if not loop.last %}, {% endif -%}
{%- endfor -%}
){%- endif -%}
{%- endmacro %}


{# Generates a single object optionally with a signature and a labe. #}
{% macro _item(obj, sig=False, label='') %}
* - {{ _render_item_name(obj, sig) }}
- {% if label %}:summarylabel:`{{ label }}` {% endif %}{% if obj.summary %}{{ obj.summary }}{% else %}\-{% endif +%}
{% endmacro %}



{# Generate an autosummary-like table with the provided members. #}
{% macro auto_summary(objs, title='') -%}

.. list-table:: {{ title }}
:header-rows: 0
:widths: auto
:class: summarytable {#- apply CSS class to customize styling +#}

{% for obj in objs -%}
{#- should the full signature be used? -#}
{%- set sig = (obj.type in ['method', 'function'] and not 'property' in obj.properties) -%}

{#- compute label -#}
{%- if 'property' in obj.properties -%}
{%- set label = 'prop' -%}
{%- elif 'classmethod' in obj.properties -%}
{%- set label = 'class' -%}
{%- elif 'abstractmethod' in obj.properties -%}
{%- set label = 'abc' -%}
{%- elif 'staticmethod' in obj.properties -%}
{%- set label = 'static' -%}
{%- else -%}
{%- set label = '' -%}
{%- endif -%}

{{- _item(obj, sig=sig, label=label) -}}
{%- endfor -%}

{% endmacro %}
Loading

0 comments on commit 4d84c9c

Please sign in to comment.