[thebeast] r741 committed - introduced LogLinearLikelihood match

2 views
Skip to first unread message

codesite...@google.com

unread,
Mar 26, 2010, 1:04:59 AM3/26/10
to thebeas...@googlegroups.com
Revision: 741
Author: sebastian.riedel
Date: Thu Mar 25 22:04:01 2010
Log: introduced LogLinearLikelihood match
http://code.google.com/p/thebeast/source/detail?r=741

Modified:

/branches/thefuture-modules/thebeast-core/src/main/scala/org/riedelcastro/thebeast/env/doubles/LogLinear.scala

/branches/thefuture-modules/thebeast-core/src/main/scala/org/riedelcastro/thebeast/learn/OnlineLearner.scala

=======================================
---
/branches/thefuture-modules/thebeast-core/src/main/scala/org/riedelcastro/thebeast/env/doubles/LogLinear.scala
Thu Mar 25 19:41:49 2010
+++
/branches/thefuture-modules/thebeast-core/src/main/scala/org/riedelcastro/thebeast/env/doubles/LogLinear.scala
Thu Mar 25 22:04:01 2010
@@ -24,15 +24,22 @@
}

object LogLinearMatch {
-
- def unapply(term:DoubleTerm):Option[(VectorTerm,VectorVar,DoubleTerm)] =
term match {
- case
Exp(Sum(Seq(VectorDotApp(sufficient,weights:VectorVar),bias:DoubleTerm)))
=> Some((sufficient,weights,bias))
- case
Exp(Sum(Seq(VectorDotApp(weights:VectorVar,sufficient),bias:DoubleTerm)))
=> Some((sufficient,weights,bias))
- case Exp(VectorDotApp(sufficient,weights:VectorVar)) =>
Some((sufficient,weights,DoubleConstant(0.0)))
- case Exp(VectorDotApp(weights:VectorVar,sufficient)) =>
Some((sufficient,weights,DoubleConstant(0.0)))
- case LogLinear(sufficient,weights,bias) =>
Some((sufficient,weights,bias))
+ def unapply(term: DoubleTerm): Option[(VectorTerm, VectorVar,
DoubleTerm)] = term match {
+ case Exp(Sum(Seq(VectorDotApp(sufficient, weights: VectorVar), bias:
DoubleTerm))) => Some((sufficient, weights, bias))
+ case Exp(Sum(Seq(VectorDotApp(weights: VectorVar, sufficient), bias:
DoubleTerm))) => Some((sufficient, weights, bias))
+ case Exp(VectorDotApp(sufficient, weights: VectorVar)) =>
Some((sufficient, weights, DoubleConstant(0.0)))
+ case Exp(VectorDotApp(weights: VectorVar, sufficient)) =>
Some((sufficient, weights, DoubleConstant(0.0)))
+ case LogLinear(sufficient, weights, bias) => Some((sufficient,
weights, bias))
+ case _ => None
+ }
+}
+
+object LogLinearLikelihoodMatch {
+ def unapply(term: DoubleTerm): Option[(VectorTerm, VectorVar,
Set[EnvVar[_]],Seq[Env])] = term match {
+ case Objective(theta, ProdOverGroundings(Normalize(Objective(hidden,
LogLinearMatch(feature, weights, _))), data))
+ if (Set(weights) == theta) => Some((feature,weights,hidden,data))
case _ => None
- }
+ }
}

/**
=======================================
---
/branches/thefuture-modules/thebeast-core/src/main/scala/org/riedelcastro/thebeast/learn/OnlineLearner.scala
Thu Mar 25 20:55:13 2010
+++
/branches/thefuture-modules/thebeast-core/src/main/scala/org/riedelcastro/thebeast/learn/OnlineLearner.scala
Thu Mar 25 22:04:01 2010
@@ -19,8 +19,7 @@

def argmax(term: DoubleTerm): ArgmaxResult = {
term match {
- case Objective(theta,ProdOverGroundings(Normalize(Objective(hidden,
LogLinearMatch(feature, weights, _))), data))
- if (Set(weights) == theta) => {
+ case LogLinearLikelihoodMatch(feature,weights,hidden,data) => {
val result = new MutableEnv
result.set(weights,learn(feature,data.map(new
MaskedEnv(_,hidden))))
ArgmaxResult(result, Status.Solved, Math.NEG_INF_DOUBLE)

Reply all
Reply to author
Forward
0 new messages