Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
ma-impl
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
eccochu
ma-impl
Commits
6f6a13a4
Commit
6f6a13a4
authored
9 years ago
by
Eike Cochu
Browse files
Options
Downloads
Patches
Plain Diff
added missing lines to topic name generation
parent
af54b13c
No related branches found
No related tags found
Loading
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
vipra-cmd/src/main/java/de/vipra/cmd/lda/DTMAnalyzer.java
+2
-2
2 additions, 2 deletions
vipra-cmd/src/main/java/de/vipra/cmd/lda/DTMAnalyzer.java
vipra-cmd/src/main/java/de/vipra/cmd/lda/JGibbAnalyzer.java
+15
-6
15 additions, 6 deletions
vipra-cmd/src/main/java/de/vipra/cmd/lda/JGibbAnalyzer.java
with
17 additions
and
8 deletions
vipra-cmd/src/main/java/de/vipra/cmd/lda/DTMAnalyzer.java
+
2
−
2
View file @
6f6a13a4
...
...
@@ -202,16 +202,16 @@ public class DTMAnalyzer extends Analyzer {
}
}
// collect top n words
if
(!
newSeqTopicWords
.
isEmpty
())
{
Collections
.
sort
(
newSeqTopicWords
,
Comparator
.
reverseOrder
());
// top n percent cutoff
if
(
seqPercentCutoff
)
{
final
int
fromIndex
=
(
int
)
Math
.
round
(
newSeqTopicWords
.
size
()
*
Constants
.
PERCENT_PROB
);
newSeqTopicWords
.
subList
(
fromIndex
,
newSeqTopicWords
.
size
());
newSeqTopicWords
.
subList
(
fromIndex
,
newSeqTopicWords
.
size
())
.
clear
()
;
}
// collect top words
topTopicWords
.
addAll
(
newSeqTopicWords
.
subList
(
0
,
Math
.
min
(
newSeqTopicWords
.
size
(),
Constants
.
TOPIC_AUTO_NAMING_WORDS
)));
}
...
...
This diff is collapsed.
Click to expand it.
vipra-cmd/src/main/java/de/vipra/cmd/lda/JGibbAnalyzer.java
+
15
−
6
View file @
6f6a13a4
...
...
@@ -98,6 +98,9 @@ public class JGibbAnalyzer extends Analyzer {
estimator
.
init
(
options
);
estimator
.
estimate
();
final
boolean
seqRelativeCutoff
=
Constants
.
MINIMUM_RELATIVE_PROB
>
0
;
final
boolean
seqPercentCutoff
=
Constants
.
PERCENT_PROB
<
1
;
// read topic definitions and save
final
File
twords
=
new
File
(
modelDir
,
NAME
+
".twords"
);
...
...
@@ -146,18 +149,24 @@ public class JGibbAnalyzer extends Analyzer {
final
double
maxLikeliness
=
maxLikelinesses
[
topicIndex
];
final
ArrayList
<
TopicWord
>
filteredTopicWords
=
new
ArrayList
<>(
topic
.
getWords
().
size
());
for
(
final
TopicWord
word
:
topic
.
getWords
())
{
if
(
word
.
getLikeliness
()
>=
Constants
.
MINIMUM_RELATIVE_PROB
*
maxLikeliness
)
{
if
(
!
seqRelativeCutoff
||
word
.
getLikeliness
()
>=
Constants
.
MINIMUM_RELATIVE_PROB
*
maxLikeliness
)
{
filteredTopicWords
.
add
(
word
);
newWords
.
add
(
word
.
getWord
());
}
}
topic
.
setWords
(
filteredTopicWords
);
}
// sort topic words and generate topic name
for
(
final
TopicFull
topic
:
newTopics
)
{
Collections
.
sort
(
topic
.
getWords
(),
Collections
.
reverseOrder
());
topic
.
setName
(
TopicFull
.
getNameFromWords
(
topic
.
getWords
()));
if
(!
filteredTopicWords
.
isEmpty
())
{
Collections
.
sort
(
filteredTopicWords
,
Collections
.
reverseOrder
());
// top n percent cutoff
if
(
seqPercentCutoff
)
{
final
int
fromIndex
=
(
int
)
Math
.
round
(
filteredTopicWords
.
size
()
*
Constants
.
PERCENT_PROB
);
filteredTopicWords
.
subList
(
fromIndex
,
filteredTopicWords
.
size
()).
clear
();
}
topic
.
setName
(
TopicFull
.
getNameFromWords
(
filteredTopicWords
));
}
}
// recreate topics and words
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment