text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import numpy as np
from reveal_popularity_prediction.builder.targets import ci_lower_bound
def extract_author_metadata(document):
author_metadata = document["author_metadata"]
return author_metadata
def comment_generator(document):
initial_post = doc... | {
"repo_name": "MKLab-ITI/news-popularity-prediction",
"path": "reveal_fp7_module/reveal-popularity-prediction/reveal_popularity_prediction/builder/collect/reddit/extract.py",
"copies": "1",
"size": "3641",
"license": "apache-2.0",
"hash": -8467103809450407000,
"line_mean": 32.712962963,
"line_max": 141... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import numpy as np
from reveal_popularity_prediction.features.common import get_binary_graph, get_degree_undirected, get_degree_directed
def calculate_user_count(user_graph):
nodes_1 = list(user_graph.row)
nodes_2 = list(user_graph.col)
nodes = set(node... | {
"repo_name": "MKLab-ITI/news-popularity-prediction",
"path": "reveal_fp7_module/reveal-popularity-prediction/reveal_popularity_prediction/features/user_graph.py",
"copies": "1",
"size": "6955",
"license": "apache-2.0",
"hash": -1321865717706048800,
"line_mean": 37.0054644809,
"line_max": 125,
"alpha... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import numpy as np
from reveal_popularity_prediction.features import wrappers
def extract_snapshot_features(comment_tree,
user_graph,
timestamp_list,
tweet_timestamp,
... | {
"repo_name": "MKLab-ITI/news-popularity-prediction",
"path": "reveal_fp7_module/reveal-popularity-prediction/reveal_popularity_prediction/features/extraction.py",
"copies": "1",
"size": "8955",
"license": "apache-2.0",
"hash": 7438382398944777000,
"line_mean": 39.7045454545,
"line_max": 120,
"alpha_... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import numpy as np
def conductance(adjacency_matrix, node_array):
number_of_nodes = adjacency_matrix.shape[0]
node_array_bar = np.setdiff1d(np.arange(number_of_nodes), node_array)
submatrix = adjacency_matrix[np.ix_(node_array, node_array)]
submatr... | {
"repo_name": "MKLab-ITI/reveal-graph-embedding",
"path": "reveal_graph_embedding/quality/conductance.py",
"copies": "1",
"size": "3731",
"license": "apache-2.0",
"hash": -3804907856413040600,
"line_mean": 34.1981132075,
"line_max": 112,
"alpha_frac": 0.7057089252,
"autogenerated": false,
"ratio"... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import numpy as np
def update_randic_index(randic_graph):
"""
Calculates the Randic index for a graph.
We maintain a graph/tree that has the same edges as the original tree.
The edge values however are the Randic values for each edge.
Input: -... | {
"repo_name": "MKLab-ITI/news-popularity-prediction",
"path": "news_popularity_prediction/features/branching.py",
"copies": "1",
"size": "3024",
"license": "apache-2.0",
"hash": 2588379797933134000,
"line_mean": 39.2933333333,
"line_max": 119,
"alpha_frac": 0.6644606221,
"autogenerated": false,
"... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import numpy as np
def update_user_count_eponymous(set_of_contributors, anonymous_coward_comments_counter):
"""
Eponymous user count update.
Input: - set_of_contributors: A python set of user ids.
- anonymous_coward_comments_counter: The nu... | {
"repo_name": "MKLab-ITI/news-popularity-prediction",
"path": "news_popularity_prediction/features/user_graph.py",
"copies": "1",
"size": "9095",
"license": "apache-2.0",
"hash": 5005285778741435000,
"line_mean": 42.9371980676,
"line_max": 120,
"alpha_frac": 0.6842221001,
"autogenerated": false,
... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import os
import heapq
import collections
import numpy as np
import scipy.sparse as spsp
from news_popularity_prediction.discussion import anonymized
from news_popularity_prediction.discussion.features import get_handcrafted_feature_names, initialize_timestamp_array... | {
"repo_name": "MKLab-ITI/news-popularity-prediction",
"path": "news_popularity_prediction/discussion/builder.py",
"copies": "1",
"size": "26133",
"license": "apache-2.0",
"hash": 5486906026333238000,
"line_mean": 46.8626373626,
"line_max": 155,
"alpha_frac": 0.4742279876,
"autogenerated": false,
... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import os
import inspect
import multiprocessing
try:
import cPickle as pickle
except ImportError:
import pickle
import news_popularity_prediction
def get_package_path():
"""
Returns the folder path that the package lies in.
:return: folder_path... | {
"repo_name": "MKLab-ITI/news-popularity-prediction",
"path": "news_popularity_prediction/datautil/common.py",
"copies": "1",
"size": "2435",
"license": "apache-2.0",
"hash": -3880174620262615000,
"line_mean": 23.595959596,
"line_max": 104,
"alpha_frac": 0.631211499,
"autogenerated": false,
"rati... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import os
import inspect
import multiprocessing
try:
import cPickle as pickle
except ImportError:
import pickle
import reveal_graph_embedding
###################################################################################################################... | {
"repo_name": "MKLab-ITI/reveal-graph-embedding",
"path": "reveal_graph_embedding/common.py",
"copies": "1",
"size": "2378",
"license": "apache-2.0",
"hash": 8527588853258143000,
"line_mean": 30.7066666667,
"line_max": 120,
"alpha_frac": 0.5222876367,
"autogenerated": false,
"ratio": 4.7465069860... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import os
import json
from news_popularity_prediction.discussion import slashdot
from news_popularity_prediction.discussion.datasetwide import calculate_within_dataset_user_anonymization
from news_popularity_prediction.discussion.builder import within_discussion_comm... | {
"repo_name": "MKLab-ITI/news-popularity-prediction",
"path": "news_popularity_prediction/anonymize_dataset.py",
"copies": "1",
"size": "8562",
"license": "apache-2.0",
"hash": -8666826365073406000,
"line_mean": 50.578313253,
"line_max": 138,
"alpha_frac": 0.4504788601,
"autogenerated": false,
"r... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import os
import numpy as np
from reveal_graph_embedding.common import get_file_row_generator
def write_results(performance_measures, target_file_path):
with open(target_file_path, "w") as fp:
first_row = "*** Percentages:" + "\n"
fp.write(first... | {
"repo_name": "MKLab-ITI/reveal-graph-embedding",
"path": "reveal_graph_embedding/datautil/score_rw_util.py",
"copies": "1",
"size": "4323",
"license": "apache-2.0",
"hash": -5621557421903227000,
"line_mean": 34.7272727273,
"line_max": 110,
"alpha_frac": 0.6153134397,
"autogenerated": false,
"rat... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import os
import re
import string
from nltk.corpus import stopwords
from nltk.stem.porter import PorterStemmer
from nltk.stem.snowball import SnowballStemmer
from nltk.stem.wordnet import WordNetLemmatizer
from nltk.tag import brill
from nltk.tag.brill_trainer import... | {
"repo_name": "MKLab-ITI/reveal-user-annotation",
"path": "reveal_user_annotation/text/clean_text.py",
"copies": "1",
"size": "13879",
"license": "apache-2.0",
"hash": 6506603447305636000,
"line_mean": 39.2289855072,
"line_max": 145,
"alpha_frac": 0.575401686,
"autogenerated": false,
"ratio": 3.7... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import os
import statistics
import numpy as np
import pandas as pd
from news_popularity_prediction.datautil.feature_rw import h5load_from, h5store_at, h5_open, h5_close, get_target_value,\
get_kth_row
from news_popularity_prediction.discussion.features import ge... | {
"repo_name": "MKLab-ITI/news-popularity-prediction",
"path": "news_popularity_prediction/learning/cascade_lifetime.py",
"copies": "1",
"size": "24497",
"license": "apache-2.0",
"hash": -4255860791809268000,
"line_mean": 39.6252072968,
"line_max": 166,
"alpha_frac": 0.5260644161,
"autogenerated": f... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import os
from googleapiclient.discovery import build_from_document
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage
from oauth2client.tools import run_flow
# Authorize the request and store authorization credentials.
de... | {
"repo_name": "MKLab-ITI/news-popularity-prediction",
"path": "reveal_fp7_module/youtube-discussion-collector/youtube_discussion_collector/auth_new.py",
"copies": "1",
"size": "1907",
"license": "apache-2.0",
"hash": 3310897865836252000,
"line_mean": 37.9183673469,
"line_max": 86,
"alpha_frac": 0.695... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import os
from news_popularity_prediction.datautil.common import load_pickle, store_pickle
def get_within_dataset_user_anonymization(output_file,
document_gen,
comment_generator,
... | {
"repo_name": "MKLab-ITI/news-popularity-prediction",
"path": "news_popularity_prediction/discussion/datasetwide.py",
"copies": "1",
"size": "4339",
"license": "apache-2.0",
"hash": 3145264601453865000,
"line_mean": 41.5392156863,
"line_max": 103,
"alpha_frac": 0.6383959438,
"autogenerated": false,... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import os
import numpy as np
from sklearn.ensemble import RandomForestRegressor
from sklearn.ensemble import GradientBoostingRegressor
from reveal_popularity_prediction.common.datarw import load_pickle
def decide_snapshot_for_learning(snapshots,
... | {
"repo_name": "MKLab-ITI/news-popularity-prediction",
"path": "reveal_fp7_module/reveal-popularity-prediction/reveal_popularity_prediction/inference/preprocessed_data_usage.py",
"copies": "1",
"size": "6916",
"license": "apache-2.0",
"hash": -5116612281371768000,
"line_mean": 41.1707317073,
"line_max":... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import os
import numpy as np
from news_popularity_prediction.learning.ranking import initialize_k_evaluation_measures, update_k_evaluation_measures,\
store_k_evaluation_measures, form_ground_truth, initialize_evaluation_measure_arrays, folding, learning_module,\... | {
"repo_name": "MKLab-ITI/news-popularity-prediction",
"path": "news_popularity_prediction/learning/single_experiment.py",
"copies": "1",
"size": "28457",
"license": "apache-2.0",
"hash": 6529177198054603000,
"line_mean": 52.8958333333,
"line_max": 310,
"alpha_frac": 0.5596865446,
"autogenerated": f... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import os
try:
import cPickle as pickle
except ImportError:
import pickle
import numpy as np
import pandas as pd
from sklearn.externals import joblib
def h5_open(path, complevel=0, complib="bzip2"):
"""
Returns an h5 file store handle managed via pa... | {
"repo_name": "MKLab-ITI/news-popularity-prediction",
"path": "news_popularity_prediction/datautil/feature_rw.py",
"copies": "1",
"size": "6436",
"license": "apache-2.0",
"hash": -3318461245719314400,
"line_mean": 32.0051282051,
"line_max": 123,
"alpha_frac": 0.6754195152,
"autogenerated": false,
... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import praw
from reveal_popularity_prediction.common.datarw import get_file_row_generator
########################################################################################################################
# OAuth login utilities.
#############################... | {
"repo_name": "MKLab-ITI/news-popularity-prediction",
"path": "reveal_fp7_module/reveal-popularity-prediction/reveal_popularity_prediction/builder/collect/reddit/reddit_util.py",
"copies": "1",
"size": "1646",
"license": "apache-2.0",
"hash": -3167694586927302700,
"line_mean": 36.4090909091,
"line_max"... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import pymongo
from pymongo import ASCENDING
def establish_mongo_connection(mongo_uri):
"""
What it says on the tin.
Inputs: - mongo_uri: A MongoDB URI.
Output: - A MongoDB client.
"""
client = pymongo.MongoClient(mongo_uri)
return clie... | {
"repo_name": "MKLab-ITI/news-popularity-prediction",
"path": "reveal_fp7_module/reveal-popularity-prediction/reveal_popularity_prediction/input_processing/mongo.py",
"copies": "1",
"size": "2646",
"license": "apache-2.0",
"hash": 2428727416713544700,
"line_mean": 35.2465753425,
"line_max": 126,
"alp... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import pymongo
import json
import os
def extract_snow_tweets_from_file_generator(json_file_path):
"""
A generator that opens a file containing many json tweets and yields all the tweets contained inside.
Input: - json_file_path: The path of a json file... | {
"repo_name": "MKLab-ITI/reveal-user-annotation",
"path": "reveal_user_annotation/mongo/store_snow_data.py",
"copies": "1",
"size": "1540",
"license": "apache-2.0",
"hash": -912469348774808700,
"line_mean": 31.0833333333,
"line_max": 105,
"alpha_frac": 0.675974026,
"autogenerated": false,
"ratio"... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import pymongo
def establish_mongo_connection(mongo_uri):
"""
What it says on the tin. Mongo daemon assumed to be running.
Inputs: - mongo_uri: A MongoDB URI.
Output: - A MongoDB client.
"""
client = pymongo.MongoClient(mongo_uri)
retur... | {
"repo_name": "MKLab-ITI/reveal-user-annotation",
"path": "reveal_user_annotation/mongo/mongo_util.py",
"copies": "1",
"size": "1149",
"license": "apache-2.0",
"hash": 546834671219320960,
"line_mean": 26.3571428571,
"line_max": 89,
"alpha_frac": 0.6753698869,
"autogenerated": false,
"ratio": 3.94... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import requests
import xml.etree.cElementTree as etree
from io import StringIO
def get_user_list(host_name, client_name, client_pass):
"""
Pulls the list of users in a client.
Inputs: - host_name: A string containing the address of the machine where the... | {
"repo_name": "MKLab-ITI/reveal-user-annotation",
"path": "reveal_user_annotation/pserver/request.py",
"copies": "1",
"size": "8200",
"license": "apache-2.0",
"hash": -5126846152808377000,
"line_mean": 35.7713004484,
"line_max": 109,
"alpha_frac": 0.5543902439,
"autogenerated": false,
"ratio": 4.... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import statistics
def calculate_avg_time_differences_1st_half(timestamp_list):
timestamp_differences = get_timestamp_differences(timestamp_list)
half_index = len(timestamp_differences)//2
first_half = timestamp_differences[:half_index]
if len(first... | {
"repo_name": "MKLab-ITI/news-popularity-prediction",
"path": "reveal_fp7_module/reveal-popularity-prediction/reveal_popularity_prediction/features/temporal.py",
"copies": "1",
"size": "1768",
"license": "apache-2.0",
"hash": -5783821821958855000,
"line_mean": 31.1454545455,
"line_max": 89,
"alpha_fr... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import statistics
def update_first_half_time_difference_mean(timestamp_differences):
"""
First half time difference mean update.
Input: - timestamp_differences: The list of all action timestamp differences.
Output: - first_half_time_difference_mea... | {
"repo_name": "MKLab-ITI/news-popularity-prediction",
"path": "news_popularity_prediction/features/temporal.py",
"copies": "1",
"size": "1869",
"license": "apache-2.0",
"hash": 8741333461096924000,
"line_mean": 29.1451612903,
"line_max": 83,
"alpha_frac": 0.7089352595,
"autogenerated": false,
"ra... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import subprocess
import json
from urllib.parse import urlparse, parse_qs
def collect(url, youtube_module_communication, youtube_oauth_credentials_folder):
with open(youtube_module_communication, "w") as fp:
file_row = "None"
fp.write(file_row)
... | {
"repo_name": "MKLab-ITI/news-popularity-prediction",
"path": "reveal_fp7_module/reveal-popularity-prediction/reveal_popularity_prediction/builder/collect/youtube/social_context.py",
"copies": "1",
"size": "1793",
"license": "apache-2.0",
"hash": 7666118549068400000,
"line_mean": 32.2037037037,
"line_m... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import sys
import subprocess
import urllib
from amqp import Connection, Message
from amqp.exceptions import PreconditionFailed
if sys.version_info > (3,):
import urllib.parse as urlparse
else:
import urlparse
def translate_rabbitmq_url(url):
if url[0:... | {
"repo_name": "MKLab-ITI/news-popularity-prediction",
"path": "reveal_fp7_module/reveal-popularity-prediction/reveal_popularity_prediction/output/rabbitmq_util.py",
"copies": "1",
"size": "3507",
"license": "apache-2.0",
"hash": 4473181846730479000,
"line_mean": 28.7203389831,
"line_max": 112,
"alpha... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import time
import datetime
from datetime import timezone
from urllib.parse import urlparse, parse_qs
from urllib.request import urlopen
from urllib.error import HTTPError, URLError
def extract_urls_from_tweets(tweet_gen, is_replayed_stream):
current_timestamp =... | {
"repo_name": "MKLab-ITI/news-popularity-prediction",
"path": "reveal_fp7_module/reveal-popularity-prediction/reveal_popularity_prediction/input_processing/twitter.py",
"copies": "1",
"size": "11029",
"license": "apache-2.0",
"hash": -3839588397036861000,
"line_mean": 39.6900369004,
"line_max": 120,
... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import time
import datetime
from queue import Queue
from threading import Thread
from reveal_popularity_prediction.input_processing.mongo import establish_mongo_connection,\
get_safe_mongo_generator, get_collection_documents_generator
from reveal_popularity_predi... | {
"repo_name": "MKLab-ITI/news-popularity-prediction",
"path": "reveal_fp7_module/reveal-popularity-prediction/reveal_popularity_prediction/reveal/utility.py",
"copies": "1",
"size": "17273",
"license": "apache-2.0",
"hash": -90359149834837780,
"line_mean": 44.0992167102,
"line_max": 148,
"alpha_frac"... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import time
import json
import itertools
import datetime
import numpy as np
import scipy.sparse as spsp
from sklearn.preprocessing import normalize
import networkx as nx
from networkx.algorithms.link_analysis import pagerank_scipy
from collections import OrderedDict, ... | {
"repo_name": "MKLab-ITI/reveal-user-classification",
"path": "reveal_user_classification/reveal/utility.py",
"copies": "1",
"size": "31544",
"license": "apache-2.0",
"hash": -6112757351132077000,
"line_mean": 44.7822931785,
"line_max": 150,
"alpha_frac": 0.5728189196,
"autogenerated": false,
"ra... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import time
import twython
from urllib.error import URLError
from http.client import BadStatusLine
from reveal_user_annotation.text.map_data import chunks
from reveal_user_annotation.twitter.twitter_util import login, safe_twitter_request_handler
def check_suspensi... | {
"repo_name": "MKLab-ITI/reveal-user-annotation",
"path": "reveal_user_annotation/twitter/user_lookup.py",
"copies": "1",
"size": "4067",
"license": "apache-2.0",
"hash": -750922658495862500,
"line_mean": 53.9594594595,
"line_max": 120,
"alpha_frac": 0.5650356528,
"autogenerated": false,
"ratio":... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import time
from oauth2client.tools import argparser
from googleapiclient.errors import HttpError
from youtube_discussion_collector.auth_new import get_authenticated_service
from youtube_discussion_collector.collect import get_video_metadata, get_all_comment_threads... | {
"repo_name": "MKLab-ITI/news-popularity-prediction",
"path": "reveal_fp7_module/youtube-discussion-collector/youtube_discussion_collector/entry_points/collect_youtube_discussion_batch.py",
"copies": "1",
"size": "3270",
"license": "apache-2.0",
"hash": -3076942916838606000,
"line_mean": 37.9285714286,
... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import time
import numpy as np
from scipy.sparse import issparse
from sklearn.multiclass import OneVsRestClassifier
from sklearn import svm
from sklearn.preprocessing import normalize
from reveal_graph_embedding.datautil.snow_datautil import snow_read_data
from reve... | {
"repo_name": "MKLab-ITI/reveal-graph-embedding",
"path": "reveal_graph_embedding/experiments/utility.py",
"copies": "1",
"size": "10734",
"license": "apache-2.0",
"hash": 7273586172208797000,
"line_mean": 46.0789473684,
"line_max": 120,
"alpha_frac": 0.5133221539,
"autogenerated": false,
"ratio"... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import twython
from twython import Twython
import time
from urllib.error import URLError
from http.client import BadStatusLine
from reveal_user_annotation.common.config_package import get_package_path
from reveal_user_annotation.common.datarw import get_file_row_gene... | {
"repo_name": "MKLab-ITI/reveal-user-annotation",
"path": "reveal_user_annotation/twitter/twitter_util.py",
"copies": "1",
"size": "5988",
"license": "apache-2.0",
"hash": 4915783140150653000,
"line_mean": 43.6865671642,
"line_max": 120,
"alpha_frac": 0.5688042752,
"autogenerated": false,
"ratio"... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
def get_video_metadata(youtube_service, video_id):
video_metadata = youtube_service.videos().list(
part="snippet,statistics",
id=video_id
).execute()
if len(video_metadata["items"]) == 0:
return None
channel_id = video_metadat... | {
"repo_name": "MKLab-ITI/news-popularity-prediction",
"path": "reveal_fp7_module/youtube-discussion-collector/youtube_discussion_collector/collect.py",
"copies": "1",
"size": "6932",
"license": "apache-2.0",
"hash": -2493964895167045000,
"line_mean": 38.8390804598,
"line_max": 157,
"alpha_frac": 0.61... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
def pagerank_limit_push(s, r, w_i, a_i, push_node, rho):
"""
Performs a random step without a self-loop.
"""
# Calculate the A and B quantities to infinity
A_inf = rho*r[push_node]
B_inf = (1-rho)*r[push_node]
# Update approximate Pageran... | {
"repo_name": "MKLab-ITI/reveal-graph-embedding",
"path": "reveal_graph_embedding/eps_randomwalk/push.py",
"copies": "1",
"size": "2410",
"license": "apache-2.0",
"hash": -3984113443477366300,
"line_mean": 36.65625,
"line_max": 120,
"alpha_frac": 0.6473029046,
"autogenerated": false,
"ratio": 3.5... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
def update_comment_count(comment_count):
return comment_count
def update_max_depth(depth_node_dict):
"""
Maximum tree depth update.
Input: - depth_node_dict: A map from node depth to node ids as a python dictionary.
Output: - max_depth: The ... | {
"repo_name": "MKLab-ITI/news-popularity-prediction",
"path": "news_popularity_prediction/features/basic.py",
"copies": "1",
"size": "3232",
"license": "apache-2.0",
"hash": -7339020197967830000,
"line_mean": 32.3195876289,
"line_max": 94,
"alpha_frac": 0.6680074257,
"autogenerated": false,
"rati... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
try:
import cPickle as pickle
except ImportError:
import pickle
import numpy as np
import scipy.sparse as spsp
def get_file_row_generator(file_path, separator, encoding=None):
"""
Reads an separated value file row by row.
Inputs: - file_path: T... | {
"repo_name": "MKLab-ITI/reveal-graph-embedding",
"path": "reveal_graph_embedding/datautil/datarw.py",
"copies": "1",
"size": "4396",
"license": "apache-2.0",
"hash": -714045056716823800,
"line_mean": 29.7412587413,
"line_max": 104,
"alpha_frac": 0.5875796178,
"autogenerated": false,
"ratio": 3.7... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
try:
import cPickle as pickle
except ImportError:
import pickle
def get_file_row_generator(file_path, separator, encoding=None):
"""
Reads an separated value file row by row.
Inputs: - file_path: The path of the separated value format file.
... | {
"repo_name": "MKLab-ITI/news-popularity-prediction",
"path": "reveal_fp7_module/reveal-popularity-prediction/reveal_popularity_prediction/common/datarw.py",
"copies": "2",
"size": "1319",
"license": "apache-2.0",
"hash": 5294761940975230000,
"line_mean": 26.4791666667,
"line_max": 80,
"alpha_frac": ... |
__author__ = "gerbal"
import unittest
class string_format(unittest.TestCase):
def test_simple_position(self):
self.assertEqual('a, b, c', '{0}, {1}, {2}'.format('a', 'b', 'c'))
self.assertEqual('a, b, c', '{}, {}, {}'.format('a', 'b', 'c'))
self.assertEqual('c, b, a', '{2}, {1}, {0}'.form... | {
"repo_name": "ArcherSys/ArcherSys",
"path": "skulpt/test/unit/test_strformat.py",
"copies": "1",
"size": "3696",
"license": "mit",
"hash": 8698080798587548000,
"line_mean": 47,
"line_max": 226,
"alpha_frac": 0.5384199134,
"autogenerated": false,
"ratio": 3.0697674418604652,
"config_test": true... |
__author__ = 'Gergo'
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from Bid import Bid
from Project import Project
from User import User
class DAL:
def __init__(self, engine):
"""
:param engine: The engine rou... | {
"repo_name": "gergob/how_to_sqlalchemy",
"path": "DAL.py",
"copies": "1",
"size": "1622",
"license": "mit",
"hash": -5690602725797219000,
"line_mean": 30.1923076923,
"line_max": 106,
"alpha_frac": 0.6011097411,
"autogenerated": false,
"ratio": 4.004938271604939,
"config_test": false,
"has_no... |
Author: Gerhard Haering (gerhard@bigfoot.de)
0. Scope of this HOWTO
----------------------
This howto describes how to debug *native* win32 Python extensions with open
source tools. See Appendix A for how to do this with Cygwin's Python (which is
much simpler).
1. Prepare Python for development with gcc
----------... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/82826_HOW_DEBUG_PYTHEXTENSIONS_WINDOWS_OPEN_SOURCE/recipe-82826.py",
"copies": "1",
"size": "3603",
"license": "mit",
"hash": 18654086431917812,
"line_mean": 24.5531914894,
"line_max": 78,
"alpha_frac": 0.6266999722,
"autogenerated": false,
... |
__author__ = 'ggarrido'
import datetime
import re
validTimeRE = re.compile(ur'\d\d:\d\d')
def convertStrBoolean(value, col_attrs=None):
if not value or not (isinstance(value, str) or isinstance(value, int)):
return False
return False if value == 0 or int(value) == 0 else True
def defaultDate(value, ... | {
"repo_name": "ggarri/mysql2psql",
"path": "dumperAuxFuncs.py",
"copies": "1",
"size": "1455",
"license": "mit",
"hash": -3691106560031787500,
"line_mean": 34.487804878,
"line_max": 75,
"alpha_frac": 0.6962199313,
"autogenerated": false,
"ratio": 3.5060240963855422,
"config_test": false,
"has... |
__author__ = 'ggarrido'
import os
import re
import json
import time
import copy
from RuleHandler import RuleHandler
from MysqlParser import MysqlParser
import dumperAuxFuncs
from decimal import Decimal
REGEX_TYPE = type(re.compile(''))
PGSQL_BLOCK = 1000
def merge_dicts(*dict_args):
'''
Given any number of d... | {
"repo_name": "ggarri/mysql2psql",
"path": "libs/PsqlParser.py",
"copies": "1",
"size": "21817",
"license": "mit",
"hash": -36576545991610840,
"line_mean": 40.0093984962,
"line_max": 134,
"alpha_frac": 0.5572260164,
"autogenerated": false,
"ratio": 3.6673390485795934,
"config_test": false,
"h... |
__author__ = 'ggarrido'
class RuleHandler:
"""
Apply a list of rules into given json. Just overwrite in case rules has a value on the same location
"""
STR_SKIP = '_SKIP_'
def __init__(self, rules=None, node_rules=None):
"""
:param rules: Schema rules (same nesting level repl... | {
"repo_name": "ggarri/mysql2psql",
"path": "libs/RuleHandler.py",
"copies": "1",
"size": "5166",
"license": "mit",
"hash": -4495470136636353000,
"line_mean": 44.3245614035,
"line_max": 108,
"alpha_frac": 0.5687185443,
"autogenerated": false,
"ratio": 4.116334661354582,
"config_test": false,
"... |
__author__ = 'ggdhines'
from aggregation_api import AggregationAPI
# from sklearn.cluster import KMeans
# import matplotlib.cbook as cbook
import numpy as np
from sklearn.cluster import DBSCAN
import matplotlib.pyplot as plt
import cv2
import matplotlib.cbook as cbook
import math
import random
import itertools
def get... | {
"repo_name": "zooniverse/aggregation",
"path": "blog/new_jungle.py",
"copies": "1",
"size": "11080",
"license": "apache-2.0",
"hash": -3330380582782539000,
"line_mean": 27.7046632124,
"line_max": 112,
"alpha_frac": 0.5351083032,
"autogenerated": false,
"ratio": 3.1343705799151342,
"config_test... |
__author__ = 'ggdhines'
from aggregation_api import AggregationAPI
import matplotlib.cbook as cbook
import matplotlib.pyplot as plt
from skimage.color import rgb2gray
from sklearn.cluster import DBSCAN
import numpy as np
import math
import cv2
# subject_id = 918463
subject_id = 917160
project = AggregationAPI(11,"deve... | {
"repo_name": "zooniverse/aggregation",
"path": "analysis/whales.py",
"copies": "1",
"size": "4985",
"license": "apache-2.0",
"hash": 3793336305039041000,
"line_mean": 30.5506329114,
"line_max": 113,
"alpha_frac": 0.6318956871,
"autogenerated": false,
"ratio": 3.11367895065584,
"config_test": f... |
__author__ = 'ggdhines'
from aggregation_api import AggregationAPI
import matplotlib.cbook as cbook
import matplotlib.pyplot as plt
import cv2
import numpy as np
from scipy.spatial import ConvexHull
from shapely.ops import cascaded_union, polygonize
import shapely.geometry as geometry
from scipy.spatial import Delaunay... | {
"repo_name": "zooniverse/aggregation",
"path": "blog/whales.py",
"copies": "1",
"size": "6020",
"license": "apache-2.0",
"hash": -4318953708166758400,
"line_mean": 34.2046783626,
"line_max": 213,
"alpha_frac": 0.5657807309,
"autogenerated": false,
"ratio": 3.241787829833064,
"config_test": fal... |
__author__ = 'ggdhines'
from learning import NearestNeighbours
import random
from skimage.data import load
import json
from sklearn.decomposition import PCA
import numpy as np
class updatedNN(NearestNeighbours):
def __init__(self):
NearestNeighbours.__init__(self)
cursor = self.conn.cursor()
... | {
"repo_name": "zooniverse/aggregation",
"path": "active_weather/old/update.py",
"copies": "1",
"size": "3533",
"license": "apache-2.0",
"hash": 644193465155586800,
"line_mean": 32.0280373832,
"line_max": 159,
"alpha_frac": 0.5748655534,
"autogenerated": false,
"ratio": 3.921198668146504,
"confi... |
__author__ = 'ggdhines'
from mnist import MNIST
from sklearn import neighbors
import numpy as np
from sklearn.neighbors import KernelDensity
import scipy
from scipy import interpolate
import math
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
n_neighbors = 15
mndata = MNIST('/home/ggdhines/Data... | {
"repo_name": "zooniverse/aggregation",
"path": "blog/old_weather/probabilities.py",
"copies": "1",
"size": "1333",
"license": "apache-2.0",
"hash": 3508586079804969000,
"line_mean": 22.8035714286,
"line_max": 70,
"alpha_frac": 0.6864216054,
"autogenerated": false,
"ratio": 2.854389721627409,
"... |
__author__ = 'ggdhines'
from mnist import MNIST
import numpy as np
from sklearn.decomposition import PCA, FactorAnalysis
from sklearn.covariance import ShrunkCovariance, LedoitWolf
from sklearn.cross_validation import cross_val_score
from sklearn.grid_search import GridSearchCV
import matplotlib.pyplot as plt
mndata =... | {
"repo_name": "zooniverse/aggregation",
"path": "active_weather/old/reduction.py",
"copies": "1",
"size": "2428",
"license": "apache-2.0",
"hash": -1130681159292904800,
"line_mean": 31.8243243243,
"line_max": 76,
"alpha_frac": 0.6853377265,
"autogenerated": false,
"ratio": 3.0086741016109046,
"... |
__author__ = 'ggdhines'
from ouroboros_api import MarkingProject
from agglomerative import Agglomerative
from classification import MajorityVote,IBCC
import numpy
from expert_classification import ExpertClassification
import matplotlib.pyplot as plt
import cPickle as pickle
import os
#db.plankton_users.find({},{name:1... | {
"repo_name": "camallen/aggregation",
"path": "blog/plankton.py",
"copies": "2",
"size": "4024",
"license": "apache-2.0",
"hash": -2644854871461099000,
"line_mean": 36.2592592593,
"line_max": 327,
"alpha_frac": 0.6488568588,
"autogenerated": false,
"ratio": 3.2768729641693812,
"config_test": fa... |
__author__ = 'ggdhines'
from penguin import Penguins
import numpy
import math
import scipy
project = Penguins()
subjects = project.__get_retired_subjects__(1,False)
jj = 0
for zooniverse_id in subjects:
subject = project.subject_collection.find_one({"zooniverse_id":zooniverse_id})
count = subject["classifica... | {
"repo_name": "camallen/aggregation",
"path": "engine/kdtree_multiclick_correct.py",
"copies": "2",
"size": "1321",
"license": "apache-2.0",
"hash": -6204380644103529000,
"line_mean": 26.5416666667,
"line_max": 101,
"alpha_frac": 0.6404239213,
"autogenerated": false,
"ratio": 3.3025,
"config_te... |
__author__ = 'ggdhines'
from penguin import Penguins,SubjectGenerator
from cassandra.concurrent import execute_concurrent
import urllib
import json
from aggregation_api import base_directory
import os
import matplotlib.pyplot as plt
class Analysis(Penguins):
def __init__(self):
Penguins.__init__(self)
... | {
"repo_name": "zooniverse/aggregation",
"path": "experimental/algorithms/penguin_analysis.py",
"copies": "2",
"size": "2308",
"license": "apache-2.0",
"hash": -2289763713004126500,
"line_mean": 33.9848484848,
"line_max": 123,
"alpha_frac": 0.5485268631,
"autogenerated": false,
"ratio": 4.38783269... |
__author__ = 'ggdhines'
from simplified_transcription import SimplifiedTate
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
from termcolor import colored
subject_id = 603303
with SimplifiedTate() as project:
# for subject_id in project.__get_retired_subjects__(workflow_id):
# print subjec... | {
"repo_name": "camallen/aggregation",
"path": "engine/transcription_analysis.py",
"copies": "2",
"size": "1572",
"license": "apache-2.0",
"hash": -4294971166750994400,
"line_mean": 30.46,
"line_max": 112,
"alpha_frac": 0.5674300254,
"autogenerated": false,
"ratio": 3.5485327313769752,
"config_t... |
__author__ = 'ggdhines'
from sklearn.cluster import KMeans as sk_KMeans
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
import six
from matplotlib import colors
import math
class KMeans:
def __init__(self, min_samples):
self.min_samples = min_samples
def fit2(self, ... | {
"repo_name": "camallen/aggregation",
"path": "experimental/old/kMeans.py",
"copies": "2",
"size": "1133",
"license": "apache-2.0",
"hash": 5194723634746317000,
"line_mean": 29.6486486486,
"line_max": 87,
"alpha_frac": 0.5657546337,
"autogenerated": false,
"ratio": 4.032028469750889,
"config_te... |
__author__ = 'ggdhines'
from sklearn.cluster import KMeans
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
import six
from matplotlib import colors
import math
import time
from clustering import Cluster
class DivisiveKMeans(Cluster):
def __init__(self, project_api,min_cluster_... | {
"repo_name": "camallen/aggregation",
"path": "algorithms/divisive_kmeans.py",
"copies": "2",
"size": "9631",
"license": "apache-2.0",
"hash": 2562234068227366400,
"line_mean": 42.1883408072,
"line_max": 115,
"alpha_frac": 0.549060326,
"autogenerated": false,
"ratio": 4.295718108831401,
"config... |
__author__ = 'ggdhines'
from sklearn.cluster import KMeans
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
import six
from matplotlib import colors
import math
class DivisiveKmeans_2:
def __init__(self, min_samples):
self.min_samples = min_samples
def __fix__(self,c... | {
"repo_name": "zooniverse/aggregation",
"path": "experimental/clusteringAlg/divisiveKmeans_2.py",
"copies": "2",
"size": "8288",
"license": "apache-2.0",
"hash": -7658361858083619000,
"line_mean": 34.724137931,
"line_max": 113,
"alpha_frac": 0.479488417,
"autogenerated": false,
"ratio": 4.0096758... |
__author__ = 'ggdhines'
from transcription import Tate,TextCluster
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
from termcolor import colored
import yaml
subject_id = 928459
with Tate(376,"development") as project:
# for subject_id in project.__get_retired_subjects__(workflow_id):
# pri... | {
"repo_name": "zooniverse/aggregation",
"path": "analysis/folger_analysis__.py",
"copies": "1",
"size": "3629",
"license": "apache-2.0",
"hash": 3346284333334752000,
"line_mean": 29.5042016807,
"line_max": 112,
"alpha_frac": 0.5188757233,
"autogenerated": false,
"ratio": 3.82,
"config_test": fa... |
__author__ = 'ggdhines'
from transcription import Tate, TextCluster
import numpy as np
import heapq
class HeuristicTextCluster(TextCluster):
def __init__(self,shape,param_dict):
TextCluster.__init__(self,shape,param_dict)
def __line_alignment__(self,lines):
print lines
print [len(l) fo... | {
"repo_name": "zooniverse/aggregation",
"path": "engine/heuristic_lcs.py",
"copies": "1",
"size": "3649",
"license": "apache-2.0",
"hash": -583559518019061400,
"line_mean": 25.8382352941,
"line_max": 80,
"alpha_frac": 0.4447793916,
"autogenerated": false,
"ratio": 3.1841186736474696,
"config_te... |
__author__ = 'ggdhines'
import aggregation_api
from matplotlib import pyplot as plt
import matplotlib.cbook as cbook
project = aggregation_api.AggregationAPI(project = 195, environment="staging",cassandra_connection=False)
cursor = project.postgres_session.cursor()
# stmt = "select name from projects "
# cursor.execu... | {
"repo_name": "camallen/aggregation",
"path": "engine/old_weather.py",
"copies": "1",
"size": "1769",
"license": "apache-2.0",
"hash": 6191937017983929000,
"line_mean": 21.974025974,
"line_max": 105,
"alpha_frac": 0.6178631995,
"autogenerated": false,
"ratio": 3.142095914742451,
"config_test": ... |
__author__ = 'ggdhines'
import aggregation_api
import cv2
import numpy as np
import matplotlib.pyplot as plt
from sklearn.cluster import DBSCAN
# project = aggregation_api.AggregationAPI(153,"development")
# f_name = project.__image_setup__(1125393)
f_name = "/home/ggdhines/Databases/images/b828fa18-89b8-4941-903f-0ef... | {
"repo_name": "zooniverse/aggregation",
"path": "experimental/algorithms/jungle2.py",
"copies": "1",
"size": "2326",
"license": "apache-2.0",
"hash": 1246615790720881700,
"line_mean": 30.0133333333,
"line_max": 254,
"alpha_frac": 0.6315563199,
"autogenerated": false,
"ratio": 2.547645125958379,
... |
__author__ = 'ggdhines'
import clustering
import pandas as pd
import numpy as np
from scipy.spatial.distance import pdist,squareform
from scipy.cluster.hierarchy import linkage,dendrogram
import time
from numpy import array
class Agglomerative(clustering.Cluster):
def __init__(self,project_api,min_cluster_size=1):... | {
"repo_name": "zooniverse/aggregation",
"path": "engine/string_agglomeration.py",
"copies": "2",
"size": "6869",
"license": "apache-2.0",
"hash": -3552067941083478000,
"line_mean": 40.6363636364,
"line_max": 131,
"alpha_frac": 0.4581452904,
"autogenerated": false,
"ratio": 4.088690476190476,
"c... |
__author__ = 'ggdhines'
import clustering
import pandas as pd
import numpy as np
from scipy.spatial.distance import pdist,squareform
from scipy.cluster.hierarchy import linkage
import time
import abc
from scipy.stats import beta
import math
import numpy
import multiClickCorrect
import json
import random
from copy impor... | {
"repo_name": "zooniverse/aggregation",
"path": "engine/agglomerative.py",
"copies": "1",
"size": "9195",
"license": "apache-2.0",
"hash": 3090494314449666600,
"line_mean": 41.5740740741,
"line_max": 124,
"alpha_frac": 0.6147906471,
"autogenerated": false,
"ratio": 4.0703851261620185,
"config_t... |
__author__ = 'ggdhines'
import csv
from aggregation_api import AggregationAPI
import json
old_subjects = []
with open("/home/ggdhines/Dropbox/764_old/1224_PreProduction_Workflow/initDoes_this_look_like_a_pulsar.csv","rb") as old_subject_file:
reader = csv.reader(old_subject_file)
next(reader, None)
for r... | {
"repo_name": "zooniverse/aggregation",
"path": "analysis/pulsar.py",
"copies": "1",
"size": "2197",
"license": "apache-2.0",
"hash": -5038696255921595000,
"line_mean": 30.8550724638,
"line_max": 219,
"alpha_frac": 0.5525716887,
"autogenerated": false,
"ratio": 3.184057971014493,
"config_test":... |
__author__ = 'ggdhines'
import csv
import json
classifications = {}
total = 0
a_total = 0
errors = 0
with open("/home/ggdhines/Downloads/9e6c81af-3688-48b9-aa13-61a612e9b32b.csv","rb") as infile:
reader = csv.reader(infile)
columns = reader.next()
for row in reader:
total += 1
if int(row[3... | {
"repo_name": "zooniverse/aggregation",
"path": "experimental/pulsar.py",
"copies": "1",
"size": "2567",
"license": "apache-2.0",
"hash": 25906131143155760,
"line_mean": 28.8488372093,
"line_max": 181,
"alpha_frac": 0.5940786911,
"autogenerated": false,
"ratio": 3.1266747868453106,
"config_test... |
__author__ = 'ggdhines'
import cv2
import matplotlib.pyplot as plt
from active_weather import ActiveWeather
import numpy as np
from os import popen
import csv
image = cv2.imread("/home/ggdhines/region.jpg",0)
ret,th1 = cv2.threshold(image,180,255,cv2.THRESH_BINARY)
# plt.imshow(th1)
# plt.show()
# cv2.imwrite("/home/... | {
"repo_name": "zooniverse/aggregation",
"path": "active_weather/old/paper_threshold.py",
"copies": "1",
"size": "4407",
"license": "apache-2.0",
"hash": -2543512296642927600,
"line_mean": 24.4797687861,
"line_max": 97,
"alpha_frac": 0.6355797595,
"autogenerated": false,
"ratio": 2.754375,
"conf... |
__author__ = 'ggdhines'
import cv2
import numpy as np
import glob
import random
# image1 = cv2.imread("/home/ggdhines/Databases/old_weather/aligned_images/Bear/1940/Bear-AG-29-1940-0023.JPG",0)
# image2 = cv2.imread("/home/ggdhines/Databases/old_weather/aligned_images/Bear/1940/Bear-AG-29-1940-0136.JPG",0)
f_names = ... | {
"repo_name": "zooniverse/aggregation",
"path": "active_weather/old/temp.py",
"copies": "1",
"size": "4553",
"license": "apache-2.0",
"hash": -4527601195744713000,
"line_mean": 27.641509434,
"line_max": 278,
"alpha_frac": 0.6734021524,
"autogenerated": false,
"ratio": 2.4192348565356006,
"confi... |
__author__ = 'ggdhines'
import glob, os
import cPickle as pickle
# pickle.dump((c,n),open("/home/ggdhines/Dropbox/nn_cases/"+str(data_c)+".pic","wb"))
from pybrain.tools.shortcuts import buildNetwork
from pybrain.datasets import SupervisedDataSet
from pybrain.supervised.trainers import BackpropTrainer
from pybrain.stru... | {
"repo_name": "zooniverse/aggregation",
"path": "experimental/algorithms/old_weather/test_data.py",
"copies": "2",
"size": "1192",
"license": "apache-2.0",
"hash": -6761255827109025000,
"line_mean": 22.3921568627,
"line_max": 85,
"alpha_frac": 0.6283557047,
"autogenerated": false,
"ratio": 2.9144... |
__author__ = 'ggdhines'
import gzip
import cPickle
import matplotlib.pyplot as plt
import math
import numpy
# f = gzip.open('/home/greg/github/neural-networks-and-deep-learning/data/mnist.pkl.gz', 'rb')
# training_data, validation_data, test_data = cPickle.load(f)
# f.close()
#
# index = 0
#
# # scale1 = 28
# # scale2... | {
"repo_name": "camallen/aggregation",
"path": "algorithms/old_weather/scaling.py",
"copies": "2",
"size": "6822",
"license": "apache-2.0",
"hash": 3092843315937269000,
"line_mean": 29.4598214286,
"line_max": 113,
"alpha_frac": 0.4645265318,
"autogenerated": false,
"ratio": 3.0199203187250996,
"... |
__author__ = 'ggdhines'
# import matplotlib
# import aggregation_api
import cv2
# import numpy as np
import matplotlib.pyplot as plt
from aggregation_api import AggregationAPI
# from sklearn.cluster import KMeans
# import matplotlib.cbook as cbook
import numpy as np
jungle = AggregationAPI(153,"development")
jungle.__... | {
"repo_name": "zooniverse/aggregation",
"path": "blog/jungle_fourier.py",
"copies": "1",
"size": "4685",
"license": "apache-2.0",
"hash": 4582485139566990300,
"line_mean": 32.7122302158,
"line_max": 101,
"alpha_frac": 0.5935965848,
"autogenerated": false,
"ratio": 3.048145738451529,
"config_tes... |
__author__ = 'ggdhines'
# import matplotlib
# matplotlib.use('WXAgg')
# from aggregation_api import AggregationAPI
import json
import os
import matplotlib.cbook as cbook
import matplotlib.pyplot as plt
from skimage.color import rgb2gray
from sklearn.cluster import DBSCAN
import numpy as np
import math
directory = "/ho... | {
"repo_name": "zooniverse/aggregation",
"path": "experimental/algorithms/cell.py",
"copies": "1",
"size": "4340",
"license": "apache-2.0",
"hash": -5799869099987142000,
"line_mean": 28.5306122449,
"line_max": 90,
"alpha_frac": 0.549078341,
"autogenerated": false,
"ratio": 3.172514619883041,
"co... |
__author__ = 'ggdhines'
import matplotlib
matplotlib.use('WXAgg')
from aggregation_api import AggregationAPI
import matplotlib.cbook as cbook
import matplotlib.pyplot as plt
import cv2
import numpy as np
with AggregationAPI(592,"development") as sea:
sea.__setup__()
postgres_cursor = sea.postgres_session.curs... | {
"repo_name": "zooniverse/aggregation",
"path": "blog/sea.py",
"copies": "1",
"size": "4802",
"license": "apache-2.0",
"hash": -5413967102760331000,
"line_mean": 38.6859504132,
"line_max": 214,
"alpha_frac": 0.5562265723,
"autogenerated": false,
"ratio": 3.0841361592806678,
"config_test": false... |
__author__ = 'ggdhines'
import matplotlib
matplotlib.use('WXAgg')
import aggregation_api
from matplotlib import pyplot as plt
import matplotlib.cbook as cbook
project = aggregation_api.AggregationAPI(project_id = 195, environment="staging")
project.__setup__()
cursor = project.postgres_session.cursor()
# stmt = "selec... | {
"repo_name": "zooniverse/aggregation",
"path": "analysis/old_weather.py",
"copies": "1",
"size": "1806",
"license": "apache-2.0",
"hash": -914917625135957000,
"line_mean": 21.8607594937,
"line_max": 103,
"alpha_frac": 0.6184939092,
"autogenerated": false,
"ratio": 3.1518324607329844,
"config_t... |
__author__ = 'ggdhines'
import matplotlib
matplotlib.use('WXAgg')
import aggregation_api
import cv2
import numpy as np
import matplotlib.pyplot as plt
from sklearn.cluster import DBSCAN
from scipy.spatial import distance
ref = [[234,218,209],]
def analyze(f_name,display=False):
image = cv2.imread(f_name)
x_l... | {
"repo_name": "zooniverse/aggregation",
"path": "experimental/algorithms/jungle3.py",
"copies": "1",
"size": "5210",
"license": "apache-2.0",
"hash": -2885311566630173000,
"line_mean": 25.3181818182,
"line_max": 99,
"alpha_frac": 0.4869481766,
"autogenerated": false,
"ratio": 2.9468325791855206,
... |
__author__ = 'ggdhines'
import matplotlib
matplotlib.use('WXAgg')
import numpy as np
import os
import cv2
from copy import deepcopy
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
ship = "Bear"
year = "1940"
aligned_images_dir = "/home/ggdhines/Databases/old_weather/aligned_images/"+ship+"/"+year + "... | {
"repo_name": "zooniverse/aggregation",
"path": "active_weather/old/create_template.py",
"copies": "1",
"size": "11188",
"license": "apache-2.0",
"hash": 1135734389344512100,
"line_mean": 30.6940509915,
"line_max": 124,
"alpha_frac": 0.6553450125,
"autogenerated": false,
"ratio": 2.56429062571625... |
__author__ = 'ggdhines'
import pymongo
import abc
import cPickle as pickle
import os
import csv
import re
import matplotlib.pyplot as plt
import urllib
import matplotlib.cbook as cbook
import datetime
import warnings
import random
import clustering
import math
import numpy
import json
import itertools
import matplotlib... | {
"repo_name": "camallen/aggregation",
"path": "algorithms/ouroboros_api.py",
"copies": "2",
"size": "42390",
"license": "apache-2.0",
"hash": 6210538540525346000,
"line_mean": 43.248434238,
"line_max": 821,
"alpha_frac": 0.5909884407,
"autogenerated": false,
"ratio": 4.058789735733435,
"config_... |
__author__ = 'ggdhines'
import random
import math
from copy import deepcopy
class KMedoids:
def __init__(self, min_samples):
self.min_samples = min_samples
def distance(self,(m1,u1),(m2,u2)):
if m1 == m2:
print (m1,u1)
print (m2,u2)
assert False
elif... | {
"repo_name": "zooniverse/aggregation",
"path": "experimental/old/kMedoids.py",
"copies": "2",
"size": "4199",
"license": "apache-2.0",
"hash": 7244861321354851000,
"line_mean": 31.5581395349,
"line_max": 104,
"alpha_frac": 0.4355799,
"autogenerated": false,
"ratio": 4.34229576008273,
"config_t... |
__author__ = 'ggdhines'
import random
import math
numSamples = 100
def DBSCANmap(ellipse):
return ellipse[0],ellipse[1]
def withinEllipse(ellipse,pt):
x,y,w,h,r = ellipse
r = math.radians(r)
X,Y = pt
#center the ellipse at 0,0
X = X - x
Y = Y - y
d =math.pow(X*math.cos(r) + Y*mat... | {
"repo_name": "camallen/aggregation",
"path": "zooLeverage/geometric/shapes/ellipse.py",
"copies": "1",
"size": "2026",
"license": "apache-2.0",
"hash": -4078794247596966000,
"line_mean": 24.6455696203,
"line_max": 121,
"alpha_frac": 0.6322803554,
"autogenerated": false,
"ratio": 2.73783783783783... |
__author__ = 'ggdhines'
import random
import matplotlib.pyplot as plt
import numpy as np
import math
from scipy.stats import chi2
from scipy.stats import norm
p_range = np.arange(0.05,1,0.05)
results = {p:[] for p in p_range}
A = {p:[] for p in p_range}
C = {p:[] for p in p_range}
num_samples = 100
for j in range(10... | {
"repo_name": "zooniverse/aggregation",
"path": "blog/exponential/_exponential.py",
"copies": "1",
"size": "1739",
"license": "apache-2.0",
"hash": 5238545443187920000,
"line_mean": 23.1666666667,
"line_max": 90,
"alpha_frac": 0.6273720529,
"autogenerated": false,
"ratio": 2.6308623298033282,
"... |
__author__ = 'ggdhines'
import re
import numpy as np
with open("/home/ggdhines/folger_results","rb") as f:
subject_id = None
percentage = None
num_subjects = 0
consensus = []
subject_complete = []
started_lines = 0
total_lines = 0.
completed = 0
for l in f.readlines():
i... | {
"repo_name": "zooniverse/aggregation",
"path": "analysis/folger_summary.py",
"copies": "1",
"size": "1331",
"license": "apache-2.0",
"hash": -1506844832469314800,
"line_mean": 22.7857142857,
"line_max": 61,
"alpha_frac": 0.4598046582,
"autogenerated": false,
"ratio": 4.172413793103448,
"config... |
__author__ = 'GHajba'
from codecs import open
from os.path import dirname, abspath, isfile, getmtime
from time import ctime
from datetime import datetime
def write_line_at_beginning(filename, line):
input_file = open(filename, mode="r+", encoding="utf-8")
content = input_file.read()
input_file.seek(0, 0)... | {
"repo_name": "ghajba/wp-editor",
"path": "wpedit/file_utils.py",
"copies": "1",
"size": "1324",
"license": "mit",
"hash": -5913449431475977000,
"line_mean": 26.6041666667,
"line_max": 97,
"alpha_frac": 0.6737160121,
"autogenerated": false,
"ratio": 3.5119363395225465,
"config_test": false,
"... |
__author__ = 'GHajba'
from html2text import HTML2Text
import re
import json
class Xml2Md(HTML2Text):
def __init__(self, out=None, baseurl=''):
HTML2Text.__init__(self, baseurl=baseurl)
# because we do not need line wrapping in paragraphs
self.body_width = 0
def feed(self, data):
... | {
"repo_name": "ghajba/wp-editor",
"path": "wpedit/xml2md.py",
"copies": "1",
"size": "1982",
"license": "mit",
"hash": 4054028749325267000,
"line_mean": 30.9677419355,
"line_max": 150,
"alpha_frac": 0.5398587286,
"autogenerated": false,
"ratio": 3.6703703703703705,
"config_test": false,
"has_... |
__author__ = 'GHajba'
import argparse
import mdxml
from wordpress_xmlrpc import Client
from wordpress_xmlrpc import WordPressPost
from wordpress_xmlrpc.methods import posts, taxonomies
from os.path import expanduser
from xml2md import xml2md
from file_utils import write_line_at_beginning, read_file_lines, get_folder_n... | {
"repo_name": "ghajba/wp-editor",
"path": "wpedit/wpedit.py",
"copies": "1",
"size": "9294",
"license": "mit",
"hash": -5143479437567932000,
"line_mean": 37.4090909091,
"line_max": 207,
"alpha_frac": 0.6375080697,
"autogenerated": false,
"ratio": 4.141711229946524,
"config_test": true,
"has_n... |
__author__ = 'GHajba'
"""
Provides HTTP and HTTPS proxy support for Python's xmlrpclib, via urllib2.
Usage:
transport = HTTPProxyTransport({'http': <proxy host and port as string>,'https': <proxy host and port as string>,})
"""
import urllib2
import xmlrpclib
class Urllib2Transport(xmlrpclib.Transport):
def... | {
"repo_name": "ghajba/wp-editor",
"path": "wpedit/xmlrpc_proxy.py",
"copies": "1",
"size": "1161",
"license": "mit",
"hash": 6540027883728166000,
"line_mean": 36.4838709677,
"line_max": 119,
"alpha_frac": 0.6761412575,
"autogenerated": false,
"ratio": 3.6974522292993632,
"config_test": false,
... |
from datetime import date
import pandas as pd
from io import BytesIO
from urllib.request import urlopen
class Yahoo(object):
# Taken from http://www.jarloo.com/yahoo_finance/
yahoo_query_params = {
'ticker': 's',
'average_daily_volume': 'a2',
'dividend_yield': 'y',
'dividend_pe... | {
"repo_name": "Jul13/wepy",
"path": "wepy/io/yahoo.py",
"copies": "1",
"size": "4760",
"license": "apache-2.0",
"hash": -5298317480836868000,
"line_mean": 35.6153846154,
"line_max": 112,
"alpha_frac": 0.5344537815,
"autogenerated": false,
"ratio": 3.5311572700296736,
"config_test": false,
"ha... |
import os
from datetime import datetime
import pandas as pd
from functools import lru_cache
from pandas import HDFStore
from topyc.util.file import latest_filename
class WikiStore(object):
"""
WikiStore is a HDFStore storage for a Quandl WIKI dataset.
The Quandl WIKI dataset can be retrieved from: http... | {
"repo_name": "Jul13/wepy",
"path": "wepy/io/wiki_store.py",
"copies": "1",
"size": "2279",
"license": "apache-2.0",
"hash": -201316209935124640,
"line_mean": 28.2179487179,
"line_max": 106,
"alpha_frac": 0.5748135147,
"autogenerated": false,
"ratio": 3.500768049155146,
"config_test": false,
... |
import os
from datetime import datetime, date
from bs4 import BeautifulSoup
import pandas as pd
import urllib.request as urllib2
from topyc.util.file import latest_filename
SITE = "http://en.wikipedia.org/wiki/List_of_S%26P_500_companies"
def store_snapshot(base_dir):
hdr = {'User-Agent': 'Mozilla/5.0'}
r... | {
"repo_name": "Jul13/wepy",
"path": "wepy/io/sp500.py",
"copies": "1",
"size": "1798",
"license": "apache-2.0",
"hash": -3431376930452141600,
"line_mean": 31.6909090909,
"line_max": 93,
"alpha_frac": 0.6017797553,
"autogenerated": false,
"ratio": 3.3670411985018727,
"config_test": false,
"has... |
__author__="ghermeto"
__date__ ="$09/05/2012 11:30:00$"
import time
import blitz.rush
import blitz.sprint
from blitz.api import Curl, ValidationError
from blitz.validation import validate
class Test(Curl):
""" Curl test class that parsers a command and return either a rush or a
sprint result object. """
... | {
"repo_name": "blitz-io/blitz-python",
"path": "src/blitz/curl.py",
"copies": "1",
"size": "1380",
"license": "mit",
"hash": -6483140506196730000,
"line_mean": 32.6829268293,
"line_max": 80,
"alpha_frac": 0.6210144928,
"autogenerated": false,
"ratio": 4.299065420560748,
"config_test": false,
... |
__author__ = "ghermeto"
__date__ = "$27/07/2011 23:23:17$"
import json
import time
try:
from http.client import HTTPSConnection
except ImportError:
from httplib import HTTPSConnection
class Error(Exception):
""" Base error for Blitz api. """
def __init__(self, error, reason):
self.error = er... | {
"repo_name": "blitz-io/blitz-python",
"path": "src/blitz/api.py",
"copies": "1",
"size": "6826",
"license": "mit",
"hash": -2900413294841159700,
"line_mean": 36.306010929,
"line_max": 80,
"alpha_frac": 0.5801347788,
"autogenerated": false,
"ratio": 4.149544072948328,
"config_test": false,
"h... |
__author__="ghermeto"
__date__ ="$27/07/2011 23:23:30$"
from blitz.api import Curl, ValidationError
from blitz.validation import validate_list, validate
class Step:
""" Per-step (for transactional rushes) metrics of a rush at time[i]. """
def __init__(self, step):
""" duration: The duration of th... | {
"repo_name": "blitz-io/blitz-python",
"path": "src/blitz/rush.py",
"copies": "1",
"size": "3969",
"license": "mit",
"hash": 8890838485361815000,
"line_mean": 43.1111111111,
"line_max": 80,
"alpha_frac": 0.6135046611,
"autogenerated": false,
"ratio": 4.449551569506727,
"config_test": false,
"... |
__author__="ghermeto"
__date__ ="$27/07/2011 23:23:38$"
import base64
from blitz.api import Curl, ValidationError
from blitz.validation import validate_list, validate
class Request:
"""Represents the request object generated by the sprint. Contains all
of the headers and POST/PUT data, if any."""
... | {
"repo_name": "blitz-io/blitz-python",
"path": "src/blitz/sprint.py",
"copies": "1",
"size": "4417",
"license": "mit",
"hash": 466734476104188900,
"line_mean": 43.18,
"line_max": 80,
"alpha_frac": 0.6246321032,
"autogenerated": false,
"ratio": 4.581950207468879,
"config_test": false,
"has_no_... |
__author__="ghermeto"
__date__ ="$28/07/2011 19:13:12$"
import re
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
def validate_url(url):
parsed = urlparse(url)
return parsed.scheme and parsed.netloc
def validate_int(value):
str_value = str(value)
retu... | {
"repo_name": "blitz-io/blitz-python",
"path": "src/blitz/validation.py",
"copies": "1",
"size": "1373",
"license": "mit",
"hash": 7452708991262261000,
"line_mean": 31.7142857143,
"line_max": 73,
"alpha_frac": 0.6001456664,
"autogenerated": false,
"ratio": 4.002915451895044,
"config_test": fals... |
__author__ = 'giacomo'
class LWM2MInstance(object):
ID = "id"
NAME = "name"
INSTANCE_TYPE = "instancetype"
MANDATORY = "mandatory"
DESCRIPTION = "description"
RESOURCEDEFS = "resourcedefs"
class LWM2MResource(object):
ID = "id"
NAME = "name"
INSTANCE_TYPE = "instancetype"
MAN... | {
"repo_name": "Tanganelli/lwm2mthon",
"path": "lwm2mthon/defines.py",
"copies": "1",
"size": "4240",
"license": "apache-2.0",
"hash": 2723447480483964000,
"line_mean": 25.6666666667,
"line_max": 116,
"alpha_frac": 0.6158018868,
"autogenerated": false,
"ratio": 2.821024617431803,
"config_test": ... |
__author__ = 'Giacomo Tanganelli'
__version__ = "2.0"
''' CoAP Parameters '''
ACK_TIMEOUT = 6 # standard 2
SEPARATE_TIMEOUT = ACK_TIMEOUT / 2
ACK_RANDOM_FACTOR = 1.5
MAX_RETRANSMIT = 0
MAX_TRANSMIT_SPAN = ACK_TIMEOUT * (pow(2, (MAX_RETRANSMIT + 1)) - 1) * ACK_RANDOM_FACTOR
MAX_LATENCY = 120 # 2 minutes
PROCES... | {
"repo_name": "Cereal84/CoAPthon",
"path": "coapthon/defines.py",
"copies": "1",
"size": "4090",
"license": "mit",
"hash": 8543669667465998000,
"line_mean": 22.918128655,
"line_max": 88,
"alpha_frac": 0.6354523227,
"autogenerated": false,
"ratio": 2.9745454545454546,
"config_test": false,
"ha... |
__author__ = 'Giacomo Tanganelli'
__version__ = "2.0"
def byte_len(int_type):
"""
Get the number of byte needed to encode the int passed.
:param int_type: the int to be converted
:return: the number of bits needed to encode the int passed.
"""
length = 0
while int_type:
int_type >... | {
"repo_name": "Cereal84/CoAPthon",
"path": "coapthon/utils.py",
"copies": "1",
"size": "1705",
"license": "mit",
"hash": -1211526411286877700,
"line_mean": 21.1428571429,
"line_max": 64,
"alpha_frac": 0.5260997067,
"autogenerated": false,
"ratio": 3.9016018306636155,
"config_test": false,
"ha... |
#A hack on the astropy Table class to make its output
#more appealing, especially when in the Ipython notebook
import astropy.table
class Table(astropy.table.Table):
def _base_repr_(self, html=False, show_name=True, **kwargs):
'''Override the method in the astropy.Table class
to avoid displa... | {
"repo_name": "sybenzvi/3ML",
"path": "threeML/io/table.py",
"copies": "1",
"size": "1079",
"license": "bsd-3-clause",
"hash": 3079136660242178000,
"line_mean": 32.71875,
"line_max": 86,
"alpha_frac": 0.6339202966,
"autogenerated": false,
"ratio": 3.68259385665529,
"config_test": false,
"has_... |
# A hack on the astropy Table class to make its output
# more appealing, especially when in the Ipython notebook
import pandas as pd
import astropy.table
from astromodels.utils.long_path_formatter import long_path_formatter
class Table(astropy.table.Table):
def _base_repr_(self, html=False, show_name=True, **kw... | {
"repo_name": "giacomov/3ML",
"path": "threeML/io/table.py",
"copies": "1",
"size": "1202",
"license": "bsd-3-clause",
"hash": 6642535725879392000,
"line_mean": 30.6315789474,
"line_max": 86,
"alpha_frac": 0.6322795341,
"autogenerated": false,
"ratio": 3.653495440729483,
"config_test": false,
... |
#A hack on the astropy Table class to make its output
#more appealing, especially when in the Ipython notebook
import pandas as pd
import astropy.table
from astromodels.utils.long_path_formatter import long_path_formatter
class Table(astropy.table.Table):
def _base_repr_(self, html=False, show_name=True, *... | {
"repo_name": "volodymyrss/3ML",
"path": "threeML/io/table.py",
"copies": "1",
"size": "1170",
"license": "bsd-3-clause",
"hash": 6086831870387668000,
"line_mean": 32.4285714286,
"line_max": 86,
"alpha_frac": 0.6495726496,
"autogenerated": false,
"ratio": 3.6792452830188678,
"config_test": fals... |
import logging
import sys
import numpy as np
import numexpr
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("bayesian_blocks")
__all__ = ['bayesian_blocks', 'bayesian_blocks_not_unique']
def bayesian_blocks_not_unique(tt, ttstart, ttstop, p0):
# Verify that the input array is one-dimension... | {
"repo_name": "giacomov/fermi_blind_search",
"path": "fermi_blind_search/BayesianBlocks.py",
"copies": "1",
"size": "11332",
"license": "bsd-3-clause",
"hash": 3751954628517399000,
"line_mean": 29.0583554377,
"line_max": 106,
"alpha_frac": 0.5986586657,
"autogenerated": false,
"ratio": 3.62276214... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.