text stringlengths 0 1.05M | meta dict |
|---|---|
from PIL import Image
import numpy as np
class Scaler:
def __init__(self, pixel_width, pixel_height, width=None, height=None, startx=0, starty=0):
self.pixel_width = pixel_width
self.pixel_height = pixel_height
self.startx = startx
self.starty = starty
self.width = width
... | {
"repo_name": "martinmcbride/pytexture",
"path": "generativepy/bitmap.py",
"copies": "1",
"size": "4314",
"license": "mit",
"hash": -6311756577510200000,
"line_mean": 32.968503937,
"line_max": 100,
"alpha_frac": 0.6323597589,
"autogenerated": false,
"ratio": 3.6191275167785233,
"config_test": f... |
import numpy as np
from generativepy.movie import save_frame, save_frames
from generativepy.color import make_colormap
def make_nparray_frame(paint, pixel_width, pixel_height, channels=3, out=None):
'''
Create a frame using numpy
:param paint: the paint function
:param pixel_width: width in pixels, in... | {
"repo_name": "martinmcbride/pytexture",
"path": "generativepy/nparray.py",
"copies": "1",
"size": "4962",
"license": "mit",
"hash": 5249650672649541000,
"line_mean": 36.5984848485,
"line_max": 117,
"alpha_frac": 0.6656590085,
"autogenerated": false,
"ratio": 3.6061046511627906,
"config_test": ... |
import sys
import tempfile
import os.path
import math
def correct_pycairo_byte_order(array, channels):
'''
If byte ordering is little endian, bitmap data from Pycairo needs swapping
Convert a numpy array from BGR/BGRA ordering to RGB/RGBA.
Conversion is performed in place
:param array: numpy array... | {
"repo_name": "martinmcbride/pytexture",
"path": "generativepy/utils.py",
"copies": "1",
"size": "1668",
"license": "mit",
"hash": 8854669032723138000,
"line_mean": 25.4761904762,
"line_max": 78,
"alpha_frac": 0.6169064748,
"autogenerated": false,
"ratio": 3.376518218623482,
"config_test": fals... |
from generativepy.utils import temp_file
from pathlib import Path
from PIL import Image
from PIL import ImageChops
import os
def compare_images(path1, path2):
with Image.open(path1) as im1:
with Image.open(path2) as im2:
if im1.size != im2.size:
return False
if im1.... | {
"repo_name": "martinmcbride/pytexture",
"path": "imagetests/image_test_helper.py",
"copies": "1",
"size": "1527",
"license": "mit",
"hash": -7880955011546523000,
"line_mean": 30.1632653061,
"line_max": 73,
"alpha_frac": 0.6476751801,
"autogenerated": false,
"ratio": 3.6099290780141846,
"config... |
import moderngl
import numpy as np
from PIL import Image
from generativepy.color import Color
def make_3dimage(outfile, draw, width, height, background=Color(0), channels=3):
'''
Create a PNG file using moderngl
:param outfile: Name of output file
:param draw: the draw function
:param width: widt... | {
"repo_name": "martinmcbride/pytexture",
"path": "generativepy/drawing3d.py",
"copies": "1",
"size": "3072",
"license": "mit",
"hash": -5580872442638565000,
"line_mean": 29.72,
"line_max": 85,
"alpha_frac": 0.650390625,
"autogenerated": false,
"ratio": 3.696750902527076,
"config_test": false,
... |
from generativepy.drawing import make_image, setup
from generativepy.color import Color
from generativepy.geometry import Rectangle
def draw_css(ctx, pixel_width, pixel_height, frame_no, frame_count):
setup(ctx, pixel_width, pixel_height, background=Color('cornflowerblue'))
pos = [10, 10]
w = 100
h ... | {
"repo_name": "martinmcbride/pytexture",
"path": "tutorial/colour_css.py",
"copies": "1",
"size": "1070",
"license": "mit",
"hash": -6112926217526294000,
"line_mean": 30.4705882353,
"line_max": 77,
"alpha_frac": 0.6514018692,
"autogenerated": false,
"ratio": 2.7864583333333335,
"config_test": f... |
from generativepy.drawing import make_image, setup
from generativepy.color import Color
from generativepy.geometry import Rectangle
def draw_hsl(ctx, pixel_width, pixel_height, frame_no, frame_count):
setup(ctx, pixel_width, pixel_height, background=Color('cornflowerblue'))
pos = [10, 10]
w = 70
h =... | {
"repo_name": "martinmcbride/pytexture",
"path": "tutorial/colour_hsl.py",
"copies": "1",
"size": "3665",
"license": "mit",
"hash": -5348189513727440000,
"line_mean": 39.7222222222,
"line_max": 79,
"alpha_frac": 0.5869031378,
"autogenerated": false,
"ratio": 2.162241887905605,
"config_test": fa... |
from generativepy.drawing import make_image, setup
from generativepy.color import Color
from generativepy.geometry import Rectangle
def draw_rgb(ctx, pixel_width, pixel_height, frame_no, frame_count):
setup(ctx, pixel_width, pixel_height, background=Color("cornflowerblue"))
pos = [10, 10]
w = 100
h ... | {
"repo_name": "martinmcbride/pytexture",
"path": "tutorial/colour_rgb.py",
"copies": "1",
"size": "1065",
"license": "mit",
"hash": -1123511102455480000,
"line_mean": 30.3235294118,
"line_max": 77,
"alpha_frac": 0.6300469484,
"autogenerated": false,
"ratio": 2.572463768115942,
"config_test": fa... |
from generativepy.drawing import make_image, setup
from generativepy.color import Color
from generativepy.geometry import Rectangle
from generativepy.drawing import make_image, setup
from generativepy.color import Color
from generativepy.geometry import Rectangle
def draw_alpha(ctx, pixel_width, pixel_height, frame... | {
"repo_name": "martinmcbride/pytexture",
"path": "tutorial/colour_alpha.py",
"copies": "1",
"size": "1065",
"license": "mit",
"hash": -4216801486928949000,
"line_mean": 30.3529411765,
"line_max": 84,
"alpha_frac": 0.6788732394,
"autogenerated": false,
"ratio": 2.7662337662337664,
"config_test":... |
from generativepy.drawing import make_image, setup
from generativepy.color import Color
from generativepy.geometry import Text, Circle, Line
import math
def draw_alpha(ctx, pixel_width, pixel_height, frame_no, frame_count):
setup(ctx, pixel_width, pixel_height, background=Color(1))
a = (100, 100)
Circle... | {
"repo_name": "martinmcbride/pytexture",
"path": "tutorial/text_offset.py",
"copies": "1",
"size": "1230",
"license": "mit",
"hash": 1745777860263556400,
"line_mean": 35.2058823529,
"line_max": 87,
"alpha_frac": 0.6471544715,
"autogenerated": false,
"ratio": 2.7032967032967035,
"config_test": f... |
__author__ = 'martin'
import socket, six, re
def verify_ip(ip, multicast_groups):
error = False
faulty_ip = None
reason = None
if not isinstance(ip, six.string_types):
error = True
faulty_ip = ip
reason = "IP must be a string"
return (error, faulty_ip, reason)
#Inst... | {
"repo_name": "Alternhuman/marcopolo",
"path": "marcopolo/marco_conf/utils.py",
"copies": "1",
"size": "2048",
"license": "mpl-2.0",
"hash": 5164680740122905000,
"line_mean": 24.2962962963,
"line_max": 74,
"alpha_frac": 0.5854492188,
"autogenerated": false,
"ratio": 3.992202729044834,
"config_t... |
__author__ = 'martin'
from monty import arrayFromFile
from monty import cleanData
from monty import plotevents
import csv
import numpy as np
import os
def normlize(data_small, data_large, binnum):
"""Normalizes the data of the larger count data_large
:rtype : numpy array
according to the count rate of d... | {
"repo_name": "Lothilius/ortho-positronium",
"path": "norm.py",
"copies": "1",
"size": "1842",
"license": "mit",
"hash": -2935866253103871500,
"line_mean": 29.7,
"line_max": 120,
"alpha_frac": 0.6726384365,
"autogenerated": false,
"ratio": 3.0751252086811354,
"config_test": false,
"has_no_key... |
__author__ = 'martin'
from sqlalchemy.orm import sessionmaker
from sqlalchemy import desc
from sqlalchemy import update
from sqlalchemy import connectors as conn
from Pyoi import *
from authentication import mysql_engine_prod, mysql_engine_test
import fb_grab_events
import numpy as np
from sqlalchemy.orm.exc import Mu... | {
"repo_name": "Lothilius/oiPy",
"path": "Pysql.py",
"copies": "1",
"size": "4893",
"license": "mit",
"hash": -4014628619220970000,
"line_mean": 29.0245398773,
"line_max": 108,
"alpha_frac": 0.6233394645,
"autogenerated": false,
"ratio": 3.587243401759531,
"config_test": false,
"has_no_keyword... |
__author__ = 'Martin'
from xmlrpc.server import SimpleXMLRPCServer
import json
import eval
import method_params
import os
import sys
import multiprocessing
import time
stop_server = False
def eval_dags(inputs: multiprocessing.Queue, outputs: multiprocessing.Queue):
while True:
try:
ind_id, i... | {
"repo_name": "martinpilat/dag-evaluate",
"path": "xmlrpc_interface.py",
"copies": "1",
"size": "5199",
"license": "mit",
"hash": 1059414644969603500,
"line_mean": 31.6981132075,
"line_max": 125,
"alpha_frac": 0.5481823428,
"autogenerated": false,
"ratio": 3.7456772334293946,
"config_test": fal... |
__author__ = 'Martin'
import custom_models
from sklearn import decomposition, feature_selection, svm, linear_model, naive_bayes, tree, discriminant_analysis, neural_network
import json
model_names = {
"PCA": custom_models.make_transformer(decomposition.PCA),
"kBest": custom_models.make_transfo... | {
"repo_name": "martinpilat/dag-evaluate",
"path": "method_params.py",
"copies": "1",
"size": "4574",
"license": "mit",
"hash": -1180894847446598100,
"line_mean": 39.1315789474,
"line_max": 129,
"alpha_frac": 0.5010931351,
"autogenerated": false,
"ratio": 3.086369770580297,
"config_test": false,... |
__author__ = 'Martin'
import json
import method_params
import networkx as nx
def read_json(file_name):
"""
Reads the JSON file with name file_name and returns its contents.
:param file_name: The name of the JSON file
:return: The content of the JSON file
"""
return json.load(open(file_name, '... | {
"repo_name": "martinpilat/dag-evaluate",
"path": "utils.py",
"copies": "1",
"size": "3302",
"license": "mit",
"hash": -2784368577824294000,
"line_mean": 29.2935779817,
"line_max": 171,
"alpha_frac": 0.530284676,
"autogenerated": false,
"ratio": 3.3901437371663246,
"config_test": false,
"has_... |
__author__ = 'martin'
import six, socket
def verify_ip(ip):
error = False
faulty_ip = None
reason = None
if not isinstance(ip, six.string_types):
error = True
faulty_ip = ip
reason = "IP must be a string"
return (error, faulty_ip, reason)... | {
"repo_name": "Alternhuman/marcopolo-bindings-python",
"path": "marcopolo/bindings/utils.py",
"copies": "1",
"size": "2129",
"license": "mpl-2.0",
"hash": -7128280679488391000,
"line_mean": 25.625,
"line_max": 74,
"alpha_frac": 0.5453264443,
"autogenerated": false,
"ratio": 4.275100401606426,
"... |
__author__ = 'Martin'
import sys
import json
import matplotlib.pyplot as plt
import numpy as np
def aggregate(logs, field):
agg = map(lambda log: [x[field] for x in log], logs)
agg = np.array(list(zip(*agg)))
print(agg)
return np.array([np.min(agg, axis=1), np.mean(agg, axis=1), np.max(agg, axis=1)])... | {
"repo_name": "martinpilat/dag-evaluate",
"path": "aggregate_logs.py",
"copies": "1",
"size": "1209",
"license": "mit",
"hash": -2970139238626427400,
"line_mean": 29.225,
"line_max": 143,
"alpha_frac": 0.5756823821,
"autogenerated": false,
"ratio": 3.045340050377834,
"config_test": false,
"ha... |
__author__ = 'Martin'
import sys
import json
import os
import numpy as np
def iterate_logs(log_path):
log_pattern = 'log_%03d.json'
num = 0
while True:
try:
yield json.load(open(os.path.join(log_path, log_pattern % num)))
num += 1
except IOError:
raise... | {
"repo_name": "martinpilat/dag-evaluate",
"path": "process_logs.py",
"copies": "1",
"size": "1720",
"license": "mit",
"hash": 5232698995387351000,
"line_mean": 29.1754385965,
"line_max": 90,
"alpha_frac": 0.5104651163,
"autogenerated": false,
"ratio": 3.197026022304833,
"config_test": true,
"... |
__author__ = "Martin Pilat"
import sys
import time
import joblib
import pprint
import os
import ml_metrics as mm
import numpy as np
import pandas as pd
from sklearn import cross_validation, preprocessing, decomposition, feature_selection, metrics
import networkx as nx
import custom_models
import utils
import inspec... | {
"repo_name": "martinpilat/dag-evaluate",
"path": "eval.py",
"copies": "1",
"size": "16049",
"license": "mit",
"hash": 8483437220685429000,
"line_mean": 36.6737089202,
"line_max": 166,
"alpha_frac": 0.5685712505,
"autogenerated": false,
"ratio": 3.7375407545412203,
"config_test": true,
"has_n... |
#depends on:
#pdfkit: https://pypi.python.org/pypi/pdfkit
#you need to install pdftk-server (and restart after that, so that the PATH envvar works)
#https://www.pdflabs.com/tools/pdftk-server/
import re
import urllib.request
import urllib.parse
import pprint
import sys, getopt
import os
import pdfkit
import subproces... | {
"repo_name": "Yours3lf/website_to_pdf",
"path": "website_to_pdf.py",
"copies": "1",
"size": "4027",
"license": "mit",
"hash": 6469569139122274000,
"line_mean": 27.1678321678,
"line_max": 130,
"alpha_frac": 0.6292525453,
"autogenerated": false,
"ratio": 3.1859177215189876,
"config_test": false,... |
__author__ = 'martscsn'
import codecs
import bs4
import cort
import stanford_corenlp_pywrapper
from cort.StanfordDependencies import CoNLL
from cort.core import corpora, documents, spans
class Pipeline():
def __init__(self, corenlp_location, with_coref=False):
package_dir = cort.__path__[0]
if... | {
"repo_name": "Yegor-Budnikov/cort",
"path": "cort/preprocessing/pipeline.py",
"copies": "1",
"size": "5415",
"license": "mit",
"hash": -7361651488208299000,
"line_mean": 31.6204819277,
"line_max": 80,
"alpha_frac": 0.4400738689,
"autogenerated": false,
"ratio": 4.41320293398533,
"config_test":... |
__author__ = 'martscsn'
import cort
import codecs
import stanford_corenlp_pywrapper
from StanfordDependencies import CoNLL
from cort.core import corpora, documents, spans
import bs4
class Pipeline():
def __init__(self, corenlp_location, with_coref=False):
package_dir = cort.__path__[0]
if w... | {
"repo_name": "smartschat/cort",
"path": "cort/preprocessing/pipeline.py",
"copies": "1",
"size": "5413",
"license": "mit",
"hash": 4475367524661828000,
"line_mean": 31.0295857988,
"line_max": 80,
"alpha_frac": 0.439497506,
"autogenerated": false,
"ratio": 4.411572942135289,
"config_test": fals... |
__author__ = 'Maruf Maniruzzaman'
import logging
import collections
import urlparse
import urllib2
import urllib
from datetime import *
import base64
import hmac
import hashlib
from urllib2 import HTTPError
import xml.etree.cElementTree as ET
from payment import Base
logger = logging.getLogger(__name__)
class S... | {
"repo_name": "kuasha/payment",
"path": "payment/amazon/simplepay.py",
"copies": "1",
"size": "6069",
"license": "mit",
"hash": -6418991177425536000,
"line_mean": 35.3413173653,
"line_max": 126,
"alpha_frac": 0.6076783655,
"autogenerated": false,
"ratio": 4.056818181818182,
"config_test": false... |
__author__ = 'maruf'
import payment
from payment.amazon.simplepay import *
from tornado import gen
from cosmos.service.requesthandler import RequestHandler
from cosmos.rbac.object import *
from cosmos.service.utils import MongoObjectJSONEncoder
DEBUG = True
ACCESS_KEY = "<your account access key here>"
SECRET_KEY =... | {
"repo_name": "kuasha/payment",
"path": "samples/amazon/simplepay/views.py",
"copies": "1",
"size": "3670",
"license": "mit",
"hash": -1675669372250575000,
"line_mean": 41.183908046,
"line_max": 176,
"alpha_frac": 0.574386921,
"autogenerated": false,
"ratio": 4.006550218340611,
"config_test": f... |
__author__ = 'maru'
__copyright__ = "Copyright 2013, ML Lab"
__version__ = "0.1"
__status__ = "Development"
import sys
import os
sys.path.append(os.path.abspath("."))
from experiment_utils import *
import argparse
import numpy as np
from sklearn.datasets.base import Bunch
from datautil.load_data import load_dataset
... | {
"repo_name": "mramire8/active",
"path": "experiment/anytime.py",
"copies": "1",
"size": "15095",
"license": "apache-2.0",
"hash": 382821245817858700,
"line_mean": 35.1124401914,
"line_max": 135,
"alpha_frac": 0.5385889367,
"autogenerated": false,
"ratio": 3.8764766307139187,
"config_test": fal... |
__author__ = 'maru'
__copyright__ = "Copyright 2013, ML Lab"
__version__ = "0.1"
__status__ = "Development"
import sys
import os
sys.path.append(os.path.abspath("."))
from experiment_utils import print_results, parse_parameters_mat, set_cost_model
import argparse
import numpy as np
from sklearn.datasets.base import... | {
"repo_name": "mramire8/active",
"path": "experiment/unck_cheat.py",
"copies": "1",
"size": "12107",
"license": "apache-2.0",
"hash": 2462286822354353700,
"line_mean": 35.7993920973,
"line_max": 135,
"alpha_frac": 0.5320062774,
"autogenerated": false,
"ratio": 3.9029658284977433,
"config_test":... |
__author__ = 'maru'
from expert.base import BaseExpert
import os
class HumanExpert(BaseExpert):
def __init__(self, model, prompt):
super(HumanExpert, self).__init__(model)
self.elapsed_time = -1
self.num_classes = 3 # binary + neutral
self.prompt = prompt
self.paused = Fa... | {
"repo_name": "mramire8/structured",
"path": "expert/human_expert.py",
"copies": "1",
"size": "2835",
"license": "apache-2.0",
"hash": -4991394042880256000,
"line_mean": 34.45,
"line_max": 96,
"alpha_frac": 0.4497354497,
"autogenerated": false,
"ratio": 4.3019726858877085,
"config_test": false,... |
__author__ = 'maru'
from experts import PredictingExpert
import numpy as np
import nltk
class NoisyReluctantDocumentExpert(PredictingExpert):
def __init__(self, oracle, reluctant_threshold, factor=1., data_size=None, seed=43212):
super(NoisyReluctantDocumentExpert, self).__init__(oracle)
self.rel... | {
"repo_name": "mramire8/structured",
"path": "expert/noisy_expert.py",
"copies": "1",
"size": "2778",
"license": "apache-2.0",
"hash": 7014473374778524000,
"line_mean": 32.0714285714,
"line_max": 91,
"alpha_frac": 0.5856731461,
"autogenerated": false,
"ratio": 3.5120101137800255,
"config_test":... |
__author__ = 'maru'
import ast
from collections import defaultdict
import numpy as np
from sklearn.naive_bayes import MultinomialNB
from sklearn.linear_model import LogisticRegression
from learner.adaptive_lr import LogisticRegressionAdaptive, LogisticRegressionAdaptiveV2
import matplotlib.pyplot as plt
from strateg... | {
"repo_name": "mramire8/active",
"path": "experiment/experiment_utils.py",
"copies": "1",
"size": "15927",
"license": "apache-2.0",
"hash": 7649880256916578000,
"line_mean": 34.5513392857,
"line_max": 129,
"alpha_frac": 0.5758774408,
"autogenerated": false,
"ratio": 3.005661445555765,
"config_t... |
__author__ = 'maru'
import datautils as utils
from sklearn.datasets import base as bunch
from collections import defaultdict
def load_data_results(filename):
import csv
results = defaultdict(lambda: [])
header = []
with open(filename, 'rb') as csvfile:
sents = csv.DictReader(csvfile, delimit... | {
"repo_name": "mramire8/structured",
"path": "utilities/amt_datautils.py",
"copies": "1",
"size": "3724",
"license": "apache-2.0",
"hash": -3685636368365348000,
"line_mean": 30.0333333333,
"line_max": 106,
"alpha_frac": 0.6251342642,
"autogenerated": false,
"ratio": 3.5032925682031983,
"config_... |
__author__ = 'maru'
import numpy as np
import itertools as it
class SnippetTokenizer(object):
def __init__(self, k=(1,1)):
import nltk
self.sent_tk = nltk.data.load('tokenizers/punkt/english.pickle')
self.k = k
self.separator = " "
self.split_bound = '\\b\\w+\\b'
def... | {
"repo_name": "mramire8/structured",
"path": "utilities/snippet_tokenizer.py",
"copies": "1",
"size": "5940",
"license": "apache-2.0",
"hash": 339783141401686000,
"line_mean": 27.2857142857,
"line_max": 86,
"alpha_frac": 0.5585858586,
"autogenerated": false,
"ratio": 3.337078651685393,
"config_... |
__author__ = 'maru'
import os, sys
sys.path.append(os.path.abspath("."))
sys.path.append(os.path.abspath("../"))
import numpy as np
import utilities.datautils as datautil
import utilities.configutils as cfgutil
import utilities.experimentutils as exputil
from sklearn.datasets import base as bunch
from learner.strat... | {
"repo_name": "mramire8/structured",
"path": "user_study/study.py",
"copies": "1",
"size": "19801",
"license": "apache-2.0",
"hash": 3381076133634110000,
"line_mean": 38.4462151394,
"line_max": 126,
"alpha_frac": 0.5684561386,
"autogenerated": false,
"ratio": 3.7802596410843834,
"config_test": ... |
__author__ = 'Marvin Laske'
import requests
import urlparse
from json import loads
class ScrapydApi:
def __init__(self, scrapyd_url):
"""
Initializes the api for a specific url
:type scrapyd_url: str
:param scrapyd_url: base url (including port if != 80) of the scrapyd installati... | {
"repo_name": "biddyweb/scrapyd-panel",
"path": "scrapyd_api/scrapi.py",
"copies": "1",
"size": "5581",
"license": "mit",
"hash": 4037183333656816600,
"line_mean": 28.8502673797,
"line_max": 95,
"alpha_frac": 0.5805411217,
"autogenerated": false,
"ratio": 4.387578616352202,
"config_test": false... |
__author__ = 'Marvin Laske'
import sqlite3
import model
from contextlib import closing
class DatabaseSqlite:
def __init__(self, connection_string):
self.connection_string = connection_string
def connect(self):
"""
connects to the default sqlite file
:rtype : sqlite3.connecti... | {
"repo_name": "biddyweb/scrapyd-panel",
"path": "database/dbsqlite.py",
"copies": "1",
"size": "2219",
"license": "mit",
"hash": 4016754526540832300,
"line_mean": 28.2105263158,
"line_max": 94,
"alpha_frac": 0.5263632267,
"autogenerated": false,
"ratio": 4.5378323108384455,
"config_test": false... |
__author__ = 'Marvin Smith'
# LLNMS Libraries
from ..Globals import *
# Python Libraries
import re
# ---------------------- #
# - IP Type - #
# ---------------------- #
class IP_Address_Type(object):
# Value
UNKNOWN = -1
IPV4 = 0
IPV6 = 1
# ----------------------------- #
... | {
"repo_name": "marvins/LLNMS",
"path": "src/core/python/llnms/utility/Network_Utilities.py",
"copies": "1",
"size": "2074",
"license": "mit",
"hash": -233888615441625920,
"line_mean": 22.5795454545,
"line_max": 71,
"alpha_frac": 0.4146576663,
"autogenerated": false,
"ratio": 3.9884615384615385,
... |
__author__ = 'marvinsmith'
# ----------------------------------- #
# - Main Window Handler - #
# ----------------------------------- #
class Main_Window_Handler(object):
# Window to manage
window = None
# ----------------------------------- #
# - Constructor -#
#... | {
"repo_name": "marvins/LLNMS",
"path": "src/core/python/llnms/viewer/ui/handlers/Main_Window_Handler.py",
"copies": "1",
"size": "1081",
"license": "mit",
"hash": -4704993546531411000,
"line_mean": 32.8125,
"line_max": 71,
"alpha_frac": 0.4218316374,
"autogenerated": false,
"ratio": 4.37651821862... |
__author__ = 'marvinsmith'
# Python Libraries
import curses, logging
# --------------------------------- #
# - Base Window Type - #
# --------------------------------- #
class Base_Window_Type(object):
# Window Title
window_title = ''
# Window render screen
screen = None
# Cur... | {
"repo_name": "marvins/LLNMS",
"path": "src/core/python/llnms/viewer/ui/UI_Window_Base.py",
"copies": "1",
"size": "4457",
"license": "mit",
"hash": -3705508704878588000,
"line_mean": 26.512345679,
"line_max": 94,
"alpha_frac": 0.4601750056,
"autogenerated": false,
"ratio": 4.123034227567068,
"... |
__author__ = 'marvinsmith'
# Python Libraries
import logging, curses
# LLNMS Libraries
from UI_Window_Base import *
import CursesTable
class ScannerSummaryWindow(Base_Window_Type):
# Exit Window Flag
exit_window = False
# Current Scanner
current_scanner = 0
# --------------------------- #
... | {
"repo_name": "marvins/LLNMS",
"path": "src/core/python/llnms/viewer/ui/ScannerSummaryWindow.py",
"copies": "1",
"size": "3818",
"license": "mit",
"hash": -6599036717107168000,
"line_mean": 27.5,
"line_max": 89,
"alpha_frac": 0.4772132006,
"autogenerated": false,
"ratio": 4.145494028230185,
"co... |
__author__ = 'Marzouq Abedur Rahman'
# import the necessary packages
from collections import deque
import numpy as np
import argparse
import imutils
import cv2
# construct the argument parse and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-v", "--video",
help="path to the (opt... | {
"repo_name": "Xyrotechnology/Project-Anthrax",
"path": "SD/libraries/Scripts/openCV/ball_tracking.py",
"copies": "1",
"size": "3545",
"license": "apache-2.0",
"hash": 7367527169543102000,
"line_mean": 33.4174757282,
"line_max": 103,
"alpha_frac": 0.6262341326,
"autogenerated": false,
"ratio": 3.... |
__author__ = 'Marzouq Abedur Rahman'
# This algorithm is for tracking an object moving across a frame.
# import the necessary packages
import numpy as np
import argparse
import cv2
# initialize the current frame of the video, along with the list of
# ROI points along with whether or not this is input mode
frame = N... | {
"repo_name": "Xyrotechnology/Project-Anthrax",
"path": "SD/libraries/Scripts/openCV/camshift.py",
"copies": "1",
"size": "4184",
"license": "apache-2.0",
"hash": -7319898073146625000,
"line_mean": 30.4586466165,
"line_max": 74,
"alpha_frac": 0.651290631,
"autogenerated": false,
"ratio": 3.366049... |
__author__ = 'Marzouq Abedur Rahman'
# This an algorithm that detects and prints the distance of an object from the camera by using triangle similarity.
# For this algorithm, you will need the following parameters:
# i) Known width of the object to be tracked.
# ii) Known distance of the object from the camera (Lets ju... | {
"repo_name": "Xyrotechnology/Project-Anthrax",
"path": "SD/libraries/Scripts/openCV/distance.py",
"copies": "1",
"size": "2681",
"license": "apache-2.0",
"hash": -4805264361583846000,
"line_mean": 38.4264705882,
"line_max": 117,
"alpha_frac": 0.7004848937,
"autogenerated": false,
"ratio": 3.2575... |
__author__ = 'Masha'
from abstractpipeline import *
import pandas as pd
import postprocessors as pp
from dataloader import get_feature_object
class AbstractPandasFeature(AbstractPipelineConfig):
'''
Abstract representation of a pandas feature. A pandas feature checks out columns from the database
and is t... | {
"repo_name": "dssg/education-college-public",
"path": "code/modeling/featurepipeline/abstractpandasfeature.py",
"copies": "1",
"size": "5456",
"license": "mit",
"hash": 866521910014696000,
"line_mean": 34.9013157895,
"line_max": 115,
"alpha_frac": 0.6359970674,
"autogenerated": false,
"ratio": 3... |
__author__ = 'masudurrahman'
import sys
from twisted.protocols import ftp
from twisted.protocols.ftp import FTPFactory, FTPAnonymousShell, FTPRealm, FTP, FTPShell, IFTPShell
from twisted.cred.portal import Portal
from twisted.cred import checkers
from twisted.cred.checkers import AllowAnonymousAccess, FilePasswordDB
f... | {
"repo_name": "mrahman1122/Team4CS3240",
"path": "Server/server.py",
"copies": "1",
"size": "1904",
"license": "apache-2.0",
"hash": 564431360007358460,
"line_mean": 33.6181818182,
"line_max": 114,
"alpha_frac": 0.6806722689,
"autogenerated": false,
"ratio": 3.8003992015968064,
"config_test": f... |
__author__ = 'masudurrahman'
import sys
import os
from twisted.protocols import ftp
from twisted.protocols.ftp import FTPFactory, FTPAnonymousShell, FTPRealm, FTP, FTPShell, IFTPShell
from twisted.cred.portal import Portal
from twisted.cred import checkers
from twisted.cred.checkers import AllowAnonymousAccess, FilePa... | {
"repo_name": "mrahman1122/Team4CS3240",
"path": "Server/newServer.py",
"copies": "1",
"size": "2295",
"license": "apache-2.0",
"hash": 3695972938506270700,
"line_mean": 28.4230769231,
"line_max": 143,
"alpha_frac": 0.6309368192,
"autogenerated": false,
"ratio": 3.7135922330097086,
"config_test... |
__author__ = 'mataevs'
def eval_performance(result_file):
with open(result_file, "r") as inputFile:
lines = inputFile.readlines()
tp, fp, tn, fn = 0, 0, 0, 0
for line in lines:
words = line.split()
tpw = words[1]
fpw = words[2]
fnw = words[3]
tpv = int(tpw[... | {
"repo_name": "mataevs/persondetector",
"path": "detection/evaluator.py",
"copies": "1",
"size": "1521",
"license": "mit",
"hash": 7546618270127390000,
"line_mean": 32.0869565217,
"line_max": 67,
"alpha_frac": 0.5673898751,
"autogenerated": false,
"ratio": 2.8752362948960304,
"config_test": fal... |
__author__ = 'mataevs'
from classifier import Classifier
import utils
import pickle
import random
import cv2
import numpy
def train(classifier_out_name, noInitialFeatures, noWantedFeatures, noEstimators):
posImages = utils.getFullImages(
"/home/mataevs/ptz/INRIAPerson/train/pos",
"/home/mataevs/pt... | {
"repo_name": "mataevs/persondetector",
"path": "detection/tester_icf.py",
"copies": "1",
"size": "3159",
"license": "mit",
"hash": 7254861178105832000,
"line_mean": 27.9908256881,
"line_max": 128,
"alpha_frac": 0.61886673,
"autogenerated": false,
"ratio": 3.270186335403727,
"config_test": true... |
__author__ = 'mataevs'
from icf import ImageProcessor
from sklearn.ensemble import AdaBoostClassifier
from sklearn.tree import DecisionTreeClassifier
import cPickle
import pickle
import random
import gc
import datetime
import utils
import numpy
import math
class Classifier:
def __init__(self, classifierFile=None,... | {
"repo_name": "mataevs/persondetector",
"path": "detection/classifier.py",
"copies": "1",
"size": "18147",
"license": "mit",
"hash": -4555509466387059700,
"line_mean": 36.5734989648,
"line_max": 135,
"alpha_frac": 0.6057199537,
"autogenerated": false,
"ratio": 4.071572806820732,
"config_test": ... |
__author__ = 'mataevs'
from os import listdir
from os.path import isfile, join, realpath
import random
import cv2
import csv
import datetime
import time
import os
def get_prev_img(img_path):
p, ext = os.path.splitext(img_path)
dir, f = os.path.split(p)
prev_img = "%04d" % (int(f) - 1,) + ext
prev_img... | {
"repo_name": "mataevs/persondetector",
"path": "detection/utils.py",
"copies": "1",
"size": "2423",
"license": "mit",
"hash": -7305585171179918000,
"line_mean": 25.9222222222,
"line_max": 101,
"alpha_frac": 0.564589352,
"autogenerated": false,
"ratio": 2.9621026894865525,
"config_test": false,... |
__author__ = 'mataevs'
import cv2
import numpy as np
import imp
utils = imp.load_source('utils', '/home/mataevs/code/persondetector/detection/utils.py')
def count_move_percentage(image):
movement = 0
for row in image:
for pixel in row:
if pixel != 0:
movement += 1
re... | {
"repo_name": "mataevs/persondetector",
"path": "ptz_control/optical_flow.py",
"copies": "1",
"size": "5008",
"license": "mit",
"hash": -6920708414120445000,
"line_mean": 32.3933333333,
"line_max": 104,
"alpha_frac": 0.5846645367,
"autogenerated": false,
"ratio": 3.01323706377858,
"config_test"... |
__author__ = 'mataevs'
import cv2
import numpy as np
import utils
def optical_flow(img_path, prev_img_path):
img = cv2.imread(img_path)
img_bw = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
prev_img = cv2.imread(prev_img_path)
prev_img_bw = cv2.cvtColor(prev_img, cv2.COLOR_BGR2GRAY)
height, width, _ =... | {
"repo_name": "mataevs/persondetector",
"path": "detection/optical_flow.py",
"copies": "1",
"size": "1709",
"license": "mit",
"hash": 775173784823206800,
"line_mean": 29.5178571429,
"line_max": 100,
"alpha_frac": 0.6348741954,
"autogenerated": false,
"ratio": 2.682888540031397,
"config_test": f... |
__author__ = 'mataevs'
import cv2
import numpy
import math
class ImageProcessor:
def __init__(self, path, scale=1.0):
self.path = path
self.bgr = cv2.imread(self.path)
self.luv = None
self.l = None
self.u = None
self.v = None
self.g = None
self.magn... | {
"repo_name": "mataevs/persondetector",
"path": "detection/icf.py",
"copies": "1",
"size": "4804",
"license": "mit",
"hash": 4556662693063986000,
"line_mean": 35.1203007519,
"line_max": 134,
"alpha_frac": 0.5335137386,
"autogenerated": false,
"ratio": 3.352407536636427,
"config_test": false,
... |
__author__ = 'mataevs'
import cv2
import utils
import random
drawing = False
finishedRectangle = False
sx, sy = -1, -1
ex, ey = -1, -1
def draw_rectangle(event, x, y, flags, param):
global sx, sy, ex, ey, drawing, finishedRectangle
if event == cv2.EVENT_LBUTTONDOWN:
drawing = True
sx, sy = x... | {
"repo_name": "mataevs/persondetector",
"path": "detection/test_corpus_maker.py",
"copies": "1",
"size": "2992",
"license": "mit",
"hash": 8083645574254563000,
"line_mean": 32.2555555556,
"line_max": 104,
"alpha_frac": 0.5965909091,
"autogenerated": false,
"ratio": 2.9076773566569485,
"config_t... |
__author__ = 'mataevs'
import os
import utils
import cv2
import time
import classifier
from classifier import *
import detection_checker
from collections import Counter
def get_images(c, img_path, scales, subwindow=None):
totalWindows = []
for scale in scales:
windows = c.getWindowsAndDescriptors(img_... | {
"repo_name": "mataevs/persondetector",
"path": "detection/cascade_tester.py",
"copies": "1",
"size": "5287",
"license": "mit",
"hash": -6321511810318798000,
"line_mean": 31.8385093168,
"line_max": 131,
"alpha_frac": 0.5922073009,
"autogenerated": false,
"ratio": 3.1715656868626274,
"config_tes... |
__author__ = 'mataevs'
import utils
class Checker:
entries = {}
def __init__(self, metadataFilePath):
with open(metadataFilePath, "r") as metaFile:
lines = metaFile.readlines()
for line in lines:
[filePath, sx, sy, ex, ey] = line.split()
sx, sy, ex, ey = ... | {
"repo_name": "mataevs/persondetector",
"path": "detection/detection_checker.py",
"copies": "1",
"size": "2918",
"license": "mit",
"hash": -5947603753536023000,
"line_mean": 32.9418604651,
"line_max": 117,
"alpha_frac": 0.4770390679,
"autogenerated": false,
"ratio": 3.606922126081582,
"config_t... |
__author__ = 'mataevs'
import utils
import random
import numpy
import cv2
from classifier import *
filepaths = [
"/home/mataevs/captures/simple/set1",
"/home/mataevs/captures/simple/set2",
"/home/mataevs/captures/simple/set3",
"/home/mataevs/captures/simple/set4",
"/home/mataevs/captures/simple/n... | {
"repo_name": "mataevs/persondetector",
"path": "detection/hog_corpus_form.py",
"copies": "1",
"size": "1537",
"license": "mit",
"hash": -3995865323322044400,
"line_mean": 26.9636363636,
"line_max": 94,
"alpha_frac": 0.6232921275,
"autogenerated": false,
"ratio": 2.8047445255474455,
"config_tes... |
__author__ = 'mataevs'
'''
Script that displays frames from a PTZ camera (Samsung SNP-3120V)
'''
import ptz_acq
import ptz_control
import Tkinter as tk
import ImageTk
from StreamViewer import StreamViewer
import random
def keystroke(event):
print event.keysym, event.keycode
pan, tilt, zoom = ptz_control.get... | {
"repo_name": "mataevs/persondetector",
"path": "ptz_control/test_movement.py",
"copies": "1",
"size": "1449",
"license": "mit",
"hash": 7984178149540437000,
"line_mean": 23.5762711864,
"line_max": 65,
"alpha_frac": 0.6218081435,
"autogenerated": false,
"ratio": 2.830078125,
"config_test": fals... |
import os
import random
import sys
import xml.etree.ElementTree as ET
class TTProgram:
def __init__(self, twilight_points, contours_in_glyph, points_in_glyph):
# Specifies the number of points in the Twilight Zone (Z0).
self._twilight_points = twilight_points
# Specifies the number of contou... | {
"repo_name": "googleprojectzero/BrokenType",
"path": "truetype-generator/truetype_generate.py",
"copies": "1",
"size": "24532",
"license": "apache-2.0",
"hash": -3587219444911220000,
"line_mean": 31.0619946092,
"line_max": 135,
"alpha_frac": 0.534526333,
"autogenerated": false,
"ratio": 3.417665... |
import math
import os
import struct
import sys
from fontTools.t1Lib import T1Font
# Configuration constants.
GLYPHS_PER_SEGMENT = 50
def main(argv):
if len(argv) != 3:
print "Usage: %s <.pfb font file> <output .pdf path>" % argv[0]
sys.exit(1)
# Load the number of glyphs in the font.
f... | {
"repo_name": "googleprojectzero/BrokenType",
"path": "font2pdf/type1_to_pdf.py",
"copies": "1",
"size": "3850",
"license": "apache-2.0",
"hash": 7461010985791635000,
"line_mean": 28.3149606299,
"line_max": 165,
"alpha_frac": 0.5602597403,
"autogenerated": false,
"ratio": 2.75,
"config_test": f... |
import math
import os
import struct
import sys
from fontTools.ttLib import TTFont
# Configuration constants.
GLYPHS_PER_SEGMENT = 50
SEGMENTS_PER_PAGE = 75
GLYPHS_PER_PAGE = SEGMENTS_PER_PAGE * GLYPHS_PER_SEGMENT
PAGE_OBJECT_IDX_START = 100
PAGE_CONTENTS_IDX_START = 200
def main(argv):
if len(argv) ... | {
"repo_name": "googleprojectzero/BrokenType",
"path": "font2pdf/ttfotf_to_pdf.py",
"copies": "1",
"size": "4638",
"license": "apache-2.0",
"hash": -4776577893118957000,
"line_mean": 30.8936170213,
"line_max": 211,
"alpha_frac": 0.5661923243,
"autogenerated": false,
"ratio": 2.807506053268765,
"... |
__author__ = 'matheus2740'
import pickle
class ICPProtocolException(Exception):
pass
class BaseIPCProtocol(object):
"""
Class which handles how the data is passed through the socket.
This base class implements a very simple mechanism of pickling objects and
prefixing the message with `HEADER_SI... | {
"repo_name": "s1mbi0se/s1ipc",
"path": "s1ipc/protocol.py",
"copies": "1",
"size": "2752",
"license": "apache-2.0",
"hash": 4634138892837519000,
"line_mean": 35.2105263158,
"line_max": 111,
"alpha_frac": 0.6609738372,
"autogenerated": false,
"ratio": 4.609715242881072,
"config_test": false,
... |
__author__ = 'matheuskonzeniser'
import math
loose_change = [
{"denomination":"nickel","year":"2014"},
{"denomination":"dime","year":"2014"},
{"denomination":"nickel","year":"2014"},
{"denomination":"quarter","year":"2014"},
{"denomination":"nickel","year":"2014"},
{"denomination":"nickel","ye... | {
"repo_name": "matheuskiser/pdx_code_guild",
"path": "python/stacks_coins.py",
"copies": "1",
"size": "1802",
"license": "mit",
"hash": -976601889940274700,
"line_mean": 32.3703703704,
"line_max": 73,
"alpha_frac": 0.5976692564,
"autogenerated": false,
"ratio": 3.6184738955823295,
"config_test"... |
__author__ = 'Matheus Konzen Iser'
# Print 'Hello World'
print "Hello World"
# 2. Create a list called fruit that has Apples, Oranges and Bananas as values.
fruits = ['Apples', 'Oranges', 'Bananas']
# 3. Print the list.
for i in fruits:
print i
# 4. Change Oranges to Grapes using the numeric list index.
fruits[... | {
"repo_name": "matheuskiser/pdx_code_guild",
"path": "python/quizzes/matheus_iser_quiz.py",
"copies": "1",
"size": "2790",
"license": "mit",
"hash": 4545543242290182700,
"line_mean": 28.3684210526,
"line_max": 241,
"alpha_frac": 0.6670250896,
"autogenerated": false,
"ratio": 3.217993079584775,
... |
__author__ = 'matheuskonzeniser'
test_data = [
["2014-06-01", "APPL", 100.11],
["2014-06-01", "APPL", 110.61],
["2014-06-01", "APPL", 120.22],
["2014-06-01", "APPL", 100.54],
["2014-06-01", "MSFT", 20.46],
["2014-06-01", "MSFT", 21.25],
["2014-06-01", "MSFT", 32.53],
["2014-06-01", "MSF... | {
"repo_name": "matheuskiser/pdx_code_guild",
"path": "python/stocks.py",
"copies": "1",
"size": "1177",
"license": "mit",
"hash": -1763319275249229000,
"line_mean": 20.4181818182,
"line_max": 41,
"alpha_frac": 0.5097706032,
"autogenerated": false,
"ratio": 2.6933638443935926,
"config_test": fal... |
import os
import sys
def print_folders(root, spacer=".", outputFile=""):
if os.path.exists(root) == False:
print("Error path does not exist")
exit()
levelString = ""
for root, directory, files in os.walk(root):
splitList = root.split("\\")
for i in range(len(splitList) - 1):
print(spacer, end="")
pr... | {
"repo_name": "mdwelborn/folderPrint",
"path": "folderPrint.py",
"copies": "1",
"size": "1192",
"license": "mit",
"hash": -825496827635383200,
"line_mean": 21.9230769231,
"line_max": 80,
"alpha_frac": 0.6367449664,
"autogenerated": false,
"ratio": 2.6968325791855206,
"config_test": false,
"ha... |
__author__ = 'mathfac'
import sys
import re
sys.stdin = open(sys.argv[1])
sys.stdout = open(sys.argv[2], 'w')
tex = "".join(line for line in sys.stdin)
for bibitem in tex.split("\\bibitem")[1:]:
blocks = re.split( r"\n* *\\newblock *\n*", bibitem)
key = re.match( r'\{(.*?)\}', bibitem).group(1)
autho... | {
"repo_name": "mathfac/tex2bib",
"path": "tex2bib.py",
"copies": "1",
"size": "2646",
"license": "mit",
"hash": 4908298002866168000,
"line_mean": 27.7608695652,
"line_max": 74,
"alpha_frac": 0.4198790627,
"autogenerated": false,
"ratio": 3.2992518703241895,
"config_test": false,
"has_no_keywo... |
import os
from sklearn.externals.joblib import load
from modl.utils.recsys.cross_validation import train_test_split
from modl.datasets import get_data_dirs
def load_movielens(version):
data_home = get_data_dirs()[0]
if version == "100k":
path = os.path.join(data_home, "movielens100k", "movielens100... | {
"repo_name": "arthurmensch/modl",
"path": "modl/datasets/recsys.py",
"copies": "1",
"size": "1520",
"license": "bsd-2-clause",
"hash": 7449949715251189000,
"line_mean": 28.2307692308,
"line_max": 79,
"alpha_frac": 0.6065789474,
"autogenerated": false,
"ratio": 3.076923076923077,
"config_test":... |
import numpy as np
from .base import BaseEstimator, ClassifierMixin, RegressorMixin
from .externals.six.moves import xrange
from .utils import check_random_state
from .utils.validation import safe_asarray
class DummyClassifier(BaseEstimator, ClassifierMixin):
"""
DummyClassifier is a classifier that makes p... | {
"repo_name": "johnowhitaker/bobibabber",
"path": "sklearn/dummy.py",
"copies": "1",
"size": "11519",
"license": "mit",
"hash": -4397817430554102300,
"line_mean": 32.780058651,
"line_max": 79,
"alpha_frac": 0.5487455508,
"autogenerated": false,
"ratio": 4.11834107972828,
"config_test": false,
... |
from __future__ import division
import numpy as np
from .base import BaseEstimator, ClassifierMixin, RegressorMixin
from .externals.six.moves import xrange
from .utils import check_random_state
from .utils.validation import check_array
from sklearn.utils import deprecated
class DummyClassifier(BaseEstimator, Classi... | {
"repo_name": "RPGOne/Skynet",
"path": "scikit-learn-c604ac39ad0e5b066d964df3e8f31ba7ebda1e0e/sklearn/dummy.py",
"copies": "2",
"size": "14133",
"license": "bsd-3-clause",
"hash": 4552810438502926000,
"line_mean": 33.6397058824,
"line_max": 78,
"alpha_frac": 0.5552253591,
"autogenerated": false,
... |
from __future__ import division
import warnings
import numpy as np
import scipy.sparse as sp
from .base import BaseEstimator, ClassifierMixin, RegressorMixin
from .externals.six.moves import xrange
from .utils import check_random_state
from .utils.validation import check_array
from sklearn.utils import deprecated
fro... | {
"repo_name": "Garrett-R/scikit-learn",
"path": "sklearn/dummy.py",
"copies": "2",
"size": "15514",
"license": "bsd-3-clause",
"hash": 3709256904337890300,
"line_mean": 34.4200913242,
"line_max": 79,
"alpha_frac": 0.5535645224,
"autogenerated": false,
"ratio": 4.275006888950124,
"config_test": ... |
from __future__ import division
import warnings
import numpy as np
import scipy.sparse as sp
from .base import BaseEstimator, ClassifierMixin, RegressorMixin
from .utils import check_random_state
from .utils.validation import check_array
from .utils.validation import check_consistent_length
from .utils import depreca... | {
"repo_name": "larsmans/scikit-learn",
"path": "sklearn/dummy.py",
"copies": "1",
"size": "16373",
"license": "bsd-3-clause",
"hash": 6790533695334872000,
"line_mean": 34.7489082969,
"line_max": 79,
"alpha_frac": 0.5563427594,
"autogenerated": false,
"ratio": 4.272703549060543,
"config_test": f... |
from __future__ import division
import warnings
import numpy as np
import scipy.sparse as sp
from .base import BaseEstimator, ClassifierMixin, RegressorMixin
from .utils import check_random_state
from .utils.multiclass import class_distribution
from .utils.random import random_choice_csc
from .utils.stats import _we... | {
"repo_name": "DailyActie/Surrogate-Model",
"path": "01-codes/scikit-learn-master/sklearn/dummy.py",
"copies": "1",
"size": "17499",
"license": "mit",
"hash": 3922729547590051300,
"line_mean": 35.45625,
"line_max": 79,
"alpha_frac": 0.5527744443,
"autogenerated": false,
"ratio": 4.311160384331116... |
import numpy as np
from .base import BaseEstimator, ClassifierMixin, RegressorMixin
from .externals.six.moves import xrange
from .utils import check_random_state
from .utils.validation import safe_asarray
from sklearn.utils import deprecated
class DummyClassifier(BaseEstimator, ClassifierMixin):
"""
DummyCl... | {
"repo_name": "flightgong/scikit-learn",
"path": "sklearn/dummy.py",
"copies": "2",
"size": "13664",
"license": "bsd-3-clause",
"hash": 8106623948528060000,
"line_mean": 33.0748129676,
"line_max": 78,
"alpha_frac": 0.5556206089,
"autogenerated": false,
"ratio": 4.183710961420698,
"config_test":... |
import warnings
import numpy as np
import scipy.sparse as sp
from .base import BaseEstimator, ClassifierMixin, RegressorMixin
from .base import MultiOutputMixin
from .utils import check_random_state
from .utils.validation import _num_samples
from .utils.validation import check_array
from .utils.validation import chec... | {
"repo_name": "anntzer/scikit-learn",
"path": "sklearn/dummy.py",
"copies": "3",
"size": "21781",
"license": "bsd-3-clause",
"hash": -672114811645318400,
"line_mean": 35.1210613599,
"line_max": 79,
"alpha_frac": 0.5557136954,
"autogenerated": false,
"ratio": 4.250780640124902,
"config_test": tr... |
import time
import matplotlib.pyplot as plt
from sklearn.utils import check_random_state
from sklearn.metrics.pairwise import pairwise_distances
from sklearn.metrics.pairwise import pairwise_kernels
def plot(func):
random_state = check_random_state(0)
one_core = []
multi_core = []
sample_sizes = rang... | {
"repo_name": "sanketloke/scikit-learn",
"path": "benchmarks/bench_plot_parallel_pairwise.py",
"copies": "4",
"size": "1268",
"license": "bsd-3-clause",
"hash": -2760345838164352000,
"line_mean": 27.8181818182,
"line_max": 76,
"alpha_frac": 0.665615142,
"autogenerated": false,
"ratio": 3.21827411... |
import time
import pylab as pl
from sklearn.metrics.pairwise import pairwise_distances
from sklearn.metrics.pairwise import pairwise_kernels
from sklearn.utils import check_random_state
def plot(func):
random_state = check_random_state(0)
one_core = []
multi_core = []
sample_sizes = range(1000, 6000,... | {
"repo_name": "DailyActie/Surrogate-Model",
"path": "01-codes/scikit-learn-master/benchmarks/bench_plot_parallel_pairwise.py",
"copies": "1",
"size": "1250",
"license": "mit",
"hash": 4808410380317625000,
"line_mean": 25.5957446809,
"line_max": 75,
"alpha_frac": 0.6592,
"autogenerated": false,
"r... |
import time
import pylab as pl
from sklearn.utils import check_random_state
from sklearn.metrics.pairwise import pairwise_distances
from sklearn.metrics.pairwise import pairwise_kernels
def plot(func):
random_state = check_random_state(0)
one_core = []
multi_core = []
sample_sizes = range(1000, 6000,... | {
"repo_name": "abhisg/scikit-learn",
"path": "benchmarks/bench_plot_parallel_pairwise.py",
"copies": "297",
"size": "1247",
"license": "bsd-3-clause",
"hash": -2034258876820850400,
"line_mean": 27.3409090909,
"line_max": 75,
"alpha_frac": 0.6607858861,
"autogenerated": false,
"ratio": 3.181122448... |
import numpy as np
import scipy.sparse as sp
class ShuffleSplit(object):
def __init__(self, n_iter=5, train_size=0.75, random_state=None):
self.n_iter = n_iter
self.train_size = train_size
self.random_state = random_state
def split(self, X):
X = sp.coo_matrix(X)
rng =... | {
"repo_name": "arthurmensch/modl",
"path": "modl/utils/recsys/cross_validation.py",
"copies": "1",
"size": "1482",
"license": "bsd-2-clause",
"hash": -2891527507891693600,
"line_mean": 29.2653061224,
"line_max": 72,
"alpha_frac": 0.5317139001,
"autogenerated": false,
"ratio": 3.315436241610738,
... |
from .stochastic_gradient import BaseSGDClassifier
from ..feature_selection.from_model import _LearntSelectorMixin
class Perceptron(BaseSGDClassifier, _LearntSelectorMixin):
"""Perceptron
Parameters
----------
penalty : None, 'l2' or 'l1' or 'elasticnet'
The penalty (aka regularization term... | {
"repo_name": "costypetrisor/scikit-learn",
"path": "sklearn/linear_model/perceptron.py",
"copies": "1",
"size": "3808",
"license": "bsd-3-clause",
"hash": 1526311909693552600,
"line_mean": 35.9708737864,
"line_max": 78,
"alpha_frac": 0.5730042017,
"autogenerated": false,
"ratio": 4.5990338164251... |
from ._stochastic_gradient import BaseSGDClassifier
class Perceptron(BaseSGDClassifier):
"""Perceptron
Read more in the :ref:`User Guide <perceptron>`.
Parameters
----------
penalty : {'l2','l1','elasticnet'}, default=None
The penalty (aka regularization term) to be used.
alpha : ... | {
"repo_name": "kevin-intel/scikit-learn",
"path": "sklearn/linear_model/_perceptron.py",
"copies": "2",
"size": "6225",
"license": "bsd-3-clause",
"hash": -947304310578847900,
"line_mean": 34.7701149425,
"line_max": 79,
"alpha_frac": 0.6394601542,
"autogenerated": false,
"ratio": 4.04944697462589... |
from .stochastic_gradient import BaseSGDClassifier
class Perceptron(BaseSGDClassifier):
"""Perceptron
Read more in the :ref:`User Guide <perceptron>`.
Parameters
----------
penalty : None, 'l2' or 'l1' or 'elasticnet'
The penalty (aka regularization term) to be used. Defaults to None.
... | {
"repo_name": "chrsrds/scikit-learn",
"path": "sklearn/linear_model/perceptron.py",
"copies": "2",
"size": "5673",
"license": "bsd-3-clause",
"hash": -6820679065638422000,
"line_mean": 36.3223684211,
"line_max": 79,
"alpha_frac": 0.6500969505,
"autogenerated": false,
"ratio": 4.110869565217391,
... |
from ..utils.validation import _deprecate_positional_args
from ._stochastic_gradient import BaseSGDClassifier
class Perceptron(BaseSGDClassifier):
"""Perceptron
Read more in the :ref:`User Guide <perceptron>`.
Parameters
----------
penalty : {'l2','l1','elasticnet'}, default=None
The p... | {
"repo_name": "huzq/scikit-learn",
"path": "sklearn/linear_model/_perceptron.py",
"copies": "3",
"size": "5917",
"license": "bsd-3-clause",
"hash": -5622177324950303000,
"line_mean": 35.0731707317,
"line_max": 79,
"alpha_frac": 0.6467207573,
"autogenerated": false,
"ratio": 4.108333333333333,
"... |
from .stochastic_gradient import BaseSGDClassifier
from ..feature_selection.selector_mixin import SelectorMixin
class Perceptron(BaseSGDClassifier, SelectorMixin):
"""Perceptron
Parameters
----------
penalty : None, 'l2' or 'l1' or 'elasticnet'
The penalty (aka regularization term) to be us... | {
"repo_name": "mrshu/scikit-learn",
"path": "sklearn/linear_model/perceptron.py",
"copies": "2",
"size": "3719",
"license": "bsd-3-clause",
"hash": 1560963051508651300,
"line_mean": 35.1067961165,
"line_max": 79,
"alpha_frac": 0.5716590481,
"autogenerated": false,
"ratio": 4.6313823163138235,
"... |
import numpy as np
from scipy.optimize import minimize
from sdtw import SoftDTW
from sdtw.distance import SquaredEuclidean
def sdtw_barycenter(X, barycenter_init, gamma=1.0, weights=None,
method="L-BFGS-B", tol=1e-3, max_iter=50):
"""
Compute barycenter (time series averaging) under the... | {
"repo_name": "mblondel/soft-dtw",
"path": "sdtw/barycenter.py",
"copies": "1",
"size": "1883",
"license": "bsd-2-clause",
"hash": 7215335555155143000,
"line_mean": 25.1527777778,
"line_max": 78,
"alpha_frac": 0.5963887414,
"autogenerated": false,
"ratio": 3.5461393596986817,
"config_test": fal... |
import numpy as np
from .soft_dtw_fast import _soft_dtw
from .soft_dtw_fast import _soft_dtw_grad
class SoftDTW(object):
def __init__(self, D, gamma=1.0):
"""
Parameters
----------
D: array, shape = [m, n] or distance object
Distance matrix between elements of two ti... | {
"repo_name": "mblondel/soft-dtw",
"path": "sdtw/soft_dtw.py",
"copies": "1",
"size": "2162",
"license": "bsd-2-clause",
"hash": 4844765174518237000,
"line_mean": 25.0481927711,
"line_max": 69,
"alpha_frac": 0.526827012,
"autogenerated": false,
"ratio": 3.702054794520548,
"config_test": false,
... |
import numpy as np
from .soft_dtw_fast import _soft_dtw
from .soft_dtw_fast import _soft_dtw_grad
class SoftDTW(object):
def __init__(self, D, gamma=1.0, sakoe_chiba_band=-1):
"""
Parameters
----------
D: array, shape = [m, n] or distance object
Distance matrix betwe... | {
"repo_name": "alphacsc/alphacsc",
"path": "alphacsc/other/sdtw/soft_dtw.py",
"copies": "1",
"size": "2639",
"license": "bsd-3-clause",
"hash": 3129737412558076400,
"line_mean": 27.376344086,
"line_max": 79,
"alpha_frac": 0.5346722243,
"autogenerated": false,
"ratio": 3.495364238410596,
"config... |
import numpy as np
def delannoy_num(m, n):
"""
Number of paths from the southwest corner (0, 0) of a rectangular grid to
the northeast corner (m, n), using only single steps north, northeast, or
east.
Named after French army officer and amateur mathematician Henri Delannoy.
Parameters
-... | {
"repo_name": "alphacsc/alphacsc",
"path": "alphacsc/other/sdtw/path.py",
"copies": "1",
"size": "1809",
"license": "bsd-3-clause",
"hash": -4873613336878974000,
"line_mean": 23.12,
"line_max": 79,
"alpha_frac": 0.5146489773,
"autogenerated": false,
"ratio": 3.0557432432432434,
"config_test": f... |
__author__ = 'mathijs'
import logging
from random import random
from hashlib import md5
class HbLogHandler(logging.StreamHandler):
"""
To use with logging: handles in the sense that it
keeps the messages in a variable. This allows for
computation of the hash, and for storage with the
rest of the ob... | {
"repo_name": "mwschouten/procapp",
"path": "tasks/experts/tools/hblogger.py",
"copies": "1",
"size": "2972",
"license": "mit",
"hash": -4622705932780532000,
"line_mean": 25.7747747748,
"line_max": 81,
"alpha_frac": 0.5272543742,
"autogenerated": false,
"ratio": 3.6600985221674875,
"config_test... |
__author__ = "Mathusuthan N Kannan"
__email__ = "mathkann@gmail.com"
__copyright__ = "Copyright 2014, Mathusuthan N Kannan"
__license__ = "The MIT License (MIT)"
import itertools
def get_support_values(items, baskets):
"""
Find and return support value of the items
Support of an item I is given by the n... | {
"repo_name": "mathusuthan/mining-massive-datasets",
"path": "frequent_itemsets/frequent_itemsets.py",
"copies": "1",
"size": "3079",
"license": "mit",
"hash": -6846977698178181000,
"line_mean": 41.1917808219,
"line_max": 100,
"alpha_frac": 0.702500812,
"autogenerated": false,
"ratio": 3.85356695... |
__author__ = "Mathusuthan N Kannan"
__email__ = "mathkann@gmail.com"
__copyright__ = "Copyright 2015, Mathusuthan N Kannan"
__license__ = "The MIT License (MIT)"
# Example 1
matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
flat = [x for row in matrix for x in row]
print(flat)
# Example 2
squared = [[x**2 for x in row] for... | {
"repo_name": "mathkann/wannabe-pythoneer",
"path": "effective_python/item08_avoid_more_than_two_loops_comprehensions.py",
"copies": "2",
"size": "1759",
"license": "mit",
"hash": 2707213337559034000,
"line_mean": 29.8596491228,
"line_max": 108,
"alpha_frac": 0.6634451393,
"autogenerated": false,
... |
__author__ = "Mathusuthan N Kannan"
__email__ = "mathkann@gmail.com"
__copyright__ = "Copyright 2015, Mathusuthan N Kannan"
__license__ = "The MIT License (MIT)"
import logging
# Python has special syntax for the stride of a slice in the form somelist[start:end:stride]. This lets you take
# every nth item when slicin... | {
"repo_name": "mathkann/pythoneer",
"path": "effective_python/item06_avoid_start_end_stride_slice.py",
"copies": "2",
"size": "1880",
"license": "mit",
"hash": -1875926265384088800,
"line_mean": 35.862745098,
"line_max": 112,
"alpha_frac": 0.6574468085,
"autogenerated": false,
"ratio": 3.15436241... |
__author__ = "Mathusuthan N Kannan"
__email__ = "mathkann@gmail.com"
__copyright__ = "Copyright 2015, Mathusuthan N Kannan"
__license__ = "The MIT License (MIT)"
# Know the difference between bytes, str, and unicode
# In Python 3, there are two types that represent sequences of characters: bytes and str.
# Instances o... | {
"repo_name": "mathkann/wannabe-pythoneer",
"path": "effective_python/item03_str_unicode_bytes.py",
"copies": "2",
"size": "1915",
"license": "mit",
"hash": -8857302962515313000,
"line_mean": 34.462962963,
"line_max": 108,
"alpha_frac": 0.7018276762,
"autogenerated": false,
"ratio": 3.52022058823... |
__author__ = "Mathusuthan N Kannan"
__email__ = "mathkann@gmail.com"
__copyright__ = "Copyright 2015, Mathusuthan N Kannan"
__license__ = "The MIT License (MIT)"
names = ['Anupama' 'Anuradha', 'Anuprema']
letters = [len(n) for n in names]
# the items in derived list letters are related to the items in the source list... | {
"repo_name": "mathkann/wannabe-pythoneer",
"path": "effective_python/item11_use_zip_for_parallel_iterators.py",
"copies": "2",
"size": "1340",
"license": "mit",
"hash": 1859129694562896600,
"line_mean": 39.6060606061,
"line_max": 117,
"alpha_frac": 0.728358209,
"autogenerated": false,
"ratio": 3... |
__author__ = "Mathusuthan N Kannan"
__email__ = "mathkann@gmail.com"
__copyright__ = "Copyright 2015, Mathusuthan N Kannan"
__license__ = "The MIT License (MIT)"
# Python includes syntax for slicing sequences into pieces. Slicing lets you access a subset of a sequence's
# items with minimal effort. The simplest uses ... | {
"repo_name": "mathkann/pythoneer",
"path": "effective_python/item05_slicing_sequences.py",
"copies": "2",
"size": "1875",
"license": "mit",
"hash": -3629144532419435000,
"line_mean": 42.6046511628,
"line_max": 109,
"alpha_frac": 0.6981333333,
"autogenerated": false,
"ratio": 3.434065934065934,
... |
__author__ = "Mathusuthan N Kannan"
__email__ = "mathkann@gmail.com"
__copyright__ = "Copyright 2015, Mathusuthan N Kannan"
__license__ = "The MIT License (MIT)"
# Python provides compact syntax for deriving one list from another. These expressions are called list
# comprehensions. For example, say you want to comput... | {
"repo_name": "mathkann/pythoneer",
"path": "effective_python/item07_list_comprehensions.py",
"copies": "2",
"size": "1974",
"license": "mit",
"hash": -8466336905939726000,
"line_mean": 40.125,
"line_max": 107,
"alpha_frac": 0.7380952381,
"autogenerated": false,
"ratio": 3.512455516014235,
"con... |
__author__ = "Mathusuthan N Kannan"
__email__ = "mathkann@gmail.com"
__copyright__ = "Copyright 2015, Mathusuthan N Kannan"
__license__ = "The MIT License (MIT)"
# Python's syntax makes it all too easy to write single-line expressions that are overly complicated and
# difficult to read.Move complex expressions into he... | {
"repo_name": "mathkann/pythoneer",
"path": "effective_python/item04_helper_functions.py",
"copies": "2",
"size": "2189",
"license": "mit",
"hash": -6321514041157533000,
"line_mean": 27.4285714286,
"line_max": 112,
"alpha_frac": 0.6272270443,
"autogenerated": false,
"ratio": 2.946164199192463,
... |
__author__ = "Mathusuthan N Kannan"
__email__ = "mathkann@gmail.com"
__copyright__ = "Copyright 2015, Mathusuthan N Kannan"
__license__ = "The MIT License (MIT)"
# The problem with list comprehensions is that they may create a whole new list containing one item for each value in
# the input sequence. This is fine for ... | {
"repo_name": "mathkann/wannabe-pythoneer",
"path": "effective_python/item09_generator_expressions.py",
"copies": "2",
"size": "2225",
"license": "mit",
"hash": 6078949207425414000,
"line_mean": 46.3404255319,
"line_max": 119,
"alpha_frac": 0.7537078652,
"autogenerated": false,
"ratio": 3.9241622... |
__author__ = 'matiasbevilacqua'
import logging
from mpEngineProdCons import MPEngineProdCons
from mpEngineWorker import MPEngineWorker
import Queue
import os
import re
import sqlite3
import ntpath
from contextlib import closing
import time
import struct
from appAux import update_progress, chunks, loadFile, psutil_phym... | {
"repo_name": "mbevilacqua/appcompatprocessor",
"path": "appLoad.py",
"copies": "1",
"size": "36253",
"license": "apache-2.0",
"hash": -554555160400069250,
"line_mean": 49.9901547117,
"line_max": 193,
"alpha_frac": 0.5510992194,
"autogenerated": false,
"ratio": 4.223814517068624,
"config_test":... |
__author__ = 'matiasbevilacqua'
import logging
import os
import itertools
import sys
import settings
import zipfile
import re
try:
import psutil
except ImportError:
if settings.__PSUTIL__:
settings.__PSUTIL__ = False
print("Python psutil module required for memory governor (we can live without ... | {
"repo_name": "mbevilacqua/appcompatprocessor",
"path": "appAux.py",
"copies": "1",
"size": "7859",
"license": "apache-2.0",
"hash": -3656251998751020000,
"line_mean": 31.4752066116,
"line_max": 187,
"alpha_frac": 0.5902786614,
"autogenerated": false,
"ratio": 3.7228801515869256,
"config_test":... |
__author__ = 'matiasbevilacqua'
import settings
import logging
import sqlite3
import os
from appAux import outputcolum, update_progress, update_spinner
from contextlib import closing
import re
import sys, traceback
logger = logging.getLogger(__name__)
def re_fn(expr, item):
reg = re.compile(expr, re.IGNORECASE)... | {
"repo_name": "mbevilacqua/appcompatprocessor",
"path": "appDB.py",
"copies": "1",
"size": "21835",
"license": "apache-2.0",
"hash": -4683409902951175000,
"line_mean": 40.3541666667,
"line_max": 173,
"alpha_frac": 0.5526906343,
"autogenerated": false,
"ratio": 4.39778449144008,
"config_test": f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.