Package org.apache.mahout.cf.taste.common

Examples of org.apache.mahout.cf.taste.common.TasteException


      }
    });
    refreshHelper.addDependency(delegate);
    reload();
    if (delegateInMemory == null) {
      throw new TasteException("Failed to load data into memory");
    }
  }
View Full Code Here


        log.debug("Executing SQL update: {}", setPreferenceSQL);
        stmt3.executeUpdate();
      }
    } catch (SQLException sqle) {
      log.warn("Exception while setting preference", sqle);
      throw new TasteException(sqle);
    } finally {
      IOUtils.quietClose(rs);
      IOUtils.quietClose(stmt1);
      IOUtils.quietClose(stmt2);
      IOUtils.quietClose(stmt3);
View Full Code Here

        log.debug("Executing SQL update: {}", setPreferenceSQL);
        stmt2.executeUpdate();
      }
    } catch (SQLException sqle) {
      log.warn("Exception while setting preference", sqle);
      throw new TasteException(sqle);
    } finally {
      IOUtils.quietClose(rs);
      IOUtils.quietClose(stmt1);
      IOUtils.quietClose(stmt2);
      IOUtils.quietClose(conn);
View Full Code Here

    this.factorizer = Preconditions.checkNotNull(factorizer);
    this.persistenceStrategy = Preconditions.checkNotNull(persistenceStrategy);
    try {
      factorization = persistenceStrategy.load();
    } catch (IOException e) {
      throw new TasteException("Error loading factorization", e);
    }
   
    if (factorization == null) {
      train();
    }
View Full Code Here

  private void train() throws TasteException {
    factorization = factorizer.factorize();
    try {
      persistenceStrategy.maybePersist(factorization);
    } catch (IOException e) {
      throw new TasteException("Error persisting factorization", e);
    }
  }
View Full Code Here

      stmt.setFetchDirection(ResultSet.FETCH_FORWARD);
      stmt.setFetchSize(getFetchSize());
      return doItemSimilarity(stmt, itemID1, itemID2);
    } catch (SQLException sqle) {
      log.warn("Exception while retrieving similarity", sqle);
      throw new TasteException(sqle);
    } finally {
      IOUtils.quietClose(null, stmt, conn);
    }
  }
View Full Code Here

      for (int i = 0; i < itemID2s.length; i++) {
        result[i] = doItemSimilarity(stmt, itemID1, itemID2s[i]);
      }
    } catch (SQLException sqle) {
      log.warn("Exception while retrieving item similarities", sqle);
      throw new TasteException(sqle);
    } finally {
      IOUtils.quietClose(null, stmt, conn);
    }
    return result;
  }
View Full Code Here

        allSimilarItemIDs.add(rs.getLong(1));
        allSimilarItemIDs.add(rs.getLong(2));
      }
    } catch (SQLException sqle) {
      log.warn("Exception while retrieving all similar itemIDs", sqle);
      throw new TasteException(sqle);
    } finally {
      IOUtils.quietClose(rs, stmt, conn);
    }
    allSimilarItemIDs.remove(itemID);
    return allSimilarItemIDs.toArray();
View Full Code Here

          boolean terminated = executor.awaitTermination(numEpochs * shuffler.size(), TimeUnit.MICROSECONDS);
          if (!terminated) {
            logger.error("subtasks takes forever, return anyway");
          }
        } catch (InterruptedException e) {
          throw new TasteException("waiting fof termination interrupted", e);
        }
      }

    }

View Full Code Here

      log.debug("Executing SQL update: {}", setPreferenceSQL);
      stmt.executeUpdate();
    } catch (SQLException sqle) {
      if (!POSTGRESQL_DUPLICATE_KEY_STATE.equals(sqle.getSQLState())) {
        log.warn("Exception while setting preference", sqle);
        throw new TasteException(sqle);
      }
    } finally {
      IOUtils.quietClose(null, stmt, conn);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.mahout.cf.taste.common.TasteException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.