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
42 changes: 42 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: publish

on:
workflow_dispatch:

jobs:
pypi:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions

- name: Test packaging
run: tox -e packaging

- name: Build
run: tox -e build

- name: Publish distribution 📦 to Test PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1.5
with:
user: __token__
password: ${{ secrets.TEST_PYPI_PASSWORD }}
repository_url: https://test.pypi.org/legacy/

- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1.5
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
max-parallel: 4
matrix:
platform: [ubuntu-latest]
python-version: [3.6, 3.7, 3.8, 3.9, '3.10']
python-version: [3.8, 3.9, '3.10']
env:
PLATFORM: ${{ matrix.platform }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion sspace/orion/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ def __init__(self, categories):
self.categories = categories
map_dict = {cat: i for i, cat in enumerate(categories)}
self._map = numpy.vectorize(lambda x: map_dict[x], otypes="i")
self._imap = numpy.vectorize(lambda x: categories[x], otypes=[numpy.object])
self._imap = numpy.vectorize(lambda x: categories[x], otypes=[object])

def __deepcopy__(self, memo):
"""Make a deepcopy"""
Expand Down
12 changes: 6 additions & 6 deletions tests/orion/test_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,19 +199,19 @@ def test_reverse(self):
]
)
)
== numpy.array([["ipsi", "asfa"], [2, "ipsi"]], dtype=numpy.object)
== numpy.array([["ipsi", "asfa"], [2, "ipsi"]], dtype=object)
)

t = Compose([Enumerate([2, "asfa"]), OneHotEncode(2)], "categorical")
assert t.reverse(0.3) == 2
assert t.reverse(2.0) == "asfa"
assert numpy.all(
t.reverse((0.0, 0.0, 0.0, 1.0))
== numpy.array([2, 2, 2, "asfa"], dtype=numpy.object)
== numpy.array([2, 2, 2, "asfa"], dtype=object)
)
assert numpy.all(
t.reverse(numpy.array([[0.55, 3.0], [-0.6, 1.0]]))
== numpy.array([["asfa", "asfa"], [2, "asfa"]], dtype=numpy.object)
== numpy.array([["asfa", "asfa"], [2, "asfa"]], dtype=object)
)

# for the crazy enough
Expand All @@ -222,7 +222,7 @@ def test_reverse(self):
assert t.reverse(-0.2) == 2
assert numpy.all(
t.reverse([[0.5, 0], [1.0, 55]])
== numpy.array([[2, 2], [2, 2]], dtype=numpy.object)
== numpy.array([[2, 2], [2, 2]], dtype=object)
)

def test_infer_target_shape(self):
Expand Down Expand Up @@ -377,7 +377,7 @@ def test_reverse(self):
t.reverse(3)
assert numpy.all(
t.reverse([[2, 1], [0, 2]])
== numpy.array([["ipsi", "asfa"], [2, "ipsi"]], dtype=numpy.object)
== numpy.array([["ipsi", "asfa"], [2, "ipsi"]], dtype=object)
)

# for the crazy enough
Expand All @@ -387,7 +387,7 @@ def test_reverse(self):
t.reverse(1)
assert numpy.all(
t.reverse([[0, 0], [0, 0]])
== numpy.array([[2, 2], [2, 2]], dtype=numpy.object)
== numpy.array([[2, 2], [2, 2]], dtype=object)
)

def test_infer_target_shape(self):
Expand Down