示例#1
0
  public static void initData4LastFM(Preprocessing pr) {
    Dbconnection dbconn = Dbconnection._getConn();
    try {
      // Build tag set for counting
      pr.buildTags(dbconn.getResultSet(GlobalSQLQuery.GETVIEW_ARTIST_TAG));

      System.out.println("Tags: " + Environment.hm_tag_artistset.size());
      System.out.println("Artist: " + Environment.hm_artist_tag.size());
      // Running PCA
      // executePCAFM(pr);
      // Calculate TF-IDF & normalization
      // pr.calTF_IDF();

      // pr.writeBookmark_Tags(new File("Output4Stats/matrix4lastfm"));
    } catch (SQLException sqlEx) {
      System.out.println("SQL exception...");
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
示例#2
0
  public static void initData4Delicious(Preprocessing pr) {
    // Preprocessing pr = new Preprocessing();
    Dbconnection dbconn = Dbconnection._getConn();
    try {
      // Build tag set for counting
      pr.buildTags(dbconn.getResultSet(GlobalSQLQuery.GETVIEWTAG));
      pr.sensorToken();

      // Build tags for each bookmark
      pr.buildBookmark_Tags(dbconn.getResultSet(GlobalSQLQuery.GETBOOKMARK_TAG));

      // Build User Relations
      // pr.buildContactRelation(new File(
      // "Data/Delicious/user_contacts-timestamps.dat"));

      // Build user list
      // pr.buildUserList(dbconn.getResultSet(GlobalSQLQuery.GETUSER));

      // Print statistical data
      System.out.println("Size tags: " + Environment.hm_token_weight.size());
      System.out.println("Size bookmark-tags: " + Environment.hm_bookmark_tag.size());

      pr.buildTagChecking(dbconn.getResultSet(GlobalSQLQuery.GETTAG));
      System.out.println("Size true-tags: " + Environment.tagSet.size());

      // Calculate TF-IDF & normalization
      pr.calTF_IDF();

      // pr.writeBookmark_Tags(new File("Output4Stats/matrix"));
      // writeBookmark_Tags_ARFF(new File("matrix_arff.arff"));
      // writeBookmark_Tags_Matlab(new File("matrix_matlab_try_1"), new
      // File(
      // "bm_index_try_1"));
    } catch (SQLException sqlEx) {
      System.out.println("SQL exception...");
    }
  }