Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a893541

Browse files
authored
removed Plots and UMAP, removed Manifest (#11)
1 parent c814d7f commit a893541

File tree

6 files changed

+15
-101
lines changed

6 files changed

+15
-101
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
.DS_Store
2+
*.jld
3+
Manifest.toml

Manifest.toml

Lines changed: 0 additions & 87 deletions
This file was deleted.

Project.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ version = "0.1.0"
66
[deps]
77
Clustering = "aaaa29a8-35af-508c-8bc3-b662a17a0fe5"
88
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
9-
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
109
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1110
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
12-
UMAP = "c4f8c510-2410-5be4-91d7-4fbaeb39457e"
1311

1412
[compat]
1513
julia = "1.3"

examples/LDA.jl

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using TopicModels, Plots, UMAP
1+
using TopicModels
22

33
##################################################################################################################################
44
# Fit and Visualize Real-World Text Data
@@ -17,9 +17,10 @@ state = State(model,corpus)
1717
topWords = topTopicWords(model, state, 10)
1818

1919
# visualize the fit
20-
@time embedding = umap(state.topics, 2, n_neighbors=10)
21-
maxlabels = vec(map(i->i[1], findmax(state.topics,dims=1)[2]))
22-
scatter(embedding[1,:], embedding[2,:], zcolor=maxlabels, title="UMAP: Max-Likelihood Doc Topics on Learned", marker=(2, 2, :auto, stroke(0)))
20+
# using Plots, UMAP
21+
# @time embedding = umap(state.topics, 2, n_neighbors=10)
22+
# maxlabels = vec(map(i->i[1], findmax(state.topics,dims=1)[2]))
23+
# scatter(embedding[1,:], embedding[2,:], zcolor=maxlabels, title="UMAP: Max-Likelihood Doc Topics on Learned", marker=(2, 2, :auto, stroke(0)))
2324

2425
##################################################################################################################################
2526
# Fit, Validate, and Visualize Synthetic Data Derived from a Fully-Generative Simulation (Poisson-distributed document-length)
@@ -34,13 +35,8 @@ testCorpus = LdaCorpus(k, lexLength, corpLambda, corpLength, scaleK, scaleL)
3435

3536
testModel = Model(testCorpus.alpha, testCorpus.beta, testCorpus)
3637
testState = State(testModel, testCorpus)
37-
@time trainModel(testModel, testState, 100)
38+
@time trainModel(testModel, testState, 100)
3839

3940
# compute validation metrics on a single fit
4041
CorpusARI(testState,testModel,testCorpus) # ARI for max. likelihood. document topics
4142
DocsARI(testState,testCorpus) # ARI for actual word topics
42-
43-
# visualize the fit
44-
@time embedding = umap(testState.topics, 2;n_neighbors=10)
45-
maxlabels = vec(map(i->i[1], findmax(CorpusTopics(testCorpus),dims=1)[2]))
46-
scatter(embedding[1,:], embedding[2,:], zcolor=maxlabels, title="UMAP: True on Learned", marker=(2, 2, :auto, stroke(0)))

src/TopicModels.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module TopicModels
33
#Imports
44
import Base.length
55

6-
using Random, Distributions, Plots, UMAP
6+
using Random, Distributions
77
using SpecialFunctions: loggamma
88
using Clustering: randindex
99

@@ -29,4 +29,4 @@ include("Computation.jl")
2929

3030
#Stuff like perplexity and ARI:
3131
include("Validation.jl")
32-
end #module
32+
end #module

test/runtests.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
using Test
2+
3+
@testset "Inference" begin
4+
include("Gibbs_unit_tests.jl")
5+
end

0 commit comments

Comments
 (0)