Skip to content

Commit

Permalink
Merge branch 'main' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
rektomar authored Feb 23, 2024
2 parents 7b7fd5f + 27f5767 commit c13be23
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 68 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Run tests

on:
workflow_dispatch:
push:
branches:
- master
pull_request:

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: ['1.8']
julia-arch: [x64]
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v2
- uses: julia-actions/[email protected]
with:
version: ${{ matrix.julia-version }}
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1

- uses: julia-actions/julia-processcoverage@v1

- uses: codecov/codecov-action@v3
with:
files: ./coverage1.xml,./coverage2.xml,./lcov.info # optional
flags: unittests # optional
name: codecov-umbrella # optional
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
[![Run tests](https://github.com/aicenter/SumProductSet.jl/actions/workflows/ci.yml/badge.svg)](https://github.com/aicenter/SumProductSet.jl/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
# SumProductSet.jl

is package for probailistic learning of hierarchicaly structured heterogeneous data based on SumProduct networks. The package extends standard SumProduct networks by introducing new type of model node and implementing rules for building models over aforementioned data. It is based on [SumProductTransform.jl](https://github.com/pevnak/SumProductTransform.jl) package. The package [Mill.jl](https://github.com/CTUAvastLab/Mill.jl) is used as a framework that unifies accepted data format.


is a package for probabilistic learning of tree-structured, heterogeneous graph data based on sum-product networks. The package extends the standard sum-product networks by introducing a novel computational node---the set node---and creating model-builders for the networks. The implementation follows the methodology of the [SumProductTransform.jl](https://github.com/pevnak/SumProductTransform.jl) package. The package [Mill.jl](https://github.com/CTUAvastLab/Mill.jl) is utilized to process tree-structured graphs embodied by the JSON format.

To reproduce this project, do the following:

1. Download this code base repository.
2. Open a Julia (preferably Julia 1.8) console and type:
1. Download this repository.
2. Open the Julia (preferably Julia 1.8) console and type:
```julia
using Pkg
Pkg.activate("path/to/the/project")
Pkg.instantiate()
```
This will download and install all necessary packages defined in project environment for you.
These commands will download and install all necessary packages defined in the project environment.
3. Use the package:
``` julia
using SumProductSet

```

Basic examples are shown in [examples](https://github.com/aicenter/SumProductSet.jl/tree/dev/examples) folder. Examples that require externel libraries
not included in SumProductSet.jl package have separate environment.
Basic examples are in the [examples](https://github.com/aicenter/SumProductSet.jl/tree/dev/examples) folder. Examples requiring libraries that are
not included in SumProductSet.jl package have a separate environment.

## Note
Importing Mill.jl or Distribution.jl is prefered to `using` these packages since it does not create ambiguity between the packages and SumProductSet.jl
Adopting `import` Mill.jl or Distribution.jl is preferred to `using`, since it does not create ambiguity between these packages and the SumProductSet.jl
package.
4 changes: 2 additions & 2 deletions examples/base_spsn/set_classification.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ end
function knownsetmixture(μs, Σs, λs, prior)
components = map(zip(μs, Σs, λs)) do ps
pc = Poisson(log(ps[3]))
pf = MvNormalParams(ps[1], ps[2])
pf = MvNormalParams(Float32.(ps[1]), Float32.(ps[2]))
SetNode(pf, pc)
end
SumNode(components, prior)
end

### Creating and sampling known model
m1 = knownsetmixture(μ, Σ, λ, [1., 1., 1.])
m1 = knownsetmixture(μ, Σ, λ, [1f0, 1, 1])
nbags = 100
bags, baglabels = randwithlabel(m1, nbags)

Expand Down
4 changes: 2 additions & 2 deletions examples/base_spsn/set_clustering.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ end
function knownsetmixture(μs, Σs, λs, prior)
components = map(zip(μs, Σs, λs)) do ps
pc = Poisson(log(ps[3]))
pf = MvNormalParams(ps[1], ps[2])
pf = MvNormalParams(Float32.(ps[1]), Float32.(ps[2]))
SetNode(pf, pc)
end
SumNode(components, prior)
end
### Creating and sampling known model
m1 = knownsetmixture(μ, Σ, λ, [1., 1., 1.])
m1 = knownsetmixture(μ, Σ, λ, [1f0, 1, 1])
nbags = 300
bags, baglabels = randwithlabel(m1, nbags)

Expand Down
2 changes: 1 addition & 1 deletion examples/mutagenesis/base_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -436,4 +436,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
52 changes: 0 additions & 52 deletions examples/testvae.jl

This file was deleted.

1 change: 1 addition & 0 deletions src/distributions/distributions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ include("categorical.jl")
include("geometric.jl")
include("bernoulli.jl")


####
# Functions for making the library compatible with Mill
####
Expand Down
2 changes: 1 addition & 1 deletion src/distributions/geometric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ julia> logpdf(m, x)


struct Geometric{T} <: Distribution
logitp::Array{T, 1}
logitp::Vector{T}
end

Flux.@functor Geometric
Expand Down
1 change: 1 addition & 0 deletions src/distributions/mvnormal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ struct MvNormal{T, N} <: Distribution
end

Flux.@functor MvNormal
Flux.trainable(m::MvNormal) = (m.b, m.A,)

MvNormal{T, N}(b::Array{T, 1}, A::Array{T, N}) where {T, N} = MvNormal(b, A, zero(T))

Expand Down
2 changes: 1 addition & 1 deletion test/distributions/mvnormal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ end
end
end

@testset "MvNormal correctness" begin
@testset "MvNormal --- correctness" begin
μ = [-3., 11]
Σ = [5. 3; 3 7]
n = 10000
Expand Down

0 comments on commit c13be23

Please sign in to comment.