/** * Normalizes scores so that sum of their squares = 1. This method may be * overridden so as to yield different normalizations. */ protected void normalizeScores() { double hub_ssum = 0; double auth_ssum = 0; for (V v : graph.getVertices()) { double hub_val = getOutputValue(v).hub; double auth_val = getOutputValue(v).authority; hub_ssum += (hub_val * hub_val); auth_ssum += (auth_val * auth_val); } hub_ssum = Math.sqrt(hub_ssum); auth_ssum = Math.sqrt(auth_ssum); for (V v : graph.getVertices()) { HITS.Scores values = getOutputValue(v); setOutputValue(v, new HITS.Scores(values.hub / hub_ssum, values.authority / auth_ssum)); } }
/** * Normalizes scores so that sum of their squares = 1. This method may be overridden so as to * yield different normalizations. */ protected void normalizeScores() { double hub_ssum = 0; double auth_ssum = 0; for (N v : graph.nodes()) { double hub_val = getOutputValue(v).hub; double auth_val = getOutputValue(v).authority; hub_ssum += (hub_val * hub_val); auth_ssum += (auth_val * auth_val); } hub_ssum = Math.sqrt(hub_ssum); auth_ssum = Math.sqrt(auth_ssum); for (N v : graph.nodes()) { HITS.Scores values = getOutputValue(v); setOutputValue(v, new HITS.Scores(values.hub / hub_ssum, values.authority / auth_ssum)); } }
/** * Normalizes scores so that sum of their squares = 1. * This method may be overridden so as to yield different * normalizations. */ protected void normalizeScores() { double hub_ssum = 0; double auth_ssum = 0; for (V v : graph.getVertices()) { double hub_val = getOutputValue(v).hub; double auth_val = getOutputValue(v).authority; hub_ssum += (hub_val * hub_val); auth_ssum += (auth_val * auth_val); } hub_ssum = Math.sqrt(hub_ssum); auth_ssum = Math.sqrt(auth_ssum); for (V v : graph.getVertices()) { HITS.Scores values = getOutputValue(v); setOutputValue(v, new HITS.Scores( values.hub / hub_ssum, values.authority / auth_ssum)); } }
/** * Normalizes scores so that sum of their squares = 1. * This method may be overridden so as to yield different * normalizations. */ protected void normalizeScores() { double hub_ssum = 0; double auth_ssum = 0; for (V v : graph.getVertices()) { double hub_val = getOutputValue(v).hub; double auth_val = getOutputValue(v).authority; hub_ssum += (hub_val * hub_val); auth_ssum += (auth_val * auth_val); } hub_ssum = Math.sqrt(hub_ssum); auth_ssum = Math.sqrt(auth_ssum); for (V v : graph.getVertices()) { HITS.Scores values = getOutputValue(v); setOutputValue(v, new HITS.Scores( values.hub / hub_ssum, values.authority / auth_ssum)); } }
/** Updates the value for this node. */ @Override protected double update(N v) { collectDisappearingPotential(v); double v_auth = 0; for (N u : graph.predecessors(v)) { for (E e : graph.edgesConnecting(u, v)) { v_auth += (getCurrentValue(u).hub * getEdgeWeight(u, e).doubleValue()); } } double v_hub = 0; for (N w : graph.successors(v)) { for (E e : graph.edgesConnecting(v, w)) { v_hub += (getCurrentValue(w).authority * getEdgeWeight(w, e).doubleValue()); } } // modify total_input according to alpha if (alpha > 0) { v_auth = v_auth * (1 - alpha) + getNodePrior(v).authority * alpha; v_hub = v_hub * (1 - alpha) + getNodePrior(v).hub * alpha; } setOutputValue(v, new HITS.Scores(v_hub, v_auth)); return Math.max( Math.abs(getCurrentValue(v).hub - v_hub), Math.abs(getCurrentValue(v).authority - v_auth)); }
v_hub = v_hub * (1 - alpha) + getVertexPrior(v).hub * alpha; setOutputValue(v, new HITS.Scores(v_hub, v_auth));
v_hub = v_hub * (1 - alpha) + getVertexPrior(v).hub * alpha; setOutputValue(v, new HITS.Scores(v_hub, v_auth));
v_hub = v_hub * (1 - alpha) + getVertexPrior(v).hub * alpha; setOutputValue(v, new HITS.Scores(v_hub, v_auth));
/** * Code which is executed after each step. In this case, deals with the 'disappearing potential', * normalizes the scores, and then calls <code>super.afterStep()</code>. * * @see #collectDisappearingPotential(Object) */ @Override protected void afterStep() { if (disappearing_potential.hub > 0 || disappearing_potential.authority > 0) { for (N v : graph.nodes()) { double new_hub = getOutputValue(v).hub + (1 - alpha) * (disappearing_potential.hub * getNodePrior(v).hub); double new_auth = getOutputValue(v).authority + (1 - alpha) * (disappearing_potential.authority * getNodePrior(v).authority); setOutputValue(v, new HITS.Scores(new_hub, new_auth)); } disappearing_potential.hub = 0; disappearing_potential.authority = 0; } normalizeScores(); super.afterStep(); }
/** * Code which is executed after each step. In this case, deals with the * 'disappearing potential', normalizes the scores, and then calls * <code>super.afterStep()</code>. * * @see #collectDisappearingPotential(Object) */ @Override protected void afterStep() { if (disappearing_potential.hub > 0 || disappearing_potential.authority > 0) { for (V v : graph.getVertices()) { double new_hub = getOutputValue(v).hub + (1 - alpha) * (disappearing_potential.hub * getVertexPrior(v).hub); double new_auth = getOutputValue(v).authority + (1 - alpha) * (disappearing_potential.authority * getVertexPrior(v).authority); setOutputValue(v, new HITS.Scores(new_hub, new_auth)); } disappearing_potential.hub = 0; disappearing_potential.authority = 0; } normalizeScores(); super.afterStep(); }
/** * Code which is executed after each step. In this case, deals with the * 'disappearing potential', normalizes the scores, and then calls * <code>super.afterStep()</code>. * @see #collectDisappearingPotential(Object) */ @Override protected void afterStep() { if (disappearing_potential.hub > 0 || disappearing_potential.authority > 0) { for (V v : graph.getVertices()) { double new_hub = getOutputValue(v).hub + (1 - alpha) * (disappearing_potential.hub * getVertexPrior(v).hub); double new_auth = getOutputValue(v).authority + (1 - alpha) * (disappearing_potential.authority * getVertexPrior(v).authority); setOutputValue(v, new HITS.Scores(new_hub, new_auth)); } disappearing_potential.hub = 0; disappearing_potential.authority = 0; } normalizeScores(); super.afterStep(); }
/** * Code which is executed after each step. In this case, deals with the * 'disappearing potential', normalizes the scores, and then calls * <code>super.afterStep()</code>. * @see #collectDisappearingPotential(Object) */ @Override protected void afterStep() { if (disappearing_potential.hub > 0 || disappearing_potential.authority > 0) { for (V v : graph.getVertices()) { double new_hub = getOutputValue(v).hub + (1 - alpha) * (disappearing_potential.hub * getVertexPrior(v).hub); double new_auth = getOutputValue(v).authority + (1 - alpha) * (disappearing_potential.authority * getVertexPrior(v).authority); setOutputValue(v, new HITS.Scores(new_hub, new_auth)); } disappearing_potential.hub = 0; disappearing_potential.authority = 0; } normalizeScores(); super.afterStep(); }