summaryrefslogtreecommitdiff
path: root/training/crf/baum_welch_example/random_init.pl
diff options
context:
space:
mode:
authorChris Dyer <cdyer@allegro.clab.cs.cmu.edu>2013-02-11 21:14:10 -0500
committerChris Dyer <cdyer@allegro.clab.cs.cmu.edu>2013-02-11 21:14:10 -0500
commitd0a7c74b5d5e8aaf53d3241e09f1bda75bf0e1cc (patch)
tree7535ceae66478e67819b9545565ee16143a8f6e0 /training/crf/baum_welch_example/random_init.pl
parent06d8ec4c0dc2bbf3c8066d3a284a04290ff6a169 (diff)
Baum Welch training for HMMs
Diffstat (limited to 'training/crf/baum_welch_example/random_init.pl')
-rwxr-xr-xtraining/crf/baum_welch_example/random_init.pl9
1 files changed, 9 insertions, 0 deletions
diff --git a/training/crf/baum_welch_example/random_init.pl b/training/crf/baum_welch_example/random_init.pl
new file mode 100755
index 00000000..98467ed1
--- /dev/null
+++ b/training/crf/baum_welch_example/random_init.pl
@@ -0,0 +1,9 @@
+#!/usr/bin/perl -w
+while(<>) {
+ chomp;
+ my ($a,$b,@d) =split /\s+/;
+ die "Bad input" if scalar @d > 0;
+ $r = -rand() * rand() - 0.5;
+ $r = 0 if $a =~ /^Uni:/;
+ print "$a $r\n";
+}