From 21fe03711d4f81d5bcef715ad275bb25fe101739 Mon Sep 17 00:00:00 2001 From: guo-yong-zhi Date: Tue, 28 Dec 2021 12:04:24 +0800 Subject: [PATCH] Stuffing 0.8 --- Project.toml | 4 ++-- examples/benchmark.jl | 2 +- src/wc-method.jl | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Project.toml b/Project.toml index 4880609..e9e3b06 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "WordCloud" uuid = "6385f0a0-cb03-45b6-9089-4e0acc74b26b" authors = ["guoyongzhi "] -version = "0.9.3" +version = "0.9.4" [deps] ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4" @@ -20,5 +20,5 @@ Colors = "0.9, 0.10, 0.11, 0.12" FileIO = "1" ImageTransformations = "0.5, 0.6, 0.7, 0.8, 0.9" Luxor = "2.8" -Stuffing = "0.7" +Stuffing = "0.8" julia = "1.2" diff --git a/examples/benchmark.jl b/examples/benchmark.jl index 5feef8b..5753109 100644 --- a/examples/benchmark.jl +++ b/examples/benchmark.jl @@ -18,7 +18,7 @@ wc3 = wordcloud(words, weights, mask=shape(box, 2000, 2000, cornerradius=100, co wcs = [wc1, wc1, wc2, wc3] # repeat wc1 to trigger compiling ts = [WordCloud.Stuffing.trainepoch_E!,WordCloud.Stuffing.trainepoch_EM!, -WordCloud.Stuffing.trainepoch_EM2!,WordCloud.Stuffing.trainepoch_EM3!, +WordCloud.Stuffing.trainepoch_EM2!,WordCloud.Stuffing.trainepoch_EM3!,WordCloud.Stuffing.trainepoch_D!, WordCloud.Stuffing.trainepoch_P!,WordCloud.Stuffing.trainepoch_P2!,WordCloud.Stuffing.trainepoch_Px!] es = [[] for i in 1:length(wcs)] for (i, wc) in enumerate(wcs) diff --git a/src/wc-method.jl b/src/wc-method.jl index 3d95db0..761fb04 100644 --- a/src/wc-method.jl +++ b/src/wc-method.jl @@ -241,6 +241,9 @@ function fit!(wc, args...; reposition=true, optimiser=SGD(), krags...) wc.params[:epoch] += ep if nc == 0 setstate!(wc, nameof(fit!)) + # @assert isempty(outofkernelbounds(wc.maskqtree, wc.qtrees)) + # colllist = first.(totalcollisions(qtrees)) + # @assert length(colllist) == 0 else setstate!(wc, nameof(placewords!)) end @@ -248,7 +251,7 @@ function fit!(wc, args...; reposition=true, optimiser=SGD(), krags...) end function printcollisions(wc) qtrees = [wc.maskqtree, wc.qtrees...] - colllist = first.(batchcollisions(qtrees)) + colllist = first.(totalcollisions(qtrees)) get_text(i) = i > 1 ? wc.words[i - 1] : "#MASK#" collwords = [(get_text(i), get_text(j)) for (i, j) in colllist] if length(colllist) > 0 @@ -288,9 +291,6 @@ function generate!(wc::WC, args...; retry=3, krags...) if STATEIDS[getstate(wc)] >= STATEIDS[:fit!] println("$(wc.params[:epoch]) epochs") setstate!(wc, nameof(generate!)) - # @assert isempty(outofkernelbounds(wc.maskqtree, wc.qtrees)) - # colllist = first.(batchcollisions(qtrees)) - # @assert length(colllist) == 0 else # check printcollisions(wc) end