@Override
    public void update(ChiVertex<Integer, Float> vertex, GraphChiContext context) {
        if (vertex.numOutEdges() == 0) return;

        RealVector latent_factor = ProblemSetup.latent_factors_inmem.getRowAsVector(vertex.getId());
        try {
            double squaredError = 0;
            for(int e=0; e < vertex.numEdges(); e++) {
                float observation = vertex.edge(e).getValue();
                RealVector neighbor = ProblemSetup.latent_factors_inmem.getRowAsVector(vertex.edge(e).getVertexId());
                double prediction = ALS.als_predict(neighbor, latent_factor);
                squaredError += Math.pow(prediction - observation,2);    
            }
 
            synchronized (this) {
                 validation_rmse += squaredError;
            }    
        } catch (Exception err) {
            throw new RuntimeException(err);
        }
    }