ltfmselector 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,194 @@
1
+ name: release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "[0-9]+.[0-9]+.[0-9]+"
7
+ - "[0-9]+.[0-9]+.[0-9]+a[0-9]+"
8
+ - "[0-9]+.[0-9]+.[0-9]+b[0-9]+"
9
+ - "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
10
+
11
+ env:
12
+ PACKAGE_NAME: "ltfmselector"
13
+ OWNER: "RenZhen95"
14
+
15
+ jobs:
16
+ details:
17
+ runs-on: ubuntu-latest
18
+ outputs:
19
+ new_version: ${{ steps.release.outputs.new_version }}
20
+ suffix: ${{ steps.release.outputs.suffix }}
21
+ tag_name: ${{ steps.release.outputs.tag_name }}
22
+ steps:
23
+ - name: Check Ref Type
24
+ if: github.ref_type != 'tag'
25
+ run: echo "This is not a tag; exiting"; exit 1
26
+
27
+ - name: Extract tag and Details
28
+ id: release
29
+ run: |
30
+ TAG_NAME=${GITHUB_REF#refs/tags/}
31
+ NEW_VERSION=$(echo $TAG_NAME | awk -F'-' '{print $1}')
32
+ SUFFIX=$(echo $TAG_NAME | grep -oP '[a-z]+[0-9]+' || echo "")
33
+ echo "new_version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
34
+ echo "suffix=$SUFFIX" >> "$GITHUB_OUTPUT"
35
+ echo "tag_name=$TAG_NAME" >> "$GITHUB_OUTPUT"
36
+
37
+ - name: Debug Outputs
38
+ if: env.RUNNER_DEBUG
39
+ run: |
40
+ echo "Version is $NEW_VERSION"
41
+ echo "Suffix is $SUFFIX"
42
+ echo "Tag name is $TAG_NAME"
43
+
44
+ check_pypi:
45
+ needs: details
46
+ runs-on: ubuntu-latest
47
+ steps:
48
+ - name: Fetch information from PyPI
49
+ run: |
50
+ response=$(curl -s https://pypi.org/pypi/${{ env.PACKAGE_NAME }}/json || echo "{}")
51
+ latest_previous_version=$(echo $response | grep -oP '"releases":\{"\K[^"]+' | sort -rV | head -n 1)
52
+ if [ -z "$latest_previous_version" ]; then
53
+ echo "Package not found on PyPI."
54
+ latest_previous_version="0.0.0"
55
+ fi
56
+ echo "Latest version on PyPI: $latest_previous_version"
57
+ echo "latest_previous_version=$latest_previous_version" >> $GITHUB_ENV
58
+
59
+ - name: Compare versions and exit if not newer
60
+ run: |
61
+ NEW_VERSION=${{ needs.details.outputs.new_version }}
62
+ LATEST_VERSION=$latest_previous_version
63
+ if [ "$(printf '%s\n' "$LATEST_VERSION" "$NEW_VERSION" | sort -rV | head -n 1)" != "$NEW_VERSION" ] || [ "$NEW_VERSION" == "$LATEST_VERSION" ]; then
64
+ echo "The new version $NEW_VERSION is not greater than the latest version $LATEST_VERSION on PyPI."
65
+ exit 1
66
+ else
67
+ echo "The new version $NEW_VERSION is greater than the latest version $LATEST_VERSION on PyPI."
68
+ fi
69
+
70
+ setup_and_build:
71
+ needs: [details, check_pypi]
72
+ runs-on: ubuntu-latest
73
+ steps:
74
+ - uses: actions/checkout@v4
75
+
76
+ - name: Set up Python
77
+ # Resolves Python Version from .python-version file if no python-version is provided
78
+ uses: actions/setup-python@v5
79
+
80
+ - name: Install uv
81
+ uses: astral-sh/setup-uv@v4
82
+
83
+ - name: Bump version
84
+ run: |
85
+ NEW_VERSION="${{ needs.details.outputs.new_version }}"
86
+ sed -i "s/version = \"[0-9]*\.[0-9]*\.[0-9]*\"/version = \"$NEW_VERSION\"/" $GITHUB_WORKSPACE/pyproject.toml
87
+
88
+ - name: Install dependencies
89
+ run: uv sync
90
+
91
+ - name: Build source and wheel distribution
92
+ run: uv build
93
+
94
+ - name: Upload artifacts
95
+ uses: actions/upload-artifact@v4
96
+ with:
97
+ name: dist
98
+ path: dist/
99
+
100
+ pypi_publish:
101
+ name: Upload release to PyPI
102
+ needs: [setup_and_build, details]
103
+ runs-on: ubuntu-latest
104
+ environment:
105
+ name: release
106
+ permissions:
107
+ id-token: write
108
+ steps:
109
+ - name: Download artifacts
110
+ uses: actions/download-artifact@v4
111
+ with:
112
+ name: dist
113
+ path: dist/
114
+
115
+ - name: Install uv
116
+ uses: astral-sh/setup-uv@v4
117
+
118
+ - name: Publish to PyPI
119
+ run: uv publish
120
+
121
+ github_release:
122
+ name: Create GitHub Release
123
+ needs: [setup_and_build, details]
124
+ runs-on: ubuntu-latest
125
+ env:
126
+ TAG_NAME: ${{ needs.details.outputs.tag_name }}
127
+ permissions:
128
+ contents: write
129
+ steps:
130
+ - name: Checkout Code
131
+ uses: actions/checkout@v4
132
+ with:
133
+ fetch-depth: 0 # Fetch full history to avoid issues with tags and branches
134
+
135
+ - name: Download artifacts
136
+ uses: actions/download-artifact@v4
137
+ with:
138
+ name: dist
139
+ path: dist/
140
+
141
+ - name: Create GitHub Release
142
+ id: create_release
143
+ run: gh release create ${{ env.TAG_NAME }} dist/* --title ${{ env.TAG_NAME }} --generate-notes
144
+ env:
145
+ GH_TOKEN: ${{ github.token }}
146
+
147
+ bump_homebrew_formula:
148
+ name: Dispatch event to Repo B
149
+ needs: [details, github_release, pypi_publish]
150
+ runs-on: ubuntu-latest
151
+ environment:
152
+ name: release
153
+ env:
154
+ FORMULA_VERSION: ${{ needs.details.outputs.new_version }}
155
+ steps:
156
+ - name: Dispatch Repository Dispatch event
157
+ uses: peter-evans/repository-dispatch@v3
158
+ with:
159
+ token: ${{ secrets.BREW_TAP_TOKEN }}
160
+ repository: ArjanCodes/homebrew-core
161
+ event-type: "update-formula"
162
+ client-payload: |-
163
+ {
164
+ "formula_version": "${{ env.FORMULA_VERSION }}",
165
+ "formula_url": "${{ env.FORMULA_URL }}",
166
+ "formula_name": "${{ env.FORMULA_NAME }}"
167
+ }
168
+ env:
169
+ FORMULA_NAME: ${{ env.PACKAGE_NAME }}
170
+ FORMULA_URL: https://github.com/${{ env.OWNER }}/${{ env.PACKAGE_NAME }}/releases/download/${{ env.FORMULA_VERSION }}/${{ env.PACKAGE_NAME }}-${{ env.FORMULA_VERSION }}.tar.gz
171
+
172
+ bump_version:
173
+ needs: [details, github_release, pypi_publish]
174
+ runs-on: ubuntu-latest
175
+ env:
176
+ NEW_VERSION: ${{ needs.details.outputs.new_version }}
177
+ steps:
178
+ - name: Checkout Code
179
+ uses: actions/checkout@v4
180
+ with:
181
+ fetch-depth: 0 # Fetch full history to avoid issues with tags and branches
182
+
183
+ - name: Bump version
184
+ run: |
185
+ NEW_VERSION=${{ env.NEW_VERSION }}
186
+ sed -i "s/version = \"[0-9]*\.[0-9]*\.[0-9]*\"/version = \"$NEW_VERSION\"/" $GITHUB_WORKSPACE/pyproject.toml
187
+
188
+ - uses: stefanzweifel/git-auto-commit-action@v5
189
+ with:
190
+ commit_message: Bumping version to ${{ env.NEW_VERSION }}
191
+ branch: bump-version-${{ env.NEW_VERSION }}
192
+ file_pattern: "pyproject.toml"
193
+ skip_dirty_check: true
194
+ create_branch: true
@@ -0,0 +1,11 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+ *.ipynb_checkpoints/
9
+
10
+ # Virtual environments
11
+ .venv
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Jonathan Liaw
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,48 @@
1
+ Metadata-Version: 2.4
2
+ Name: ltfmselector
3
+ Version: 0.1.1
4
+ Summary: Locally-Tailored Feature and Model Selector with Deep Q-Learning
5
+ Author-email: RenZhen95 <j-liaw@hotmail.com>
6
+ License-File: LICENSE
7
+ Requires-Python: >=3.12
8
+ Requires-Dist: numpy>=2.2.4
9
+ Requires-Dist: openpyxl>=3.1.5
10
+ Requires-Dist: pandas>=2.2.3
11
+ Requires-Dist: scikit-learn>=1.6.1
12
+ Requires-Dist: torch>=2.6.0
13
+ Description-Content-Type: text/markdown
14
+
15
+ <h1>
16
+ <picture>
17
+ <img alt="LTFMSelectorLogo" src="icons/icon.png">
18
+ </picture>
19
+ </h1>
20
+
21
+ # LTFMSelector
22
+ Locally-Tailored Feature and Model Selector with Deep Q-Learning
23
+
24
+ ## Installation
25
+ ```
26
+ pip install ltfmselector
27
+ ```
28
+
29
+ ## Basic usage
30
+ ```python
31
+ from ltfmselector import LTFMSelector
32
+
33
+ # Initialize an agent to learn to selects features and models, specifically tailored to each example
34
+ AgentSelector = LTFMSelector(<#episodes>, pType=<'classification', 'regression'>)
35
+
36
+ # Fit
37
+ AgentSelector(<X: pd.DataFrame>, <y: pd.Series>)
38
+
39
+ # Predict
40
+ y_pred, doc = AgentSelector.predict(<X_test: pd.DataFrame>)
41
+ ```
42
+
43
+ For more examples check out the [examples](https://github.com/RenZhen95/ltfmselector/tree/master/examples).
44
+
45
+ ## Citing LTFMSelector
46
+ This library is implemented based on the work presented in this abstract:
47
+
48
+ J.C. Liaw, C.Z. Chaing, D. Raab, M. Siebler, H. Hefter, D. Zietz, M. Jäger, A. Kecskeméthy, F. Geu Flores. Interdisciplinary Gait Assessment with Patient-Specific Feature and Model Selection via Reinforcement Learning. 11. IFToMM D-A-CH Konferenz 2025, 20./21. Februar 2025, FH Kärnten, Villach. [HTML](https://doi.org/10.17185/duepublico/82941)
@@ -0,0 +1,34 @@
1
+ <h1>
2
+ <picture>
3
+ <img alt="LTFMSelectorLogo" src="icons/icon.png">
4
+ </picture>
5
+ </h1>
6
+
7
+ # LTFMSelector
8
+ Locally-Tailored Feature and Model Selector with Deep Q-Learning
9
+
10
+ ## Installation
11
+ ```
12
+ pip install ltfmselector
13
+ ```
14
+
15
+ ## Basic usage
16
+ ```python
17
+ from ltfmselector import LTFMSelector
18
+
19
+ # Initialize an agent to learn to selects features and models, specifically tailored to each example
20
+ AgentSelector = LTFMSelector(<#episodes>, pType=<'classification', 'regression'>)
21
+
22
+ # Fit
23
+ AgentSelector(<X: pd.DataFrame>, <y: pd.Series>)
24
+
25
+ # Predict
26
+ y_pred, doc = AgentSelector.predict(<X_test: pd.DataFrame>)
27
+ ```
28
+
29
+ For more examples check out the [examples](https://github.com/RenZhen95/ltfmselector/tree/master/examples).
30
+
31
+ ## Citing LTFMSelector
32
+ This library is implemented based on the work presented in this abstract:
33
+
34
+ J.C. Liaw, C.Z. Chaing, D. Raab, M. Siebler, H. Hefter, D. Zietz, M. Jäger, A. Kecskeméthy, F. Geu Flores. Interdisciplinary Gait Assessment with Patient-Specific Feature and Model Selection via Reinforcement Learning. 11. IFToMM D-A-CH Konferenz 2025, 20./21. Februar 2025, FH Kärnten, Villach. [HTML](https://doi.org/10.17185/duepublico/82941)