Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import defaultdict | |
def frequent_rec(patt, mdb): | |
results.append((len(mdb), patt)) | |
occurs = defaultdict(list) | |
for (i, startpos) in mdb: | |
seq = db[i] | |
for j in range(startpos + 1, len(seq)): | |
l = occurs[seq[j]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def xgb_quantile_eval(preds, dmatrix, quantile=0.2): | |
""" | |
Customized evaluational metric that equals | |
to quantile regression loss (also known as | |
pinball loss). | |
Quantile regression is regression that |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from nltk.stem import PorterStemmer | |
from nltk.tokenize import word_tokenize | |
import re | |
ps = PorterStemmer() | |
collection_file = './collectionandqueries/collection.tsv' | |
categories_file = './categories.tsv' | |
with open(categories_file) as categories: | |
categories_dict = dict() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.datasets import load_iris | |
from matplotlib import pyplot as plt | |
from sklearn.svm import SVC | |
from sklearn.model_selection import GridSearchCV, cross_val_score, KFold | |
from sklearn.model_selection import StratifiedShuffleSplit | |
from sklearn.model_selection import ShuffleSplit | |
import numpy as np | |
from scipy.stats import sem |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_experiment(experiment_name, base_campaign_id, draft_id, split_percent=50, split_type='COOKIE'): | |
adwords_client = connect_to_adwords_api() | |
trial_service = adwords_client.GetService('TrialService', version='v201809') | |
trial = { | |
'draftId': draft_id, | |
'baseCampaignId': base_campaign_id, | |
'name': experiment_name, | |
'trafficSplitPercent': split_percent, | |
'trafficSplitType': split_type | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
def get_all_ad_groups_from_campaign(campaign_id): | |
adwords_client = connect_to_adwords_api() | |
ad_group_service = adwords_client.GetService('AdGroupService', version='v201809') | |
selector = { | |
'fields': ['Id', 'Name', 'Status','TargetCpa'], | |
'paging': { | |
'startIndex': str(0), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
def get_all_ad_groups_from_campaign(campaign_id): | |
adwords_client = connect_to_adwords_api() | |
ad_group_service = adwords_client.GetService('AdGroupService', version='v201809') | |
selector = { | |
'fields': ['Id', 'Name', 'Status','TargetCpa'], | |
'paging': { | |
'startIndex': str(0), |