id
stringlengths
36
36
text
stringlengths
1
1.25M
57cdc871-9ec3-464e-92be-68c4cbc5199d
public List<String> getFileNames() { return fileNames; }
4d37eded-452b-482a-827f-798740e56c87
public List<String> getMethods() { return methods; }
761b1883-f720-44e4-9f46-1c84853f379b
public PseudolocalizationPipeline getPipeline() { return pipeline; }
5c3f5e77-11f2-484d-bbe1-abc3bb20d6dc
public String getType() { return fileType; }
7a57fd2a-47fc-4997-a6d8-732921c54fe3
public String getVariant() { return variant; }
e4af5a89-45e6-4306-82f6-2aada25e30f7
public boolean isInteractive() { return isInteractive; }
9fa73bbb-9110-49f5-80f6-38e940b0e346
public boolean isOverwrite() { return isOverwrite; }
a9d5a322-16fc-4f95-bfc1-49bc762e81f9
public static void main(String[] args) throws IOException { Pseudolocalizer pseudolocalizer = new Pseudolocalizer(); PseudolocalizerArguments arguments = new PseudolocalizerArguments(args); pseudolocalizer.run(arguments); }
b5e33929-4224-4f85-b4f1-d8edd2f8f61b
void run(PseudolocalizerArguments arguments) throws IOException { List<String> fileNames = arguments.getFileNames(); PseudolocalizationPipeline pipeline = arguments.getPipeline(); if (arguments.isInteractive()) { runStdin(pipeline); return; } if (fileNames...
ddda40cb-0116-43d4-8574-356c8e2d317e
private List<Message> readAndProcessMessages(PseudolocalizationPipeline pipeline, MessageCatalog msgCat, InputStream inputStream) throws IOException { List<Message> processedMessages = new ArrayList<Message>(); ReadableMessageCatalog input = msgCat.readFrom(inputStream); ...
7ee011c2-18e4-43d0-9016-a584c3404b68
private void runStdin(PseudolocalizationPipeline pipeline) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String line; System.out.println("Enter text to pseudolocalize:"); while ((line = reader.readLine()) != null) { if (lin...
55df50a3-23c6-4a82-b5b5-2b11c02b12df
private void writeMessages(MessageCatalog msgCat, List<Message> messages, OutputStream outputStream) throws IOException { // write messages WritableMessageCatalog output = msgCat.writeTo(outputStream); try { for (Message msg : messages) { output.writeMessa...
7a738d4b-2c25-45ad-824f-15cd34a5c5ba
public FileCollector(String path, String fileRegex, String outputFile) { this.rootPath = path; this.outputFile = outputFile; this.filePattern = Pattern.compile(fileRegex); }
095dfbfa-5666-40a5-835e-1f9e20eaae65
public void collect() { List<String> fileNames = new ArrayList<String>(); collect(rootPath, fileNames); try { writeToOutputFile(fileNames); } catch (IOException ex) { throw new CollectFileException("Fail to collect files under path: " + rootPath, ex); } ...
c4d772b9-f7b4-4098-89eb-f0f42602b754
private void collect(String rootPath, List<String> fileNames) { File dir = new File(rootPath); File[] files = dir.listFiles(); if (files == null) { return; } for (int i = 0; i < files.length; i++) { File file = files[i]; if (file.isDirectory())...
cdba14bb-6d65-4627-a24e-46362b2e5cf1
public void writeToOutputFile(List<String> fileNames) throws IOException { if (fileNames != null) { BufferedWriter out = null; try { File output = new File(outputFile); if (!output.exists()) { output.createNewFile(); } ...
6c9d94ca-efdc-498f-8d93-6ae5e6e8e9e6
public CollectFileException() { super(); }
e6f97b9a-99fd-46a5-a822-900420545dd7
public CollectFileException(String message) { super(message); }
e0462376-a6fc-4463-bfc2-e214a70f9692
public CollectFileException(String message, Throwable cause) { super(message, cause); }
7c76b7dc-6c49-425f-8bd3-e1160deb0584
public CollectFileException(Throwable cause) { super(cause); }
8bb1ac69-c1d0-4742-8810-7a54b458ba09
public AppTest( String testName ) { super( testName ); }
5d426ca5-3d06-4f90-9bc2-aea01416cb03
public static Test suite() { return new TestSuite( AppTest.class ); }
db3ea399-0dd3-4407-958a-f073bd24bd12
public void testApp() { assertTrue( true ); }
9858d766-3bec-4a41-b260-ae92372d84c1
public void testCollectFile() { // FileCollector collector = new FileCollector("D:\\Projects\\amarosa_6-3_TELUS\\JEDI\\jedi-assembly\\target\\jedi-6.3.0-TELUS-XMN-SNAPSHOT\\localStorage", ".*[\\\\/]en.js$", "WebBatch.txt"); FileCollector collector = new FileCollector("D:\\Projects\\amarosa_6-3_TELUS\\JED...
46fb97a9-62a0-4ba2-9e52-2bc1bc4a5bc6
@Test public void testReplaceStrConnector() { String str = "{HINT_TEXT:\"If you make international calls, the included plan mon the applicable international rate.\","+ "AUTO_PURCHASE_DESCRIPTION:\"Auto Purchase feature ensures you will never run out of calling credits. The \" +"+ " \"selected packag...
49cb2d86-9418-443c-b278-81af3a7dc564
public Record(String line) { String[] ls = line.split(","); userID = Integer.parseInt(ls[0]); latitude = Double.parseDouble(ls[1]); longitude = Double.parseDouble(ls[2]); time = ls[3]; try { timestamp = sdf.parse(time).getTime() / 1000; } catch (ParseException e) { System.out.println(ls[3] + "\n" + ...
4d812f9f-bf1e-4c18-8659-7948eb598de4
public double distanceTo(Record o) { double d2r = (Math.PI/180); double distance = 0; double longiE = o.longitude; double latiE = o.latitude; try { double dlong = (longiE - longitude) * d2r; double dlati = (latiE - latitude) * d2r; double a = Math.pow(Math.sin(dlati/2.0), 2) + Math.cos(latitu...
464ce646-d9b8-41bc-b705-e37cd3712a7a
@Override public int compareTo(Record o) { return (int) (this.timestamp - o.timestamp); }
d044f732-78ca-455e-8749-1d7dec0ad05b
@Override public String toString() { return String.format("%d,%.6f,%.6f,%s,%d", userID, latitude, longitude, time, locID); }
c82539a6-6e74-4087-88b8-ebb50a0a58f6
public String GPS() { return String.format("%.3f%.3f", latitude, longitude); }
e0f32a88-3490-4878-8e6d-5b5936fbde10
public static void main(String[] args) { // test purpose String test = "0,37.806167,-122.450135,2010-04-14 04:32:30,0"; Record r = new Record(test); System.out.println(r); }
2b69ccd3-77bc-4645-94a0-5004b4b0c4a0
User( Record r ) { userID = r.userID; records = new LinkedList<Record>(); friends = new HashSet<Integer>(); locs = new HashSet<String>(); records.add(r); if ( ! allUserSet.containsKey(r.userID)) allUserSet.put(r.userID, this); }
8b79476e-12ac-44de-bf68-775e704190b6
User (int uid) { if (! allUserSet.containsKey(uid)) { userID = uid; records = new LinkedList<Record>(); friends = new HashSet<Integer>(); locs = new HashSet<String>(); try { BufferedReader fin = new BufferedReader(new FileReader(String.format("%s/%d", userDir, uid))); // add friends; St...
802cd191-7767-4223-ae0d-b71e39b3e5d0
public static void addAllUser() { File dir = new File(userDir); String[] fileNames = dir.list(); for (String fn : fileNames) { new User(Integer.parseInt(fn)); } System.out.println(String.format("Create %d users in total.", allUserSet.size())); }
e0b2a51f-50e8-4cdb-8667-131a7635ec48
public static void addTopkUser( int k ) { try { BufferedReader fin = new BufferedReader( new FileReader("res/userCheckins-rank.txt")); String l = null; int c = 0; while (( l = fin.readLine()) != null ) { String[] ls = l.split("\t"); int uid = Integer.parseInt(ls[0]); new User(uid); c ++; ...
7706a2c2-7d24-4b6e-882b-f68c9ba60f5f
@Override public String toString() { return String.format("User %d: #friend -- %d; #records -- %d", userID, friends.size(), records.size()); }
fa924532-3f08-445b-94fb-ece26ff101fe
HashSet<String> getLocations() { if (locs.size() == 0) { for (Record r : records) { if ( ! locs.contains(r.GPS()) ) locs.add( r.GPS() ); } } return locs; }
ee3e10ca-5894-443f-81ab-49771443ff37
public double locationWeight( Record rt ) { double weight = 0; double dist = 0; for (Record r : records) { dist = rt.distanceTo(r); dist = Math.exp(- User.para_c * dist); weight += dist; } // System.out.println(String.format("User %d Cnt: %d, records size %d, weight %g", userID, cnt, records.size(...
b206163f-4485-4f79-a2cc-79e321234e52
public static void main(String[] args) { // for (int i = 0; i <= 335; i++) { // User u0 = new User(i); // System.out.println(u0.getLocations().size()); // } // User.addAllUser(); getUserRecordsNRanking(); }
2cd5ac3a-d7b3-4c78-9124-8018d4b0544d
@Override public int compareTo(User oth) { return this.records.size() - oth.records.size(); }
13a17bd6-4f13-4508-9812-91e7130a493c
private static void getUserRecordsNRanking() { User.addAllUser(); List<User> users = new LinkedList<User>(User.allUserSet.values()); Collections.sort(users); try { BufferedWriter fout = new BufferedWriter( new FileWriter( "res/userCheckins-rank.txt" )); for (int i = users.size() - 1; i >= 0; i--) { ...
78cd2f32-c10f-489f-bd9e-56c98cbe6dc6
MiningFramework() { long t_start = System.currentTimeMillis(); System.out.println("Start create MiningFramework instance, and construct User instances."); User.addAllUser(); friendPair = new ArrayList<int[]>(); distantFriend = new ArrayList<int[]>(); nonFriendMeeting = new ArrayList<int[]>(); friendMap = ...
69c2dd3a-b69a-4950-b61b-e066e7d9279c
public void locationDistancePowerLaw( ) { for (int id : User.allUserSet.keySet()) { MiningFramework.locationDistancePowerLaw(id); } }
3ac70ae9-0458-4884-bc4e-d65961ba9cac
public static void locationDistancePowerLaw( int uid ) { try { User u = new User(uid); BufferedWriter fout = new BufferedWriter( new FileWriter (String.format("res/distance-%d.txt", u.userID))); for (int i = 0; i < u.records.size(); i++) { for (int j = i + 1; j < u.records.size(); j++ ) { double d ...
b4576a38-3336-48d9-a232-099065a0284c
private boolean inFriendPair(int uaid, int ubid) { if (friendMap.containsKey(uaid) && friendMap.get(uaid).contains(ubid)) return true; else if (friendMap.containsKey(ubid) && friendMap.get(ubid).contains(uaid)) return true; else return false; }
8b662f2b-ba5c-4077-9478-f2a4f7705576
public void allPairMeetingFreq(boolean IDorDist) { long t_start = System.currentTimeMillis(); System.out.println("allPairMeetingFreq starts"); int K = User.allUserSet.size(); System.out.println(String.format("uary.length: %d", K)); for (int i = 0; i < K; i++) { User ua = User.allUserSet.get(i); HashSet<...
1a9247ba-b0cc-4be5-b70a-2641a4c6355a
public void writeMeetingFreq() { try { BufferedWriter fout = new BufferedWriter(new FileWriter("res/freq.txt")); for (int i : meetFreq.keySet()) { for (int j : meetFreq.get(i).keySet()) { // write out id_1, id_2, meeting frequency, distance fout.write(String.format("%d\t%d\t%d\t", i, j, meetFreq.g...
9c0bf81f-7515-4c01-9e50-4d1dfa4b87c9
public ArrayList<int[]> remoteFriends() { // iterate over all user pair long t_start = System.currentTimeMillis(); int c = 0; for (int a : friendMap.keySet()) { for (int b : friendMap.get(a)) { System.out.println(String.format("Calculating user with id %d and %d", a, b)); int cnt = 0; if (a <= b)...
5b357a75-3409-4d8b-b62b-2e130331eea2
public void writeRemoteFriend() { try { BufferedWriter fout = new BufferedWriter(new FileWriter("res/remoteFriend.txt")); for (int i = 0; i < distantFriend.size(); i++) { // write out u_1, u_2, distance, meeting frequency int uaid = distantFriend.get(i)[0]; int ubid = distantFriend.get(i)[1]; fo...
3addbc86-544c-408f-b3cd-ae9af222ca4b
public ArrayList<int[]> nonFriendsMeetingFreq() { int K = User.allUserSet.size(); for (int i = 0; i < K; i++ ) for (int j = i+1; j < K; j++) { if (nonFriend(i, j) && meetFreq.get(i).get(j) > 0) { int[] tuple = {i, j, meetFreq.get(i).get(j)}; nonFriendMeeting.add(tuple); } } return nonFrien...
d340436c-03fd-41d4-ac32-90f138e28e52
private boolean nonFriend(int aid, int bid) { if (friendMap.containsKey(aid)) { if (friendMap.get(aid).contains(bid)) { return false; } else { return true; } } else { return true; } }
af8572fb-a935-460b-988f-682355b8d860
public void writeNonFriendsMeeting(){ try { BufferedWriter fout2 = new BufferedWriter(new FileWriter("nonFriendsMeeting.txt")); for (int i = 0; i < nonFriendMeeting.size(); i++) { // write out u_1, u_2, meeting frequency fout2.write(String.format("%d\t%d\t%d\n", nonFriendMeeting.get(i)[0], nonFriendMeet...
df80a9c8-fd79-4235-9f3a-0663d32e32a6
public static void pairAnalysis( int uaid, int ubid ) { User ua = new User(uaid); User ub = new User(ubid); // 1. get the co-locations and the corresponding meeting freq HashMap<String, Integer> mf = meetingFreq(ua, ub); // 2. get the total meeting frequency int sum = 0; for (int i : mf.values()) { sum...
80033d3e-af52-4c12-ab04-75ee24468e44
private static HashMap<String, Integer> meetingFreq( User ua, User ub ) { HashMap<String, Integer> colofreq = new HashMap<String, Integer>(); int aind = 0; int bind = 0; while (aind < ua.records.size() && bind < ub.records.size()) { Record ra = ua.records.get(aind); Record rb = ub.records.get(bind); ...
040b9b0f-05af-45f1-8750-1cc51c2ce709
@SuppressWarnings("unused") private static int totalMeetingFreq( int uaid, int ubid ) { User ua = new User(uaid); User ub = new User(ubid); HashMap<String, Integer> mf = meetingFreq(ua, ub); int sum = 0; for (int f : mf.values()) { sum += f; } return sum; }
ac935ac8-5c29-4c5f-b1f8-f676219309ea
@SuppressWarnings("unused") private static double[] locIDBasedSumLogMeasure(int uaid, int ubid) { User ua = new User(uaid); User ub = new User(ubid); int aind = 0; int bind = 0; long lastMeet = 0; double freq = 0; double measure = 0; while (aind < ua.records.size() && bind < ub.records.size()) { Rec...
3cae25aa-b485-454b-be5c-0d128fdff305
@SuppressWarnings("unused") private static double[] locIDBasedARCTANweightEvent(int uaid, int ubid) { User ua = new User(uaid); User ub = new User(ubid); LinkedList<Record> meetingEvent = new LinkedList<Record>(); LinkedList<Double> meetingRawWeight = new LinkedList<Double>(); int aind = 0; int bind = 0; ...
786a62c7-0ce7-4392-b7f8-ddb5bdb94aaf
@SuppressWarnings("unused") private static double[] PAIRWISEweightEvent(int uaid, int ubid, BufferedWriter fout, int friend_flag, boolean IDorDist, boolean entroIDorDist, String RhoMethod, String weightMethod, String combMethod, int dependence, int sampleRate ) throws IOException { User ua = new User(uaid); ...
849cf3f8-4c91-4500-8903-aa7a6a89365a
@SuppressWarnings("unused") private static double[] locIDBasedOneMinusExpCONSECUTIVEweightEvent(int uaid, int ubid) { User ua = new User(uaid); User ub = new User(ubid); LinkedList<Record> meetingEvent = new LinkedList<Record>(); LinkedList<Double> meetingRawWeight = new LinkedList<Double>(); int aind = 0; ...
7c825797-03e3-4435-86d0-75c5b694d47a
public static double[] distanceBasedSumLogMeasure(int uaid, int ubid, boolean printFlag) { User ua = new User(uaid); User ub = new User(ubid); Calendar cal1 = Calendar.getInstance(); Calendar cal2 = Calendar.getInstance(); // get the co-locating event ArrayList<double[]> coloEnt = meetingWeight(ua, ub, M...
63818a86-c3cc-483c-b983-7ba9d0798bb4
public static double[] distanceBasedSumLogMeasure(int uaid, int ubid) { return distanceBasedSumLogMeasure(uaid, ubid, false); }
3639f376-cf32-4818-9e36-b9d8a642685b
public static void writeOutDifferentMeasures(double para_c, int sampleRate) { System.out.println("==========================================\nStart writeOutDifferentMeasures"); long t_start = System.currentTimeMillis(); User.addAllUser(); // User.addTopkUser(2800); long t_mid = System.currentTimeMillis(); ...
37988aa2-52ab-4259-8221-23a85aab2889
private static ArrayList<double[]> meetingWeight( User ua, User ub, double dist_threshold ) { ArrayList<double[]> coloEnt = new ArrayList<double[]>(); int aind = 0; int bind = 0; while (aind < ua.records.size() && bind < ub.records.size()) { Record ra = ua.records.get(aind); Record rb = ub.records.get(bin...
0babe470-0942-4d93-a43d-2434c80b2b7b
@SuppressWarnings("unused") private static ArrayList<double[]> meetingWeight( User ua, User ub ) { return meetingWeight(ua, ub, MiningFramework.distance_threshold); }
08d2ecbe-75dd-4e83-8e99-b4200c140d63
private static TreeMap<String, Integer> locationDistribution( User ua ) { TreeMap<String, Integer> freq = new TreeMap<String, Integer>(); for (Record r : ua.records) { if (freq.containsKey(r.GPS())) { int tmp = freq.get(r.GPS()); freq.put(r.GPS(), tmp + 1); } else { freq.put(r.GPS(), 1); } } ...
a070f325-b9ca-4662-9804-9318a7d95f32
public static void main(String argv[]) { // MiningFramework cf = new MiningFramework(); // cf.locationDistancePowerLaw(); // cf.allPairMeetingFreq(false); // cf.writeMeetingFreq(); // cf.remoteFriends(); // cf.writeRemoteFriend(); // cf.nonFriendsMeetingFreq(); // cf.writeNonFriendsMeeting(); // in...
91ab0082-a86f-4764-a183-90b42d60884b
public DataPreProcessor() { long t_start = System.currentTimeMillis(); System.out.println("Data pre-processing starts ..."); BufferedReader fin = null; int c1=0, c2=0; try { // initialize all users fin = new BufferedReader(new FileReader(rawCheckinsPath)); String l = fin.readLine(); l = fin.readLi...
0ca37af3-c65f-457d-9f2e-a39a0a526e0f
public void generateUserFiles() { long t_start = System.currentTimeMillis(); System.out.println("generateUserFiles starts ..."); File dir = new File(userDir); dir.mkdir(); for (int uid : users.keySet()) { try { BufferedWriter fout = new BufferedWriter(new FileWriter(userDir + Integer.toString(uid))); ...
90fb8372-f455-43d1-9737-45c411a2e890
public void userDistribution() { try { BufferedWriter fout = new BufferedWriter(new FileWriter("res/checkinsN-dist.txt")); for (int uid : users.keySet()) fout.write(Integer.toString(users.get(uid).size()) + "\n"); fout.close(); fout = new BufferedWriter(new FileWriter("res/friendsN-dist")); for...
9a614153-cbfa-45f1-9c0e-5a8a62fecd09
public static void main(String[] args) { DataPreProcessor dpp = new DataPreProcessor(); // dpp.generateUserFiles(); dpp.userDistribution(); System.out.println(String.format("#user: %d\t#user with friends: %d", users.size(), friendship.size())); }
670ba574-db22-49d8-874a-28b2e362e9c8
public static void initializeUsers() { long t_start = System.currentTimeMillis(); System.out.println("Start initializeUsers."); User.addAllUser(); long t_mid = System.currentTimeMillis(); System.out.println(String.format("Initialize all users in %d seconds", (t_mid - t_start)/1000)); }
903f3f44-6ede-4eaa-847b-abb4c6963b5a
public static LinkedList<Integer> shareLocationCount() { long t_start = System.currentTimeMillis(); System.out.println("shareLocationCount starts ..."); HashMap<Integer, User> users = User.allUserSet; int cnt = 0; // get the first level iterator Object[] array = users.values().toArray(); for (int i = 0...
29787b1b-7659-44a2-bcf1-799946011202
@SuppressWarnings("unused") private static void writeOutPairColocations() { System.out.println("Start writeOutPairColocations."); try { BufferedWriter fout = new BufferedWriter(new FileWriter("res/colocations.txt")); String l = null; for (User ua : User.allUserSet.values()) { for (int ubid : ua.friend...
b6521a43-9d38-4511-8c07-593c7e251dd7
public static LinkedList<Double> RenyiEntropyDiversity() { long t_start = System.currentTimeMillis(); int c1 = 0, c2 = 0; double avg_freq1 = 0, avg_freq2 = 0; for (int i = 0; i < FrequentPair.size(); i++) { int uaid = FrequentPair.get(i)[0]; int ubid = FrequentPair.get(i)[1]; // 1. calculate the number...
c37670dc-185c-4877-90da-0be94352cf6a
private static HashMap<Long, Integer> coLocationFreq( int user_a_id, int user_b_id) { LinkedList<Record> ras = User.allUserSet.get(user_a_id).records; LinkedList<Record> rbs = User.allUserSet.get(user_b_id).records; HashMap<Long, Integer> loc_cnts = new HashMap<Long, Integer>(); // find records of user_a in ...
ab5b08b9-cff8-4189-9509-0bf2a05704f8
private static void initialTopKPair(int topk) { System.out.println("Start initialTopKPair."); try { BufferedReader fin = new BufferedReader(new FileReader(String.format("topk_freqgt1-%d.txt", topk))); String l = null; BufferedReader fin2 = new BufferedReader(new FileReader(String.format("topk_colocations-%...
02873cff-3238-436e-868f-260263ba34db
public static LinkedList<Double> weightedFrequency() { long t_start = System.currentTimeMillis(); /* * The calculation of location entropy is not efficient. * The original execution time in HP laptop is 470s. * After we factor out the location entropy calculation, * now the execution time in HP is 4s. ...
69db4fbe-b7c7-4d9b-ac9f-78925119c96b
private static void writePairMeasure() { System.out.println("Start writePairMeasure"); System.out.println(String.format("%d %d %d %d", renyiDiversity.size(), weightedFreq.size(), frequency.size(), FrequentPair.size())); long t_start = System.currentTimeMillis(); try { BufferedWriter fout = new BufferedWriter...
048022d3-9455-4e83-96f9-69c3acf9d6dc
private static HashMap<Long, Double> locationEntropyIDbased() { long t_start = System.currentTimeMillis(); HashMap<Long, Double> loc_entro = new HashMap<Long, Double>(); HashMap<Long, HashMap<Integer, Integer>> loc_user_visit = new HashMap<Long, HashMap<Integer, Integer>>(); HashMap<Long, Integer> loc_total_vis...
5ad4fa47-978a-4630-8995-36e70d851470
private static HashMap<String, Double> locationEntropyGPSbased() { long t_start = System.currentTimeMillis(); HashMap<String, Double> loc_entro = new HashMap<String, Double>(); HashMap<String, HashMap<Integer, Integer>> loc_user_visit = new HashMap<String, HashMap<Integer, Integer>>(); HashMap<String, Integer> ...
9e4cc29c-c044-4a3e-8202-e1c9aa53b48b
public static void writeLocationEntropy(boolean IDflag, int sampleRate) { // initialize users int numUser = User.allUserSet.size(); Random r = new Random(); try { HashMap<Integer, User> sampleSet = new HashMap<Integer, User>(); int c = 0; for (User u : User.allUserSet.values()) { if (r.nextDouble()...
6d86a510-654e-4bc6-bcb7-f614406af2d8
public static void writeLocationEntropy(boolean IDflag) { writeLocationEntropy(IDflag, 100); }
9152f388-fb67-402c-b5e8-b1fadeb8b856
public static HashMap<Long, Double> readLocationEntropyIDbased(int sampleRate) { if (locationEntropy.isEmpty()) { try { BufferedReader fin; if (sampleRate <= 100) { fin = new BufferedReader( new FileReader(String.format("res/locationEntropy-%ds.txt", sampleRate))); System.out.println(String.forma...
7d64d619-0707-401f-8d53-25ea21d3030b
public static HashMap<Long, Double> readLocationEntropyIDbased() { return readLocationEntropyIDbased(101); }
63c58e7b-b36b-41ee-9e67-71117cb4e7f7
public static HashMap<String, Double> readLocationEntropyGPSbased( int sampleRate ) { if (GPSEntropy.isEmpty()) { String fname = null; try { BufferedReader fin; if (sampleRate <= 100) { fname = String.format("res/GPSEntropy-%ds.txt", sampleRate); } else { fname = "res/GPSEntropy.txt"; ...
ba12c8ab-48f6-4e5b-b993-3f302c48ef78
public static LinkedList<Double> mutualInformation() { long t_start = System.currentTimeMillis(); /* * Speed boost * the old method is not efficient, because it is not necessary to calculate the * marginal entropy repeatedly. */ HashMap<Integer, Double> entro = new HashMap<Integer,Double>(); for (i...
2713cbdf-2c9a-4644-8a30-addbeeda348b
private static double marginalEntropy(int uid) { User u = User.allUserSet.get(uid); HashMap<Long, Integer> locFreq = new HashMap<Long, Integer>(); // 1. count frequency int totalLocationNum = u.records.size(); for (Record r : u.records) { if (locFreq.containsKey(r.locID)) locFreq.put(r.locID, locFreq.g...
4e73b11b-d64c-476c-89ff-5d53daf1888b
private static double jointEntropy( int uaid, int ubid ) { User a = User.allUserSet.get(uaid); User b = User.allUserSet.get(ubid); HashMap<Long, HashMap<Long, Integer>> locFreq = new HashMap<>(); // 1. count frequency of multi-variables distribution int totalCase = 0; for (Record ar : a.records) { for...
55cdf147-4d87-49ed-be17-544a06509ecd
public static LinkedList<Double> mutualInformation_v2() { long t_start = System.currentTimeMillis(); // 1. calculate the individual probability HashMap<Integer, HashMap<Long, Double>> user_loc_prob = new HashMap<Integer, HashMap<Long, Double>>(); for (int[] p : FrequentPair) { for (int i = 0; i < 2; i++ ) { ...
fc1f36f0-fde7-4818-8de0-8f42ddf437fe
public static LinkedList<Double> interestingnessPAKDD() { long t_start = System.currentTimeMillis(); for (int i = 0; i < FrequentPair.size(); i++ ) { int uaid = FrequentPair.get(i)[0]; int ubid = FrequentPair.get(i)[1]; HashSet<String> colocs = FrequentPair_CoLocations.get(i); // 1. calculate the coloca...
705a1a9e-c195-45db-832c-dd7ba7fe7850
private static double coLocationScore( int user_a_id, int user_b_id, HashSet<String> colocs ) { LinkedList<Record> ra = User.allUserSet.get(user_a_id).records; HashMap<String, LinkedList<Record>> raco = new HashMap<String, LinkedList<Record>>(); LinkedList<Record> rb = User.allUserSet.get(user_b_id).records; Ha...
9c1259e5-5a79-4edd-849f-3a11e9fc82f0
public static LinkedList<Double> mutualEntropyOnColocation() { long t_start = System.currentTimeMillis(); // calculate the marginal entropy of each user only once. HashMap<Integer, Double> entro = new HashMap<Integer, Double>(); for (int i = 0; i < FrequentPair.size(); i++) { // get two user User a = User...
e460142e-9c36-4bcb-8cf4-aa8c2249274b
private static double marginalEntropy(int uid, HashSet<String> locs) { User u = User.allUserSet.get(uid); HashMap<Long, Integer> locFreq = new HashMap<Long, Integer>(); // 1. count frequency on each locations in location set int totalLocationNum = 0; for (Record r : u.records) { if (locs.contains(r.locID))...
3ad9fc97-8041-4149-a6f3-0b83c6c61843
private static double jointEntropy( int uaid, int ubid, HashSet<String> locs ) { User a = User.allUserSet.get(uaid); User b = User.allUserSet.get(ubid); HashMap<Long, HashMap<Long, Integer>> locFreq = new HashMap<Long, HashMap<Long, Integer>>(); // 1. count frequency over given location set int totalCase = 0;...
e350b73f-dede-4eeb-a1df-8a93dafb6dbd
public static LinkedList<Double> mutualEntropyOnColocation_v2() { long t_start = System.currentTimeMillis(); // 1. calculate the individual probability HashMap<Integer, HashMap<Long, Double>> user_loc_prob = new HashMap<Integer, HashMap<Long, Double>>(); for (int i = 0; i < FrequentPair.size(); i++) { int[] ...
ed3b7840-d3ca-40f6-84e8-c39bab2c6857
public static LinkedList<Double> mutualEntropyOnColocation_v3() { long t_start = System.currentTimeMillis(); // 1. calculate the individual probability HashMap<Integer, HashMap<Long, Double>> user_loc_prob = new HashMap<Integer, HashMap<Long, Double>>(); for (int i = 0; i < FrequentPair.size(); i++) { int[] ...
69956888-7059-4280-b786-ac72090d53c1
public static LinkedList<Double> relativeMutualEntropy() { for (int i = 0; i < FrequentPair.size(); i++) { int uaid = FrequentPair.get(i)[0]; int ubid = FrequentPair.get(i)[1]; HashSet<String> locs = FrequentPair_CoLocations.get(i); double entroA = marginalEntropy(uaid, locs); double entroB = marginalE...
cb43e564-fb40-4af4-b066-f4cec31f8c96
@SuppressWarnings("unused") private static void writeThreeMeasures(String filename) { try{ BufferedWriter fout = new BufferedWriter(new FileWriter(filename)); // output Renyi entropy diversity for (double d : renyiDiversity) { fout.write(Double.toString(d) + "\t"); } fout.write("\n"); // output...
f04657b7-a6ee-4d11-8912-8188353fe23e
public static void main(String argv[]) { // 1. find frequent user pair initializeUsers(); shareLocationCount(); // 2. calculate feature one -- Renyi entropy based diversity RenyiEntropyDiversity(); // // 3. calculate feature two -- weighted frequency, and frequency weightedFrequency(); writePairMeasure(...
d36777ed-7d39-443a-be05-385b854b5969
public static void evaluateSIGMOD() { // initialize top users initializeUsers(); initialTopKPair(5000); RenyiEntropyDiversity(); weightedFrequency(); writePairMeasure(); }