Skip to content

removed Plots and UMAP, removed Manifest #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.DS_Store
*.jld
Manifest.toml
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should manifest be ignored or committed? If it's like package management in a few other languages it seems like something that should be kept to ensure that git-shas are maintained.

87 changes: 0 additions & 87 deletions Manifest.toml

This file was deleted.

2 changes: 0 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ version = "0.1.0"
[deps]
Clustering = "aaaa29a8-35af-508c-8bc3-b662a17a0fe5"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
UMAP = "c4f8c510-2410-5be4-91d7-4fbaeb39457e"

[compat]
julia = "1.3"
Expand Down
16 changes: 6 additions & 10 deletions examples/LDA.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using TopicModels, Plots, UMAP
using TopicModels

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

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

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

testModel = Model(testCorpus.alpha, testCorpus.beta, testCorpus)
testState = State(testModel, testCorpus)
@time trainModel(testModel, testState, 100)
@time trainModel(testModel, testState, 100)

# compute validation metrics on a single fit
CorpusARI(testState,testModel,testCorpus) # ARI for max. likelihood. document topics
DocsARI(testState,testCorpus) # ARI for actual word topics

# visualize the fit
@time embedding = umap(testState.topics, 2;n_neighbors=10)
maxlabels = vec(map(i->i[1], findmax(CorpusTopics(testCorpus),dims=1)[2]))
scatter(embedding[1,:], embedding[2,:], zcolor=maxlabels, title="UMAP: True on Learned", marker=(2, 2, :auto, stroke(0)))
4 changes: 2 additions & 2 deletions src/TopicModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module TopicModels
#Imports
import Base.length

using Random, Distributions, Plots, UMAP
using Random, Distributions
using SpecialFunctions: loggamma
using Clustering: randindex

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

#Stuff like perplexity and ARI:
include("Validation.jl")
end #module
end #module
5 changes: 5 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using Test

@testset "Inference" begin
include("Gibbs_unit_tests.jl")
end