Skip to content

Commit

Permalink
Merge pull request #28 from alan-turing-institute/dev
Browse files Browse the repository at this point in the history
For a 0.1.8 release
  • Loading branch information
ablaom authored Jan 28, 2021
2 parents a5ab41d + 17dde1d commit 095e7a8
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 52 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: CompatHelper
on:
schedule:
- cron: '00 00 * * *'
workflow_dispatch:
jobs:
CompatHelper:
runs-on: ubuntu-latest
steps:
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_PRIV }} # optional
run: julia -e 'using CompatHelper; CompatHelper.main()'
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI
env:
PYTHON: Conda
on:
pull_request:
branches:
- master
push:
branches:
- master
tags: '*'
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.0'
- '1'
os:
- ubuntu-latest
arch:
- x64
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v1
with:
file: lcov.info
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name = "MLJScikitLearnInterface"
uuid = "5ae90465-5518-4432-b9d2-8a1def2f0cab"
authors = ["Thibaut Lienart, Anthony Blaom"]
version = "0.1.7"
version = "0.1.8"

[deps]
MLJModelInterface = "e80e1ace-859a-464e-9ed9-23947d8ae3ea"
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
ScikitLearn = "3646fa90-6ef7-5e7e-9f22-8aca16db6324"

[compat]
MLJModelInterface = "0.3.6"
MLJModelInterface = "0.3.6,0.4"
PyCall = "1"
ScikitLearn = "0.5,0.6"
julia = "1"
Expand Down
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,4 @@ Repository implementing MLJ interface for
**Note**: for errors with MKL on Mac, please refer to [ScikitLearn.jl](https://github.com/cstjean/ScikitLearn.jl) as it's a known issue.


## Todo

**June 2020**

* Maybe more integration tests

48 changes: 22 additions & 26 deletions test/models/clustering.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ models = (

if m in (AffinityPropagation, MeanShift)
p = MB.predict(m, f, X)
@test p isa MB.CategoricalArray
@test p isa MB.CategoricalArray
end

@test keys(fp) == getproperty(fparams, Symbol(mod))
Expand All @@ -46,12 +46,11 @@ end
@testset "Scitypes" begin
for mod in models
m = mod()
infos = MB.info_dict(m)
@test infos[:input_scitype] == MB.Table(MB.Continuous)
@test input_scitype(mod) == MB.Table(MB.Continuous)
m == AffinityPropagation &&
@test infos[:target_scitype] == AbstractVector{MB.Multiclass}
m == MeanShift &&
@test infos[:output_scitype] == MB.Table(MB.Continuous)
@test target_scitype(mod) == AbstractVector{MB.Multiclass}
m == MeanShift &&
@test output_scitype(mod) == MB.Table(MB.Continuous)
end
end

Expand All @@ -69,10 +68,10 @@ models = (
fp = MB.fitted_params(m, f)
@test size(fp.cluster_centers) == (4, 3)
p = MB.predict(m, f, X)
@test p isa MB.CategoricalArray
@test p isa MB.CategoricalArray
Xt = MB.transform(m, f, X)
@test Xt isa MB.Tables.MatrixTable

@test keys(fp) == getproperty(fparams, Symbol(mod))
end
end
Expand All @@ -87,10 +86,9 @@ end
@testset "Scitypes" begin
for mod in models
m = mod()
infos = MB.info_dict(m)
@test infos[:input_scitype] == MB.Table(MB.Continuous)
@test infos[:target_scitype] == AbstractVector{MB.Multiclass}
@test infos[:output_scitype] == MB.Table(MB.Continuous)
@test input_scitype(mod) == MB.Table(MB.Continuous)
@test target_scitype(mod) == AbstractVector{MB.Multiclass}
@test output_scitype(mod) == MB.Table(MB.Continuous)
end
end

Expand All @@ -107,19 +105,19 @@ models = (
f, = MB.fit(m, 1, X)
fp = MB.fitted_params(m, f)
@test fp.labels isa MB.CategoricalArray

Xt = MB.transform(m, f, X)
if mod == FeatureAgglomeration
@test fp.distances === nothing
Xit = MB.inverse_transform(m, f, Xt)
@test fp.distances === nothing
Xit = MB.inverse_transform(m, f, Xt)
# NOTE: they're not equal (not sure why)
@test Xit isa MB.Tables.MatrixTable
else
else
p = MB.predict(m, f, X)
@test p isa MB.CategoricalArray
@test p isa MB.CategoricalArray
@test Xt isa MB.Tables.MatrixTable
end
end

@test keys(fp) == getproperty(fparams, Symbol(mod))
end
end
Expand All @@ -133,11 +131,10 @@ end

@testset "Scitypes" begin
for mod in models
infos = MB.info_dict(mod)
@test infos[:input_scitype] == MB.Table(MB.Continuous)
@test input_scitype(mod) == MB.Table(MB.Continuous)
mod == Birch &&
@test infos[:target_scitype] == AbstractVector{MB.Multiclass}
@test infos[:output_scitype] == MB.Table(MB.Continuous)
@test target_scitype(mod) == AbstractVector{MB.Multiclass}
@test output_scitype(mod) == MB.Table(MB.Continuous)
end
end

Expand All @@ -152,7 +149,7 @@ model = (
m=mod()
f, = MB.fit(m, 1, X)
fp = MB.fitted_params(m, f)
@test fp.labels isa MB.CategoricalArray
@test fp.labels isa MB.CategoricalArray
@test keys(fp) == getproperty(fparams, Symbol(mod))
end
end
Expand All @@ -167,7 +164,6 @@ end
@testset "Scitypes" begin
for mod in models
m = mod()
infos = MB.info_dict(m)
@test infos[:input_scitype] == MB.Table(MB.Continuous)
@test input_scitype(mod) == MB.Table(MB.Continuous)
end
end
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ using MLJScikitLearnInterface
using Test
import MLJBase
import ScikitLearn
import MLJBase: target_scitype, input_scitype, output_scitype

const MB = MLJBase

Expand Down

0 comments on commit 095e7a8

Please sign in to comment.