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

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


        int secondComma = line.indexOf(',', firstComma + 1);
        float rating = Float.parseFloat(line.substring(firstComma + 1, secondComma));
        prefs.add(new GenericPreference(userID, itemID, rating));
      }
    } catch (IOException ioe) {
      throw new TasteException(ioe);
    }
    return new GenericItemPreferenceArray(prefs);
  }
View Full Code Here


    Context context = null;
    try {
      context = new InitialContext();
      return (DataSource) context.lookup("java:comp/env/" + dataSourceName);
    } catch (NamingException ne) {
      throw new TasteException(ne);
    } finally {
      if (context != null) {
        try {
          context.close();
        } catch (NamingException ne) {
View Full Code Here

 
  private static Properties getPropertiesFromFile(File file) throws TasteException {
    try {
      return getPropertiesFromStream(new FileInputStream(file));
    } catch (FileNotFoundException fnfe) {
      throw new TasteException(fnfe);
    }
  }
View Full Code Here

        return props;
      } finally {
        IOUtils.quietClose(is);
      }
    } catch (IOException ioe) {
      throw new TasteException(ioe);
    }
  }
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 user", 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 user", sqle);
      throw new TasteException(sqle);
    } finally {
      IOUtils.quietClose(null, stmt, conn);
    }
    return result;
  }
View Full Code Here

      log.debug("Executing SQL query: {}", getDiffSQL);
      rs = stmt.executeQuery();
      return rs.next() ? new FixedRunningAverageAndStdDev(rs.getDouble(2), rs.getDouble(3), rs.getInt(1)) : null;
    } catch (SQLException sqle) {
      log.warn("Exception while retrieving diff", sqle);
      throw new TasteException(sqle);
    } finally {
      IOUtils.quietClose(rs, stmt, conn);
    }
  }
View Full Code Here

        result[i] = new FixedRunningAverageAndStdDev(rs.getDouble(2), rs.getDouble(3), rs.getInt(1));
        i++;
      }
    } catch (SQLException sqle) {
      log.warn("Exception while retrieving diff", sqle);
      throw new TasteException(sqle);
    } finally {
      IOUtils.quietClose(rs, stmt, conn);
    }
    return result;
  }
View Full Code Here

        }
      }
      return null;
    } catch (SQLException sqle) {
      log.warn("Exception while retrieving average item pref", sqle);
      throw new TasteException(sqle);
    } finally {
      IOUtils.quietClose(rs, stmt, conn);
    }
  }
View Full Code Here

        doPartialUpdate(updateDiffSQLs[0], itemID, prefDelta, conn);
        doPartialUpdate(updateDiffSQLs[1], itemID, prefDelta, conn);
      }
    } catch (SQLException sqle) {
      log.warn("Exception while updating item diff", sqle);
      throw new TasteException(sqle);
    } finally {
      IOUtils.quietClose(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.