r65881 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65880‎ | r65881 | r65882 >
Date:21:52, 3 May 2010
Author:daniel
Status:deferred
Tags:
Comment:
proximity builder tweaks and fixes
Modified paths:
  • /trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseProximityStoreBuilder.java (modified) (history)
  • /trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/ProximityStoreBuilder.java (modified) (history)

Diff [purge]

Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseProximityStoreBuilder.java
@@ -123,7 +123,7 @@
124124 * Builds feature vectors. For a specification, refer to ProximityStoreSchema
125125 */
126126 protected int buildFeatures(DatabaseTable t, String conceptField, String featureField, ConceptSetRestriction restriction, double w, String baseBiasField, double baseBiasCoef, String targetBiasField, double targetBiasCoef) throws PersistenceException {
127 - if (!conceptStore.areStatsComplete()) throw new IllegalStateException("statistics need to be built before concept infos!");
 127+ if (!conceptStore.areStatsComplete()) throw new IllegalStateException("statistics need to be built before feature sets!");
128128
129129 String v = ""+w;
130130 if (baseBiasField!=null && baseBiasCoef>0) v = getBiasFormula("B."+baseBiasField, baseBiasCoef) + " * " + v;
@@ -141,7 +141,7 @@
142142 String update = " ON DUPLICATE KEY UPDATE total_weight = total_weight + VALUES(total_weight)";
143143
144144 int n = restriction==null || restriction.doChunk ()
145 - ? executeChunkedUpdate("buildFeatures", "feature#"+t.getName()+"."+featureField, sql, update, t, conceptField)
 145+ ? executeChunkedUpdate("buildFeatures", "feature#"+t.getName()+"."+featureField, sql, update, t, conceptField, 20)
146146 : executeUpdate("buildFeatures::feature#"+t.getName()+"."+featureField, sql+" "+update);
147147
148148 return n;
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/ProximityStoreBuilder.java
@@ -74,20 +74,20 @@
7575 }
7676
7777 public ProximityParameters(Map<?, ?> params, ProximityParameters defaults) {
78 - selfWeight = params.containsKey("selfWeight") ? ((Number)params.get("proximity.selfWeight")).doubleValue() : defaults.selfWeight;
79 - proximityThreshold = params.containsKey("threshold") ? ((Number)params.get("proximity.threshold")).doubleValue() : defaults.proximityThreshold;
 78+ selfWeight = params.containsKey("selfWeight") ? ((Number)params.get("selfWeight")).doubleValue() : defaults.selfWeight;
 79+ proximityThreshold = params.containsKey("threshold") ? ((Number)params.get("threshold")).doubleValue() : defaults.proximityThreshold;
8080
81 - downWeight = params.containsKey("downWeight") ? ((Number)params.get("proximity.downWeight")).doubleValue() : defaults.downWeight;
82 - downBiasCoef = params.containsKey("downBiasCoef") ? ((Number)params.get("proximity.downBiasCoef")).doubleValue() : defaults.downWeight;
 81+ downWeight = params.containsKey("downWeight") ? ((Number)params.get("downWeight")).doubleValue() : defaults.downWeight;
 82+ downBiasCoef = params.containsKey("downBiasCoef") ? ((Number)params.get("downBiasCoef")).doubleValue() : defaults.downWeight;
8383
84 - upWeight = params.containsKey("upWeight") ? ((Number)params.get("proximity.upWeight")).doubleValue() : defaults.upWeight;
85 - upBiasCoef = params.containsKey("upBiasCoef") ? ((Number)params.get("proximity.upBiasCoef")).doubleValue() : defaults.upBiasCoef;
 84+ upWeight = params.containsKey("upWeight") ? ((Number)params.get("upWeight")).doubleValue() : defaults.upWeight;
 85+ upBiasCoef = params.containsKey("upBiasCoef") ? ((Number)params.get("upBiasCoef")).doubleValue() : defaults.upBiasCoef;
8686
87 - inWeight = params.containsKey("inWeight") ? ((Number)params.get("proximity.inWeight")).doubleValue() : defaults.inWeight;
88 - inBiasCoef = params.containsKey("inBiasCoef") ? ((Number)params.get("proximity.inBiasCoef")).doubleValue() : defaults.inBiasCoef;
 87+ inWeight = params.containsKey("inWeight") ? ((Number)params.get("inWeight")).doubleValue() : defaults.inWeight;
 88+ inBiasCoef = params.containsKey("inBiasCoef") ? ((Number)params.get("inBiasCoef")).doubleValue() : defaults.inBiasCoef;
8989
90 - outWeight = params.containsKey("outWeight") ? ((Number)params.get("proximity.outWeight")).doubleValue() : defaults.outWeight;
91 - outBiasCoef = params.containsKey("outBiasCoef") ? ((Number)params.get("proximity.outBiasCoef")).doubleValue() : defaults.outBiasCoef;
 90+ outWeight = params.containsKey("outWeight") ? ((Number)params.get("outWeight")).doubleValue() : defaults.outWeight;
 91+ outBiasCoef = params.containsKey("outBiasCoef") ? ((Number)params.get("outBiasCoef")).doubleValue() : defaults.outBiasCoef;
9292 }
9393 }
9494

Status & tagging log