diff --git a/.github/workflows/CompatHelper.yml b/.github/workflows/CompatHelper.yml new file mode 100644 index 0000000..2876f03 --- /dev/null +++ b/.github/workflows/CompatHelper.yml @@ -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()' \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..49e0a18 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 51d2253..0000000 --- a/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -### Documentation: http://docs.travis-ci.com/user/languages/julia/ -language: julia -os: - - linux -env: - global: - - PYTHON=Conda -julia: - - 1.0 - - 1.5 - - nightly -matrix: - allow_failures: - - julia: nightly -notifications: - email: false - -after_success: - - julia -e 'import Pkg; Pkg.add("Coverage"); using Coverage; Coveralls.submit(process_folder())' diff --git a/Project.toml b/Project.toml index 5c789d7..9697db7 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ 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" @@ -9,7 +9,7 @@ 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" diff --git a/README.md b/README.md index 7cc62c6..c7f7808 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/test/models/clustering.jl b/test/models/clustering.jl index 21584f0..4450575 100644 --- a/test/models/clustering.jl +++ b/test/models/clustering.jl @@ -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)) @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/test/runtests.jl b/test/runtests.jl index f2a8214..5b14e8e 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,6 +3,7 @@ using MLJScikitLearnInterface using Test import MLJBase import ScikitLearn +import MLJBase: target_scitype, input_scitype, output_scitype const MB = MLJBase