Skip to content

Instantly share code, notes, and snippets.

View ryf123's full-sized avatar

Yifei ryf123

View GitHub Profile
@ryf123
ryf123 / face-similarity.ipynb
Created August 3, 2023 20:20
Face Similarity.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import requests
import threading
url = "http://localhost:17943/v1/feeds/profile"
querystring = {"maxresults":"2","nextpagetoken":"1"}
headers = {
'cache-control': "no-cache",
'postman-token': "32412874-eb43-37c4-fbd6-939d99a3881a"
import Queue
class AbNode(object):
def __init__(self, d):
self.data = d
self.children = []
def serial_bfs(node):
vals = []
q = Queue.Queue()
import requests
URL = ""
headers = {'Authorization': ''}
def send_request(zip_code, search_query):
PARAMS = {'zip_code':zip_code, 'search_query': search_query}
r = requests.get(url = URL, params = PARAMS, headers = headers)
data = 0
if r.status_code != 200:
print "status_code not 200", r
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
name
.....*...
.....*.......
....*......
....*aaa
...*...
..*..
aa*aaa
aa*aaaa
aa*acs
#standardsql
with voip_req as (
SELECT
-- requestId, kv1. value as number, kv2. value as name
requestId
FROM
mi.fides_events_nrt,
fides_events_nrt.kvPairString kv,
fides_events_nrt.kvPairString kv1,
fides_events_nrt.kvPairString kv2
#standardsql
with users as (
select usr_user_id
from `website.usr_users`
WHERE
TIMESTAMP_MILLIS(usr_signup_date) >= '2018-05-01'
AND TIMESTAMP_MILLIS(usr_signup_date) < '2018-06-01'
AND usr_phn_phone_number_id IS NOT NULL
), req as (
select
#standardsql
WITH all_spams_fides AS (
SELECT DISTINCT requestId,
FIRST_VALUE(vrd.score) OVER (PARTITION BY requestId ORDER BY vrd.score DESC) as score,
is_admin_deleted
FROM mi.fides_events_nrt n, UNNEST(verifierData) as vrd
INNER JOIN a.mts_requests r ON r.request_id = requestId
WHERE (n._PARTITIONTIME >= '2017-09-21' OR n._PARTITIONTIME IS NULL)
AND time > 1506034800000
@ryf123
ryf123 / plot_precision_recall
Last active February 8, 2018 16:52
Plot precision recall using sklearn
from sklearn.metrics import precision_recall_curve
import matplotlib.pyplot as plt
precision, recall, thresholds = precision_recall_curve(b_test, predictions)
plt.step(recall, precision, color='b', alpha=0.2,
where='post')
plt.fill_between(recall, precision, step='post', alpha=0.2,
color='b')
plt.xlabel('Recall')
plt.ylabel('Precision')
@ryf123
ryf123 / PriorityDate_wait_time_eb3_china_201801
Created December 30, 2017 18:26
RNN priority date advance training data
,month,eb2_wait_time,eb3_wait_time,eb3_current_month_advance_months,eb3_next_month_advance_months,advance,前进
121,Dec-2007,59,73,3,-1,FALSE,1
120,Jan-2008,60,75,-1,1,TRUE,0
119,Feb-2008,60,75,1,13,TRUE,1
118,Mar-2008,51,63,13,3,TRUE,1
117,Apr-2008,52,61,3,1,TRUE,1
116,May-2008,52,61,1,-1,FALSE,1
115,Jun-2008,50,63,-1,0,FALSE,0
114,Jul-2008,51,64,0,0,FALSE,0
113,Aug-2008,26,65,0,0,FALSE,0