public void printTopWords (PrintStream out, int numWords, boolean usingNewLines) { if (dmrParameters != null) { setAlphas(); } super.printTopWords(out, numWords, usingNewLines); }
public void printTopWords (PrintStream out, int numWords, boolean usingNewLines) { if (dmrParameters != null) { setAlphas(); } super.printTopWords(out, numWords, usingNewLines); }
public void printTopWords (PrintStream out, int numWords, boolean usingNewLines) { if (dmrParameters != null) { setAlphas(); } super.printTopWords(out, numWords, usingNewLines); }
/** * Set alpha based on features in an instance */ public void setAlphas(Instance instance) { // we can't use the standard score functions from MaxEnt, // since our features are currently in the Target. FeatureVector features = (FeatureVector) instance.getTarget(); if (features == null) { setAlphas(); return; } double[] parameters = dmrParameters.getParameters(); alphaSum = 0.0; smoothingOnlyMass = 0.0; for (int topic = 0; topic < numTopics; topic++) { alpha[topic] = parameters[topic*numFeatures + defaultFeatureIndex] + MatrixOps.rowDotProduct (parameters, numFeatures, topic, features, defaultFeatureIndex, null); alpha[topic] = Math.exp(alpha[topic]); alphaSum += alpha[topic]; smoothingOnlyMass += alpha[topic] * beta / (tokensPerTopic[topic] + betaSum); cachedCoefficients[topic] = alpha[topic] / (tokensPerTopic[topic] + betaSum); } }
setAlphas(data.get(doc).instance);
/** * Set alpha based on features in an instance */ public void setAlphas(Instance instance) { // we can't use the standard score functions from MaxEnt, // since our features are currently in the Target. FeatureVector features = (FeatureVector) instance.getTarget(); if (features == null) { setAlphas(); return; } double[] parameters = dmrParameters.getParameters(); alphaSum = 0.0; smoothingOnlyMass = 0.0; for (int topic = 0; topic < numTopics; topic++) { alpha[topic] = parameters[topic*numFeatures + defaultFeatureIndex] + MatrixOps.rowDotProduct (parameters, numFeatures, topic, features, defaultFeatureIndex, null); alpha[topic] = Math.exp(alpha[topic]); alphaSum += alpha[topic]; smoothingOnlyMass += alpha[topic] * beta / (tokensPerTopic[topic] + betaSum); cachedCoefficients[topic] = alpha[topic] / (tokensPerTopic[topic] + betaSum); } }
setAlphas(data.get(doc).instance);
setAlphas(data.get(doc).instance);
/** * Set alpha based on features in an instance */ public void setAlphas(Instance instance) { // we can't use the standard score functions from MaxEnt, // since our features are currently in the Target. FeatureVector features = (FeatureVector) instance.getTarget(); if (features == null) { setAlphas(); return; } double[] parameters = dmrParameters.getParameters(); alphaSum = 0.0; smoothingOnlyMass = 0.0; for (int topic = 0; topic < numTopics; topic++) { alpha[topic] = parameters[topic*numFeatures + defaultFeatureIndex] + MatrixOps.rowDotProduct (parameters, numFeatures, topic, features, defaultFeatureIndex, null); alpha[topic] = Math.exp(alpha[topic]); alphaSum += alpha[topic]; smoothingOnlyMass += alpha[topic] * beta / (tokensPerTopic[topic] + betaSum); cachedCoefficients[topic] = alpha[topic] / (tokensPerTopic[topic] + betaSum); } }
setAlphas(instance);