/**
     * Constructor.
     *
     * @param user user whose model is created.
     */
    public FeatureUserIntentModel(U user) {
      Object2DoubleOpenHashMap<F> auxProb = new Object2DoubleOpenHashMap<>();
      auxProb.defaultReturnValue(0.0);

      int[] norm = {0};
      totalData
          .getUserPreferences(user)
          .forEach(
              iv -> {
                featureData
                    .getItemFeatures(iv.id)
                    .forEach(
                        fv -> {
                          auxProb.addTo(fv.id, 1.0);
                          norm[0]++;
                        });
              });

      if (norm[0] == 0) {
        norm[0] = featureData.numFeatures();
        featureData.getAllFeatures().sequential().forEach(f -> auxProb.put(f, 1.0));
      }

      auxProb
          .object2DoubleEntrySet()
          .forEach(
              e -> {
                e.setValue(e.getDoubleValue() / norm[0]);
              });

      this.prob = auxProb;
    }