The current statistics on each group shows total number of views as it is. Add a Differential Privacy feature so that individual information cannot be revealed by any statistical queries to current system.
prana2016-11-10 18:14
Hi Professor,
I did draft implementation of what you had shown in whiteboard during our last meeting. Please see the attached screenshot. For comparison, view with added noise is displayed within asterisk right before actual view. Some of the calculated views seem plausible while others don’t. Here are some observations:
Some numbers go too far from the actual view (300 for 175 views), some are too lower than actual view (9 for 46 views) and some are exactly as actual view (17 for 17 views).
Could you give your feedback about the current implementation and its output. Shouldn’t the calculated value be somewhere close to actual value?
Pragya
administrator2016-11-11 09:06
Hi Pragya,
It looks like you implemented what I said on the board correctly. I am thinking it might more sense to use squared rather than absolute value. i.e., rather than
$tmp = ($page['NUM_VIEWS'] - $i)
abs($tmp)
use
$tmp * tmp
this would be more Gaussian-like and more peaked about the correct answer. Also, rather than have to use for loops you can look up the formula for Gaussian integrals. I know sigma = 1, if you integrate from -infty to infty it evaluates to something like sqrt(pi). You can probably use the substitution rule to get something that works in your case.
Best,
Chris
prana2016-11-11 20:29
Thank you Professor for reviewing. I'll proceed as per your feedback.
Pragya
prana2016-11-21 12:45
Hi Professor,
I’ve uploaded second patch. Changes include:
Add a new method to base controller that calculates the privacy of the data. Call this method from SocialComponent and replace original $page[’NUM_VIEWS’].
Replaced gaussian formula with absolute value formula.
Replace for-loop with integration formula to calculate absolute value.
Also, attached the screenshot of data of fuzzified values by repeating it
1000 times for 3 different threads. It spans through a wide range. May be the random range should be more squeezed?
$random = rand(0, $integral_value);
One more thing: in our last meeting, we thought we don’t really need to add extra column in the database to recalculate the num_views. I realized the page that we refresh is the Feeds and Wikis page, not the actual thread page. So the count should not update on refresh. So I think additional column is required that records last calculated value.
prana2016-11-25 21:33
Hi Professor,
I tried to update the database schema but unable to achieve it. Here's the steps I did:
1. Add a new function in library/versionFunction.php
function upgradeDatabaseVersion47(&$db)
{
}
2. Replace YIOOP_VERSION in src/configs/Config.php
nsdefine('YIOOP_VERSION', 47);
3. Run src/configs/Createdb.php
$ php Createdb.php
[Fri, 25 Nov 2016 17:55:10 -0800] ..Making Wiki Tables.. Current memory usage:3070976
Create DB succeeded
It does update version number in VERSION table from 46 -> 47 but it doesn't add the new column(privacy_views) to ITEM_IMPRESSION_SUMMARY table
Am I missing something?
Pragya
administrator2016-11-25 23:20
Hey Pragya,
Yioop supports sqlite3, mysql, and postgres. Not all can add columns via alter table. I would do the sql necessary to copy the table to a backup table with same schema as orginal, drop original table, create a new table with the desired schema and copy the backed up data into it. Also, v 47 already exists you need to go to v 48.
Best,
Chris
prana2016-11-26 21:14
Thank you Professor. I did try the way you suggested. But after running Createdb.php, no change is seen in table ITEM_IMPRESSION_SUMMARY although the output says 'Create DB succeeded'.
I'm uploading a new patch. I couldn't upgrade the database to V48 due to previous issue. So I haven't verified few parts in this patch (part where new column is fetched from table and updated back in the db, and displaying the privacy view). May be we could check it in the next meeting.
Pragya
prana2016-12-01 17:28
Hi Professor,
I'm uploading patch 4 that fixes few things that we discussed in our last meeting.
Pragya
administrator2016-12-02 09:53
Hey Pragya,
The patch applied smoothly. I've push it to the git repositiory. Thanks for your hard work!
Best,
Chris
administrator2016-12-02 09:54
Fixed by a1bb7f599df. Pragya, thanks for your hard work!
The current statistics on each group shows total number of views as it is. Add a Differential Privacy feature so that individual information cannot be revealed by any statistical queries to current system.
Hi Professor,
I did draft implementation of what you had shown in whiteboard during our last meeting. Please see the attached screenshot. For comparison, view with added noise is displayed within asterisk right before actual view. Some of the calculated views seem plausible while others don’t. Here are some observations: Some numbers go too far from the actual view (300 for 175 views), some are too lower than actual view (9 for 46 views) and some are exactly as actual view (17 for 17 views). Could you give your feedback about the current implementation and its output. Shouldn’t the calculated value be somewhere close to actual value?
Pragya
Hi Pragya,
It looks like you implemented what I said on the board correctly. I am thinking it might more sense to use squared rather than absolute value. i.e., rather than $tmp = ($page['NUM_VIEWS'] - $i) abs($tmp) use $tmp * tmp this would be more Gaussian-like and more peaked about the correct answer. Also, rather than have to use for loops you can look up the formula for Gaussian integrals. I know sigma = 1, if you integrate from -infty to infty it evaluates to something like sqrt(pi). You can probably use the substitution rule to get something that works in your case.
Best, Chris
Thank you Professor for reviewing. I'll proceed as per your feedback.
Pragya
Hi Professor,
I’ve uploaded second patch. Changes include:
Also, attached the screenshot of data of fuzzified values by repeating it 1000 times for 3 different threads. It spans through a wide range. May be the random range should be more squeezed? $random = rand(0, $integral_value);
One more thing: in our last meeting, we thought we don’t really need to add extra column in the database to recalculate the num_views. I realized the page that we refresh is the Feeds and Wikis page, not the actual thread page. So the count should not update on refresh. So I think additional column is required that records last calculated value.
Hi Professor, I tried to update the database schema but unable to achieve it. Here's the steps I did: 1. Add a new function in library/versionFunction.php function upgradeDatabaseVersion47(&$db) {
$db->execute("ALTER TABLE ITEM_IMPRESSION_SUMMARY ADD COLUMN PRIVACY_VIEWS INTEGER");} 2. Replace YIOOP_VERSION in src/configs/Config.php nsdefine('YIOOP_VERSION', 47); 3. Run src/configs/Createdb.php $ php Createdb.php [Fri, 25 Nov 2016 17:55:10 -0800] ..Making Wiki Tables.. Current memory usage:3070976 Create DB succeeded
It does update version number in VERSION table from 46 -> 47 but it doesn't add the new column(privacy_views) to ITEM_IMPRESSION_SUMMARY table
Am I missing something?
Pragya
Hey Pragya,
Yioop supports sqlite3, mysql, and postgres. Not all can add columns via alter table. I would do the sql necessary to copy the table to a backup table with same schema as orginal, drop original table, create a new table with the desired schema and copy the backed up data into it. Also, v 47 already exists you need to go to v 48.
Best, Chris
Thank you Professor. I did try the way you suggested. But after running Createdb.php, no change is seen in table ITEM_IMPRESSION_SUMMARY although the output says 'Create DB succeeded'.
Here's what I did:
function upgradeDatabaseVersion48(&$db) {
$db->execute("CREATE TABLE ITEM_IMPRESSION_SUMMARY_OLD( USER_ID INTEGER, ITEM_ID INTEGER, ITEM_TYPE INTEGER, UPDATE_PERIOD INTEGER, UPDATE_TIMESTAMP NUMERIC(" . C\TIMESTAMP_LEN . "), NUM_VIEWS INTEGER, PRIMARY KEY(USER_ID, ITEM_ID, ITEM_TYPE, UPDATE_PERIOD, UPDATE_TIMESTAMP))"); D\DatasourceManager::copyTable("ITEM_IMPRESSION_SUMMARY", $db, "ITEM_IMPRESSION_SUMMARY_OLD", $db); $db->execute("DROP TABLE ITEM_IMPRESSION_SUMMARY"); $db->execute("CREATE TABLE ITEM_IMPRESSION_SUMMARY( USER_ID INTEGER, ITEM_ID INTEGER, ITEM_TYPE INTEGER, UPDATE_PERIOD INTEGER, UPDATE_TIMESTAMP NUMERIC(" . C\TIMESTAMP_LEN . "), NUM_VIEWS INTEGER, PRIVACY_VIEWS INTEGER, PRIMARY KEY(USER_ID, ITEM_ID, ITEM_TYPE, UPDATE_PERIOD, UPDATE_TIMESTAMP))"); $db->execute("INSERT INTO ITEM_IMPRESSION_SUMMARY SELECT USER_ID, ITEM_ID, ITEM_TYPE, UPDATE_PERIOD, UPDATE_TIMESTAMP, NUM_VIEWS FROM ITEM_IMPRESSION_SUMMARY_OLD");}
Pragya
Hi Professor,
I'm uploading a new patch. I couldn't upgrade the database to V48 due to previous issue. So I haven't verified few parts in this patch (part where new column is fetched from table and updated back in the db, and displaying the privacy view). May be we could check it in the next meeting.
Pragya
Hi Professor,
I'm uploading patch 4 that fixes few things that we discussed in our last meeting.
Pragya
Hey Pragya,
The patch applied smoothly. I've push it to the git repositiory. Thanks for your hard work!
Best, Chris
Fixed by a1bb7f599df. Pragya, thanks for your hard work!
Best, Chris
Attachments:
pranaDel4-v1.patch
pranaDel4-v2.patch
pranaDel4-v4.patch
FuzzyDataExperiment.xlsx
pranaDel4-v3.patch