text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = "Thomas Rueckstiess, ruecksti@in.tum.de"
from scipy import array
from pybrain.rl.explorers.discrete.discrete import DiscreteExplorer
from pybrain.utilities import drawGibbs
class BoltzmannExplorer(DiscreteExplorer):
""" A discrete explorer, that executes the actions with probability
that de... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/rl/explorers/discrete/boltzmann.py",
"copies": "1",
"size": "1550",
"license": "mit",
"hash": -1489422222320181200,
"line_mean": 35.0465116279,
"line_max": 73,
"alpha_frac": 0.6341935484,
"autogenerated": false,
"... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from scipy import ones, zeros, mean, dot, ravel
from scipy.linalg import pinv
from scipy import random
from pybrain.rl.learners.finitedifference.fd import FDLearner
from pybrain.auxiliary import GradientDescent
class FDBasic(FDLearner):
def __init__(self):
... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/learners/finitedifference/basic.py",
"copies": "1",
"size": "2072",
"license": "bsd-3-clause",
"hash": 1653065172485221400,
"line_mean": 34.724137931,
"line_max": 84,
"alpha_frac": 0.6042471042,
"autogenerated": false,
"ratio": 4.078740157... |
__author__ = "Thomas Rueckstiess, ruecksti@in.tum.de"
from scipy import random, array
from pybrain.rl.explorers.discrete.discrete import DiscreteExplorer
class EpsilonGreedyExplorer(DiscreteExplorer):
""" A discrete explorer, that executes the original policy in most cases,
but sometimes returns a random... | {
"repo_name": "zygmuntz/pybrain",
"path": "pybrain/rl/explorers/discrete/egreedy.py",
"copies": "31",
"size": "1191",
"license": "bsd-3-clause",
"hash": -671067480389962600,
"line_mean": 34.0294117647,
"line_max": 77,
"alpha_frac": 0.6465155332,
"autogenerated": false,
"ratio": 4.023648648648648,... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from scipy import random, asarray, zeros, dot
from neuronlayer import NeuronLayer
from pybrain.tools.functions import expln, explnPrime
from pybrain.structure.parametercontainer import ParameterContainer
class StateDependentLayer(NeuronLayer, ParameterContainer)... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/structure/modules/statedependentlayer.py",
"copies": "1",
"size": "3272",
"license": "bsd-3-clause",
"hash": -4983353970998631000,
"line_mean": 39.3950617284,
"line_max": 101,
"alpha_frac": 0.5586797066,
"autogenerated": false,
"ratio": 3.966... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from scipy import random, asarray, zeros, dot
from pybrain.structure.modules.neuronlayer import NeuronLayer
from pybrain.tools.functions import expln, explnPrime
from pybrain.structure.parametercontainer import ParameterContainer
class StateDependentLayer(Neuron... | {
"repo_name": "newemailjdm/pybrain",
"path": "pybrain/structure/modules/statedependentlayer.py",
"copies": "25",
"size": "3256",
"license": "bsd-3-clause",
"hash": 7763130914610014000,
"line_mean": 38.7073170732,
"line_max": 103,
"alpha_frac": 0.5678746929,
"autogenerated": false,
"ratio": 3.9087... |
__author__ = "Thomas Rueckstiess, ruecksti@in.tum.de"
from scipy import random, dot
from pybrain.structure.modules.module import Module
from pybrain.rl.explorers.explorer import Explorer
from pybrain.tools.functions import expln, explnPrime
from pybrain.structure.parametercontainer import ParameterContainer
class S... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/rl/explorers/continuous/sde.py",
"copies": "1",
"size": "3376",
"license": "mit",
"hash": -5432842484998295000,
"line_mean": 38.7176470588,
"line_max": 99,
"alpha_frac": 0.6078199052,
"autogenerated": false,
"rati... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from scipy import random
from neuronlayer import NeuronLayer
from pybrain.tools.functions import expln, explnPrime
from pybrain.structure.parametercontainer import ParameterContainer
class GaussianLayer(NeuronLayer, ParameterContainer):
""" A layer implementi... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/structure/modules/gaussianlayer.py",
"copies": "4",
"size": "1585",
"license": "mit",
"hash": -7839620336613138000,
"line_mean": 36.7619047619,
"line_max": 104,
"alpha_frac": 0.6309148265,
"autogenerated": false,
... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from scipy import random
from pybrain.structure.modules.neuronlayer import NeuronLayer
from pybrain.tools.functions import expln, explnPrime
from pybrain.structure.parametercontainer import ParameterContainer
class GaussianLayer(NeuronLayer, ParameterContainer):
... | {
"repo_name": "pybrain2/pybrain2",
"path": "pybrain/structure/modules/gaussianlayer.py",
"copies": "26",
"size": "1579",
"license": "bsd-3-clause",
"hash": -2345891811662438000,
"line_mean": 37.512195122,
"line_max": 104,
"alpha_frac": 0.6478784041,
"autogenerated": false,
"ratio": 3.750593824228... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from scipy import random
from scipy.ndimage import minimum_position
from scipy import mgrid, zeros, tile, array, floor, sum
from module import Module
class KohonenMap(Module):
""" Implements a Self-Organizing Map (SOM), also known as a Kohonen Map.
... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/structure/modules/kohonen.py",
"copies": "3",
"size": "3137",
"license": "mit",
"hash": 7934865844854510000,
"line_mean": 39.7402597403,
"line_max": 146,
"alpha_frac": 0.6063117628,
"autogenerated": false,
"ratio"... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from scipy import random
from scipy.ndimage import minimum_position
from scipy import mgrid, zeros, tile, array, floor, sum
from pybrain.structure.modules.module import Module
class KohonenMap(Module):
""" Implements a Self-Organizing Map (SOM), also known a... | {
"repo_name": "chanderbgoel/pybrain",
"path": "pybrain/structure/modules/kohonen.py",
"copies": "26",
"size": "3079",
"license": "bsd-3-clause",
"hash": 5596975973289394000,
"line_mean": 38.987012987,
"line_max": 145,
"alpha_frac": 0.625202988,
"autogenerated": false,
"ratio": 3.475169300225734,
... |
__author__ = "Thomas Rueckstiess, ruecksti@in.tum.de"
from scipy import random
from pybrain.rl.explorers.explorer import Explorer
from pybrain.tools.functions import expln, explnPrime
from pybrain.structure.parametercontainer import ParameterContainer
class NormalExplorer(Explorer, ParameterContainer):
""" A co... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/rl/explorers/continuous/normal.py",
"copies": "1",
"size": "1830",
"license": "mit",
"hash": -8980697844509919000,
"line_mean": 34.1923076923,
"line_max": 105,
"alpha_frac": 0.6366120219,
"autogenerated": false,
"... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from scipy import random, zeros
from pybrain.rl.environments.graphical import GraphicalEnvironment
class SimpleEnvironment(GraphicalEnvironment):
def __init__(self, dim=1):
GraphicalEnvironment.__init__(self)
self.dim = dim
self.indim ... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/environments/simple/environment.py",
"copies": "1",
"size": "1347",
"license": "bsd-3-clause",
"hash": -5363763480857344000,
"line_mean": 27.0833333333,
"line_max": 73,
"alpha_frac": 0.576095026,
"autogenerated": false,
"ratio": 3.71074380... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from scipy import ravel, diag, where, random
from pybrain.auxiliary import GaussianProcess
from statedependent import StateDependentAgent
from learning import LearningAgent
class StateDependentGPAgent(StateDependentAgent):
""" StateDependentAgent is a learnin... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/agents/statedependentgp.py",
"copies": "1",
"size": "2341",
"license": "bsd-3-clause",
"hash": -3832814514318316000,
"line_mean": 42.3703703704,
"line_max": 103,
"alpha_frac": 0.5894916702,
"autogenerated": false,
"ratio": 4.08551483420593... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from scipy import reshape, dot, outer, eye
from pybrain.structure.connections import FullConnection
class FullNotSelfConnection(FullConnection):
"""Connection which connects every element from the first module's
output buffer to the second module's input... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/structure/connections/fullnotself.py",
"copies": "1",
"size": "1206",
"license": "mit",
"hash": 122945487326230620,
"line_mean": 42.0714285714,
"line_max": 84,
"alpha_frac": 0.6567164179,
"autogenerated": false,
"... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from sequential import SequentialDataSet
from dataset import DataSet
from scipy import zeros
class ReinforcementDataSet(SequentialDataSet):
def __init__(self, statedim, actiondim):
""" initialize the reinforcement dataset, add the 3 fields state, acti... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/datasets/reinforcement.py",
"copies": "1",
"size": "2317",
"license": "mit",
"hash": 8434749098457097000,
"line_mean": 40.375,
"line_max": 92,
"alpha_frac": 0.6292619767,
"autogenerated": false,
"ratio": 4.2591911... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
import ode, sys, xode
import warnings
from scipy.linalg import norm
from pybrain.utilities import Named
class SizeError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return 'size not correct: ', repr(self.val... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/environments/ode/sensors.py",
"copies": "1",
"size": "11303",
"license": "bsd-3-clause",
"hash": 2630078625624932000,
"line_mean": 34.6561514196,
"line_max": 103,
"alpha_frac": 0.5871007697,
"autogenerated": false,
"ratio": 4.1236774899671... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
import ode, sys, xode #@UnresolvedImport
import warnings
from scipy.linalg import norm
from pybrain.utilities import Named
class SizeError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return 'size not correc... | {
"repo_name": "taylorhxu/pybrain",
"path": "pybrain/rl/environments/ode/sensors.py",
"copies": "31",
"size": "11283",
"license": "bsd-3-clause",
"hash": -1838897920862010400,
"line_mean": 34.5930599369,
"line_max": 103,
"alpha_frac": 0.5895595143,
"autogenerated": false,
"ratio": 4.11188046647230... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
import ode, xode
from pybrain.utilities import Named
import sys, warnings
class Actuator(Named):
"""The base Actuator class. Every actuator has a name, and a list of values (even if it is
only one value) with numValues entries. They can be added to the... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/environments/ode/actuators.py",
"copies": "1",
"size": "7269",
"license": "bsd-3-clause",
"hash": -5457132392120002000,
"line_mean": 35.527638191,
"line_max": 100,
"alpha_frac": 0.5395515202,
"autogenerated": false,
"ratio": 4.047327394209... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
import ode, xode #@UnresolvedImport
from pybrain.utilities import Named
import sys, warnings
class Actuator(Named):
"""The base Actuator class. Every actuator has a name, and a list of values (even if it is
only one value) with numValues entries. They ... | {
"repo_name": "sepehr125/pybrain",
"path": "pybrain/rl/environments/ode/actuators.py",
"copies": "31",
"size": "7230",
"license": "bsd-3-clause",
"hash": 6929864046668696000,
"line_mean": 35.15,
"line_max": 100,
"alpha_frac": 0.5446749654,
"autogenerated": false,
"ratio": 4.018899388549194,
"co... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
import string
class ConfigGrabber:
def __init__(self, filename, sectionId="", delim=("[", "]")):
# filename: name of the config file to be parsed
# sectionId: start looking for parameters only after this string has
# been en... | {
"repo_name": "fxsjy/pybrain",
"path": "pybrain/rl/environments/ode/tools/configgrab.py",
"copies": "5",
"size": "1296",
"license": "bsd-3-clause",
"hash": -3536611427875001300,
"line_mean": 35,
"line_max": 84,
"alpha_frac": 0.5293209877,
"autogenerated": false,
"ratio": 3.939209726443769,
"con... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
import string
class ConfigGrabber:
def __init__(self, filename, sectionId="", delim=("[","]") ):
# filename: name of the config file to be parsed
# sectionId: start looking for parameters only after this string has
# been en... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/environments/ode/tools/configgrab.py",
"copies": "1",
"size": "1280",
"license": "bsd-3-clause",
"hash": 6703692020709821000,
"line_mean": 35.5714285714,
"line_max": 77,
"alpha_frac": 0.5359375,
"autogenerated": false,
"ratio": 3.938461538... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
import sys
class XMLstruct:
"""
Defines an XML tag structure. Tags are added at the current level
using the insert() method, with up() providing a way to get to the
parent tag.
$Id:xmltools.py 150 2007-04-11 13:42:47Z ruecksti $
"""
_... | {
"repo_name": "hassaanm/stock-trading",
"path": "pybrain-pybrain-87c7ac3/pybrain/rl/environments/ode/tools/xmltools.py",
"copies": "5",
"size": "6891",
"license": "apache-2.0",
"hash": 6250051635215618000,
"line_mean": 35.8502673797,
"line_max": 119,
"alpha_frac": 0.5518792628,
"autogenerated": fal... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
import sys, time
from scipy import random, asarray
import xode.parser, xode.body, xode.geom #@UnresolvedImport @UnusedImport @Reimport
import ode #@UnresolvedImport
from pybrain.rl.environments.environment import Environment
from tools.configgrab import ConfigGrab... | {
"repo_name": "hassaanm/stock-trading",
"path": "pybrain-pybrain-87c7ac3/pybrain/rl/environments/ode/environment.py",
"copies": "5",
"size": "21359",
"license": "apache-2.0",
"hash": -5843692920774767000,
"line_mean": 35.825862069,
"line_max": 106,
"alpha_frac": 0.5687532188,
"autogenerated": false... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from learning import LearningAgent
from policygradient import PolicyGradientAgent
from pybrain.structure import StateDependentLayer, IdentityConnection
from pybrain.tools.shortcuts import buildNetwork
class StateDependentAgent(PolicyGradientAgent):
""" State... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/agents/statedependent.py",
"copies": "1",
"size": "2410",
"license": "bsd-3-clause",
"hash": -992924362166733400,
"line_mean": 41.298245614,
"line_max": 103,
"alpha_frac": 0.6929460581,
"autogenerated": false,
"ratio": 4.446494464944649,
... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from policygradient import PolicyGradientLearner
from scipy import ones, dot
from scipy.linalg import pinv
class ENAC(PolicyGradientLearner):
""" Episodic Natural Actor-Critic. See J. Peters "Natural Actor-Critic", 2005.
Estimates natural gradient wi... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/learners/policygradients/enac.py",
"copies": "1",
"size": "1120",
"license": "bsd-3-clause",
"hash": 212502779048383140,
"line_mean": 31.0285714286,
"line_max": 85,
"alpha_frac": 0.6017857143,
"autogenerated": false,
"ratio": 3.58974358974... |
__author__ = "Thomas Rueckstiess, ruecksti@in.tum.de"
from pybrain.rl.explorers.discrete.discrete import DiscreteExplorer
from pybrain.rl.learners.valuebased.interface import ActionValueTable, ActionValueNetwork
from copy import deepcopy
from numpy import random, array
class DiscreteStateDependentExplorer(DiscreteE... | {
"repo_name": "hassaanm/stock-trading",
"path": "src/pybrain/rl/explorers/discrete/discretesde.py",
"copies": "5",
"size": "2083",
"license": "apache-2.0",
"hash": 2819007060823226000,
"line_mean": 34.3050847458,
"line_max": 89,
"alpha_frac": 0.6697071531,
"autogenerated": false,
"ratio": 4.14940... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pybrain.rl.learners.directsearch.policygradient import PolicyGradientLearner
from scipy import ones, dot, ravel
from scipy.linalg import pinv
class ENAC(PolicyGradientLearner):
""" Episodic Natural Actor-Critic. See J. Peters "Natural Actor-Critic", 200... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/rl/learners/directsearch/enac.py",
"copies": "1",
"size": "1481",
"license": "mit",
"hash": -1353412745351206700,
"line_mean": 36.9743589744,
"line_max": 95,
"alpha_frac": 0.59756921,
"autogenerated": false,
"rati... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pybrain.structure.modules.module import Module
from pybrain.structure.parametercontainer import ParameterContainer
class Table(Module, ParameterContainer):
""" implements a simple 2D table with dimensions rows x columns,
which is basically a wrap... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/structure/modules/table.py",
"copies": "1",
"size": "1368",
"license": "mit",
"hash": -4148037760165818000,
"line_mean": 37.0277777778,
"line_max": 90,
"alpha_frac": 0.6469298246,
"autogenerated": false,
"ratio": ... |
__author__ = "Thomas Rueckstiess, ruecksti@in.tum.de"
from pybrain.structure.modules.module import Module
class Explorer(Module):
""" An Explorer object is used in Agents, receives the current state
and action (from the controller Module) and returns an explorative
action that is executed instea... | {
"repo_name": "Neural-Network/TicTacToe",
"path": "pybrain/rl/explorers/explorer.py",
"copies": "28",
"size": "1600",
"license": "bsd-3-clause",
"hash": 5153647475912544000,
"line_mean": 34.5555555556,
"line_max": 76,
"alpha_frac": 0.600625,
"autogenerated": false,
"ratio": 4.848484848484849,
"... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de, Tom Schaul'
from scipy import ones, zeros, dot, ravel, random
from scipy.linalg import pinv
from pybrain.auxiliary import GradientDescent
from pybrain.optimization.optimizer import ContinuousOptimizer
class FiniteDifferences(ContinuousOptimizer):
""" Basic f... | {
"repo_name": "Ryanglambert/pybrain",
"path": "pybrain/optimization/finitedifference/fd.py",
"copies": "31",
"size": "1941",
"license": "bsd-3-clause",
"hash": 250027730028556800,
"line_mean": 31.35,
"line_max": 84,
"alpha_frac": 0.6455435343,
"autogenerated": false,
"ratio": 3.9612244897959186,
... |
__author__ = 'thomasvangurp'
description = """Compare CG, CHG and CHH methylation between epiGBS data and WBGS data"""
import pysam
import os
from Bio import Restriction
from Bio import SeqIO
import vcf
import subprocess
import copy
WGBS_dir = '/Users/thomasvangurp/epiGBS/becker_nature_2011/analysis/'
epiGBS_dir = '/U... | {
"repo_name": "thomasvangurp/epiGBS",
"path": "Arabidopsis analysis/Arabidopsis_comparison.py",
"copies": "1",
"size": "16687",
"license": "mit",
"hash": -788092632786503200,
"line_mean": 46.5413105413,
"line_max": 145,
"alpha_frac": 0.5121351951,
"autogenerated": false,
"ratio": 3.79508755969979... |
__author__ = 'thomasvangurp'
"""filter bed file by pct coverage"""
import argparse
from Bio import SeqIO
import numpy
def parse_args():
"""Parse command line arguments"""
parser = argparse.ArgumentParser(description='Process input files')
parser.add_argument('-r', '--reference', type=str, help='reference g... | {
"repo_name": "thomasvangurp/epiGBS",
"path": "mapping_varcall/filtering/analyse_bed_group.py",
"copies": "1",
"size": "5471",
"license": "mit",
"hash": -8671723727547629000,
"line_mean": 37,
"line_max": 95,
"alpha_frac": 0.5677207092,
"autogenerated": false,
"ratio": 3.58519003931848,
"config_... |
__author__ = 'thomasvangurp'
"""filter bed file by pct coverage"""
import sys
import argparse
from Bio import SeqIO
import gzip
def parse_args():
"""Parse command line arguments"""
parser = argparse.ArgumentParser(description='Process input files')
parser.add_argument('-r', '--reference', type=str, help='r... | {
"repo_name": "thomasvangurp/epiGBS",
"path": "mapping_varcall/filter_bed_ref.py",
"copies": "1",
"size": "4426",
"license": "mit",
"hash": 9086633016526605000,
"line_mean": 33.3178294574,
"line_max": 93,
"alpha_frac": 0.5630366019,
"autogenerated": false,
"ratio": 3.709974853310981,
"config_te... |
__author__ = 'thomasvangurp'
"""Filter methylation bed file with coverage criterion on both strands"""
from Bio import SeqIO
import os
import subprocess
from scipy import stats
def split_sample(header,dir,type):
"""Split watson and crick bam file into sample specific reads groups"""
for name in header[4:]:
... | {
"repo_name": "thomasvangurp/epiGBS",
"path": "Arabidopsis analysis/DMP_comparison_Arabidopsis_thaliana.py",
"copies": "1",
"size": "31771",
"license": "mit",
"hash": 5597313308853093000,
"line_mean": 46.3502235469,
"line_max": 142,
"alpha_frac": 0.5471971295,
"autogenerated": false,
"ratio": 3.5... |
__author__ = 'thomasvangurp'
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
import pysam
import gzip
import copy
merged_file = '/Users/thomasvangurp/epiGBS/WUR/epiGBS_2015/join.assembled.trimmed.fastq'
bam_handle = pysam.AlignmentFile('/Users/thomasvangurp/epiGBS/WUR/epiGBS_2015/sort... | {
"repo_name": "thomasvangurp/epiGBS",
"path": "Arabidopsis analysis/Arabidopsis_Csp6i_analysis.py",
"copies": "1",
"size": "9045",
"license": "mit",
"hash": -859968260426858600,
"line_mean": 36.6875,
"line_max": 138,
"alpha_frac": 0.5401879491,
"autogenerated": false,
"ratio": 3.234978540772532,
... |
__author__ = 'thomasvangurp'
"""Get median coverage and methylations percentage per 1MB of arabidopsis genome"""
genome_dict = {}
bed_file = open('/Users/thomasvangurp/epiGBS/Baseclear/unfiltered_sequences/seqNNAtlE/Athal/ref_mapping/methylation.bed')
header = bed_file.readline().split('\t')
for line in bed_file:
... | {
"repo_name": "thomasvangurp/epiGBS",
"path": "Arabidopsis analysis/Arabidopsis_genome_meth.py",
"copies": "1",
"size": "1641",
"license": "mit",
"hash": -4198928927735272000,
"line_mean": 48.7575757576,
"line_max": 138,
"alpha_frac": 0.6008531383,
"autogenerated": false,
"ratio": 3.4840764331210... |
__author__ = 'thomasvangurp'
import os
from Bio import SeqIO
import subprocess
from scipy import stats
from operator import itemgetter
"""Detect DMPs between all samples, calculate their abundance and distribution"""
# Choose 2 most abundant individuals for DMP detection
# How many DMP's are there per context?
#
def g... | {
"repo_name": "thomasvangurp/epiGBS",
"path": "Arabidopsis analysis/all_DMP_detection.py",
"copies": "1",
"size": "25009",
"license": "mit",
"hash": 4048468104270217000,
"line_mean": 42.8771929825,
"line_max": 125,
"alpha_frac": 0.5438442161,
"autogenerated": false,
"ratio": 3.7232395414619623,
... |
__author__ = 'thomasvangurp'
import os
import vcf
import subprocess
from Bio import SeqIO
leak = "/Users/thomasvangurp/epiGBS/Baseclear/unfiltered_sequences/seqNNAtlE/Leak/output_mapping/methylation.bed"
Arabidopsis = "/Users/thomasvangurp/epiGBS/Baseclear/unfiltered_sequences/seqNNAtlE/Athal/output_mapping/methylation... | {
"repo_name": "thomasvangurp/epiGBS",
"path": "all_meth_summary.py",
"copies": "1",
"size": "7363",
"license": "mit",
"hash": -5231454527580714000,
"line_mean": 44.7391304348,
"line_max": 124,
"alpha_frac": 0.5663452397,
"autogenerated": false,
"ratio": 3.3392290249433105,
"config_test": false,... |
__author__ = 'thomasvangurp'
"""merge two bed filed"""
import sys
import gzip
f1,f2,output = sys.argv[1:]
def merge_lines(l1,l2,to_add):
"""merge 2 lines"""
merged_line = l1 + l2[4:]
merged = 0
for item in to_add:
value_to_add = merged_line[item[0] + len(l2[4:]) - merged]
merged_line.p... | {
"repo_name": "thomasvangurp/epiGBS",
"path": "mapping_varcall/merging/merge_bed.py",
"copies": "1",
"size": "2519",
"license": "mit",
"hash": -2989422483250095000,
"line_mean": 39.6451612903,
"line_max": 100,
"alpha_frac": 0.4779674474,
"autogenerated": false,
"ratio": 3.381208053691275,
"conf... |
''' Author: Thomas Vincent
Written in Eclipse with PyDev'''
import socket
import select
FILEPATH="input.txt"
PORT = 43
BUFSIZE = 1024
LINEEND = '\r\n'
WHOIS_SERVER = "whois.integerernic.net"
def whois(domain, server=WHOIS_SERVER, port=PORT):
'''
Perform a WHOIS search for domain on server/port.
'''
... | {
"repo_name": "thomasvincent/utilities",
"path": "WhoisScript/main.py",
"copies": "1",
"size": "1172",
"license": "apache-2.0",
"hash": 7752726444364362000,
"line_mean": 21.1132075472,
"line_max": 63,
"alpha_frac": 0.5887372014,
"autogenerated": false,
"ratio": 3.426900584795322,
"config_test":... |
from wherehows.common import Constant
from com.ziclix.python.sql import zxJDBC
from org.slf4j import LoggerFactory
from jython.SchedulerTransform import SchedulerTransform
from wherehows.common.enums import SchedulerType
import sys
from org.python.core import codecs
codecs.setDefaultEncoding('utf-8')
class LhotseTrans... | {
"repo_name": "thomas-young-2013/wherehowsX",
"path": "metadata-etl/src/main/resources/jython/LhotseTransform.py",
"copies": "1",
"size": "2747",
"license": "apache-2.0",
"hash": -1776603810210342000,
"line_mean": 51.8269230769,
"line_max": 206,
"alpha_frac": 0.6192209683,
"autogenerated": false,
... |
from wherehows.common.schemas import LhotseFlowRecord
from wherehows.common.schemas import LhotseJobRecord
from wherehows.common.schemas import LhotseFlowDagRecord
from wherehows.common.schemas import LhotseFlowOwnerRecord
from wherehows.common.schemas import LhotseFlowExecRecord
from wherehows.common.schemas import Lh... | {
"repo_name": "thomas-young-2013/wherehowsX",
"path": "metadata-etl/src/main/resources/jython/LhotseExtract.py",
"copies": "1",
"size": "10561",
"license": "apache-2.0",
"hash": -4324117113889354000,
"line_mean": 47.0090909091,
"line_max": 140,
"alpha_frac": 0.4761859672,
"autogenerated": false,
... |
__author__ = 'Thomas Yu'
from time import sleep
import pprint
from api.tradeapi import BTCChina
from settings import *
class Bot:
def __init__(self,tradeType):
self.trader = BTCChina(API_ACCESS, API_SECRET,tradeType)
self.portfolio = []
self.profit = 0
def get_lowest_market_ask(self... | {
"repo_name": "wenqingyu/BTCBot",
"path": "ThomasBot.py",
"copies": "1",
"size": "12028",
"license": "mit",
"hash": -2721770380173779000,
"line_mean": 29.4506329114,
"line_max": 116,
"alpha_frac": 0.5222813435,
"autogenerated": false,
"ratio": 3.6338368580060423,
"config_test": false,
"has_no... |
__author__ = 'thor'
# -*- coding: utf-8 -*-
import requests
currency_map = {
'$': "USD",
'₤': "GBP",
'£': "GBP",
'€': "EUR",
'₤': "GBP",
'£': "GBP",
'€': "EUR",
'dollar': "USD",
'dollars': "USD",
'euro': "EUR",
'euros': "EUR",
'pound': "GBP",
'pounds': "GBP"
}
def ... | {
"repo_name": "thorwhalen/ut",
"path": "wserv/finance.py",
"copies": "1",
"size": "1317",
"license": "mit",
"hash": 4192790776849094000,
"line_mean": 25.14,
"line_max": 115,
"alpha_frac": 0.610558531,
"autogenerated": false,
"ratio": 2.8788546255506606,
"config_test": false,
"has_no_keywords"... |
__author__ = 'thor'
"""
Accessing information on population in the word.
In order to work, you need to have a mongo collection (by default named geo_pop_density)
in a db (by default called util), with the appropriate datas there.
The way I processed the data:
Downloaded and unzipped data from:
http://sedac.cies... | {
"repo_name": "thorwhalen/ut",
"path": "iacc/geo/geopop.py",
"copies": "1",
"size": "9293",
"license": "mit",
"hash": 716594588125148400,
"line_mean": 42.4252336449,
"line_max": 120,
"alpha_frac": 0.5991606586,
"autogenerated": false,
"ratio": 3.6075310559006213,
"config_test": false,
"has_no... |
__author__ = 'thor'
"""
Based on code from Julien Palard.
"""
from argparse import ArgumentParser, FileType
import json
import requests
from time import sleep
class ElasticSearch():
def __init__(self, url):
self.url = url
def request(self, method, path, data=None):
return (requests.request(... | {
"repo_name": "thorwhalen/ut",
"path": "dacc/es/change_mapping.py",
"copies": "1",
"size": "4315",
"license": "mit",
"hash": -5578864525356796000,
"line_mean": 34.9666666667,
"line_max": 79,
"alpha_frac": 0.5460023175,
"autogenerated": false,
"ratio": 3.9806273062730626,
"config_test": false,
... |
__author__ = 'thor'
# -*- coding: utf-8 -*-
from . import math
import operator
import random
import gzip
import sys
import marshal
from functools import reduce
def cos_sim(p, q):
sum0 = sum([x*x for x in p])
sum1 = sum([x*x for x in q])
sum2 = sum([x[0]*x[1] for x in zip(p, q)])
return sum2/(sum0**0.... | {
"repo_name": "thorwhalen/ut",
"path": "semantics/oplsa.py",
"copies": "1",
"size": "6529",
"license": "mit",
"hash": -9160457743011734000,
"line_mean": 31.0049019608,
"line_max": 103,
"alpha_frac": 0.4509113187,
"autogenerated": false,
"ratio": 3.279256654947263,
"config_test": true,
"has_no... |
__author__ = 'thor'
from bs4 import BeautifulSoup
from functools import wraps
@wraps(BeautifulSoup.find_all, assigned=('__module__', '__qualname__', '__annotations__', '__name__'))
def gen_find(tag, *args, **kwargs):
"""Does what BeautifulSoup.find_all does, but as an iterator.
See find_all documentation... | {
"repo_name": "thorwhalen/ut",
"path": "slurp/util.py",
"copies": "1",
"size": "2391",
"license": "mit",
"hash": 3648611264597123000,
"line_mean": 33.1571428571,
"line_max": 106,
"alpha_frac": 0.3918862401,
"autogenerated": false,
"ratio": 3.5793413173652695,
"config_test": false,
"has_no_key... |
__author__ = 'thor'
from collections import Counter, defaultdict
from itertools import permutations
import pandas as pd
from pandas import Series, DataFrame
from numpy import array
from scipy.stats import chi2_contingency
from ut.ppi.pot import Pot
from ut.pdict.special import DictDefaultDict
class EdgeCounter(obje... | {
"repo_name": "thorwhalen/ut",
"path": "ppi/pairs_pot.py",
"copies": "1",
"size": "8262",
"license": "mit",
"hash": -2221726721812131800,
"line_mean": 40.9390862944,
"line_max": 118,
"alpha_frac": 0.5631808279,
"autogenerated": false,
"ratio": 3.5719844357976656,
"config_test": false,
"has_no... |
__author__ = 'thor'
from elasticsearch import Elasticsearch
import pandas as pd
class ElasticCom(object):
def __init__(self, index, doc_type, hosts='localhost:9200', **kwargs):
self.index = index
self.doc_type = doc_type
self.es = Elasticsearch(hosts=hosts, **kwargs)
def search_and_... | {
"repo_name": "thorwhalen/ut",
"path": "dacc/es/scrap.py",
"copies": "1",
"size": "2257",
"license": "mit",
"hash": 8170244628830959000,
"line_mean": 33.7230769231,
"line_max": 91,
"alpha_frac": 0.5719982277,
"autogenerated": false,
"ratio": 3.588235294117647,
"config_test": false,
"has_no_ke... |
__author__ = 'thor'
from numpy import *
import numpy as np
import librosa
from sklearn.base import BaseEstimator, TransformerMixin
from ut.sound.util import resample_wf
from ut.sound.util import Sound
import matplotlib.pyplot as plt
from sklearn.decomposition import IncrementalPCA
from sklearn.preprocessing import M... | {
"repo_name": "thorwhalen/ut",
"path": "sound/eigen_sound.py",
"copies": "1",
"size": "8222",
"license": "mit",
"hash": 8442371043000117000,
"line_mean": 38.7246376812,
"line_max": 120,
"alpha_frac": 0.6092191681,
"autogenerated": false,
"ratio": 3.464812473662031,
"config_test": false,
"has_... |
__author__ = 'thor'
from numpy import *
import numpy as np
import time
import sklearn as sk
import scipy.interpolate as interpolate
from ut.stats.classification.bin.base import BinaryClassifierBase2D
from ut.stats.util import binomial_probs_to_multinomial_probs
class BinaryClassificationByInterpolatedProbabilities(... | {
"repo_name": "thorwhalen/ut",
"path": "stats/classification/bin/iterpol.py",
"copies": "1",
"size": "2902",
"license": "mit",
"hash": 1682348126306069500,
"line_mean": 40.4571428571,
"line_max": 117,
"alpha_frac": 0.6791867677,
"autogenerated": false,
"ratio": 3.701530612244898,
"config_test":... |
__author__ = 'thor'
from numpy import *
import pandas as pd
def set_containment_matrix(family_of_sets, family_of_sets_2=None):
"""
Computes the containment incidence matrix of two families of sets A and B, where A and B are specified by
incidence matrices where rows index sets and columns index elements ... | {
"repo_name": "thorwhalen/ut",
"path": "pmath/poset.py",
"copies": "1",
"size": "4061",
"license": "mit",
"hash": 6048360033575465000,
"line_mean": 39.2079207921,
"line_max": 118,
"alpha_frac": 0.5954198473,
"autogenerated": false,
"ratio": 3.5938053097345133,
"config_test": false,
"has_no_ke... |
__author__ = 'thor'
from numpy import *
def crescendoness(wf, sr, averaging_window_seconds=0.5):
"""
Computes a score describing how much the sound's intensity is monotone increasing (if crescendoness is positive)
or decreasing (if crescendoness is negative).
The moving sum of the differential of th... | {
"repo_name": "thorwhalen/ut",
"path": "sound/features.py",
"copies": "1",
"size": "1029",
"license": "mit",
"hash": -569285963947226000,
"line_mean": 37.1111111111,
"line_max": 116,
"alpha_frac": 0.6977648202,
"autogenerated": false,
"ratio": 3.396039603960396,
"config_test": false,
"has_no_... |
__author__ = 'thor'
from ut.util.decorators import autoargs
class A(object):
@autoargs()
def __init__(self, foo, path, debug=False):
pass
a = A('rhubarb', 'pie', debug=True)
assert(a.foo == 'rhubarb')
assert(a.path == 'pie')
assert(a.debug == True)
class B(object):
@autoargs()
def __init__(se... | {
"repo_name": "thorwhalen/ut",
"path": "semantics/scrap.py",
"copies": "1",
"size": "1399",
"license": "mit",
"hash": 9198041415878794000,
"line_mean": 22.7118644068,
"line_max": 60,
"alpha_frac": 0.5932809149,
"autogenerated": false,
"ratio": 2.798,
"config_test": false,
"has_no_keywords": f... |
__author__ = 'thor'
import datetime
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import finance
from matplotlib.collections import LineCollection
import pandas as pd
from sklearn import cluster, covariance, manifold
def affinity_propagation_network(X, names=None):
"""
Cluster (affinit... | {
"repo_name": "thorwhalen/ut",
"path": "viz/net/affinity.py",
"copies": "1",
"size": "5775",
"license": "mit",
"hash": -7905649867210932000,
"line_mean": 37.5,
"line_max": 130,
"alpha_frac": 0.5903030303,
"autogenerated": false,
"ratio": 4.002079002079002,
"config_test": false,
"has_no_keywor... |
__author__ = 'thor'
import datetime
def find_latest_docs(collection, num_of_docs, output='cursor'):
pass
def find_new_docs(collection=None, date_key=None, thresh_date=None, output='cursor'):
assert date_key
assert thresh_date
if isinstance(thresh_date, int): # if thresh_date is an int, consider it... | {
"repo_name": "thorwhalen/ut",
"path": "dacc/mong/queries.py",
"copies": "1",
"size": "1072",
"license": "mit",
"hash": 4885685358570570000,
"line_mean": 30.5294117647,
"line_max": 121,
"alpha_frac": 0.6651119403,
"autogenerated": false,
"ratio": 3.6216216216216215,
"config_test": false,
"has... |
__author__ = 'thor'
import matplotlib.pyplot as plt
import numpy as np
import scipy
def xy_density(xdat, ydat, cmap='jet', marker='.', imshow_kwargs={},
bins=[100, 100], density_thresh=0, xyrange=None, plot_kwargs={}):
'''
graphs the density of (x,y) points in the plane, using color (defined b... | {
"repo_name": "thorwhalen/ut",
"path": "pplot/distrib.py",
"copies": "1",
"size": "2030",
"license": "mit",
"hash": -6378649354942166000,
"line_mean": 40.4489795918,
"line_max": 117,
"alpha_frac": 0.6192118227,
"autogenerated": false,
"ratio": 3.0945121951219514,
"config_test": false,
"has_no... |
__author__ = 'thor'
import numpy as np
from numpy import *
from sklearn.cluster import SpectralClustering as sk_SpectralClustering
from sklearn.cluster import MiniBatchKMeans as MiniBatchKMeans_sk
from sklearn.neighbors import NearestNeighbors
from numpy import vstack
from sklearn.cluster import KMeans
from ut.ml.ut... | {
"repo_name": "thorwhalen/ut",
"path": "ml/skwrap/cluster.py",
"copies": "1",
"size": "6433",
"license": "mit",
"hash": 513783003711400900,
"line_mean": 44.3028169014,
"line_max": 120,
"alpha_frac": 0.5720503653,
"autogenerated": false,
"ratio": 3.6468253968253967,
"config_test": false,
"has_... |
__author__ = 'thor'
import numpy as np
from numpy import *
def multiple_similarity_alignment(simil_matrix, y):
"""
Let $x, y, z$ be items such that $y,z\in C$ but $x\notin C$.
A similarity $s$ function is good on this pair if $y$ is is more similar to $z$ then $x$ is, i.e. $s(x,z) \leq s(y,z)$.
If w... | {
"repo_name": "thorwhalen/ut",
"path": "ml/knn/distance_classification.py",
"copies": "1",
"size": "4547",
"license": "mit",
"hash": -7956615853275691000,
"line_mean": 44.0198019802,
"line_max": 123,
"alpha_frac": 0.6826478997,
"autogenerated": false,
"ratio": 3.3831845238095237,
"config_test":... |
__author__ = 'thor'
import numpy as np
import io
import pandas as pd
import itertools
from collections import Counter
from nltk.corpus import wordnet as wn
def print_word_definitions(word):
print(word_definitions_string(word))
def word_definitions_string(word):
return '\n'.join(['%d: %s (%s)'
... | {
"repo_name": "thorwhalen/ut",
"path": "semantics/wordnet_explorer.py",
"copies": "1",
"size": "6582",
"license": "mit",
"hash": -2849586239202288000,
"line_mean": 35.364640884,
"line_max": 105,
"alpha_frac": 0.5586447888,
"autogenerated": false,
"ratio": 3.408596582081823,
"config_test": false... |
__author__ = 'thor'
import numpy as np
import pandas as pd
import matplotlib.pyplot as mpl_plt
from sklearn.decomposition import PCA
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler, LabelEncoder
from sklearn.manifold import TSNE
import prettyplotlib as ppl
# Get "Set2" colors fr... | {
"repo_name": "thorwhalen/ut",
"path": "pplot/scatter.py",
"copies": "1",
"size": "6769",
"license": "mit",
"hash": 2985572298494529000,
"line_mean": 39.5329341317,
"line_max": 119,
"alpha_frac": 0.5473482051,
"autogenerated": false,
"ratio": 3.4518103008669048,
"config_test": false,
"has_no_... |
__author__ = 'thor'
import numpy as np
import ut.pplot.hist
import pandas as pd
import matplotlib.pylab as plt
from ut.util.utime import utc_ms_to_utc_datetime
def count_hist(sr, sort_by='value', reverse=True, horizontal=None, ratio=False, **kwargs):
horizontal = horizontal or isinstance(sr.iloc[0], str)
ut.... | {
"repo_name": "thorwhalen/ut",
"path": "daf/plot.py",
"copies": "1",
"size": "1671",
"license": "mit",
"hash": 1404617604875715000,
"line_mean": 35.3260869565,
"line_max": 118,
"alpha_frac": 0.6511071215,
"autogenerated": false,
"ratio": 3.3353293413173652,
"config_test": false,
"has_no_keywo... |
__author__ = 'thor'
import os
from ftplib import FTP
from ut.util.log import printProgress
def get_ftp_files_I_dont_have(ftp_kwargs,
remote_dir=".",
local_dir=".",
remote_filename_filter=None):
"""
Getting files from a... | {
"repo_name": "thorwhalen/ut",
"path": "dacc/ftp/get.py",
"copies": "1",
"size": "1880",
"license": "mit",
"hash": 3292358953326863400,
"line_mean": 35.1730769231,
"line_max": 104,
"alpha_frac": 0.6095744681,
"autogenerated": false,
"ratio": 3.643410852713178,
"config_test": false,
"has_no_ke... |
__author__ = 'thor'
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from .analyzer import Analyzer
from .params import default
from ut.daf.to import to_html
form_elements = [
dict(name='your_name', type='text', display="Your Name", value='Unknown'),
dict(name='max_num', type... | {
"repo_name": "thorwhalen/ut",
"path": "wserv/dashboard/test_analyzer.py",
"copies": "1",
"size": "2110",
"license": "mit",
"hash": -6651983202179539000,
"line_mean": 35.3793103448,
"line_max": 118,
"alpha_frac": 0.6161137441,
"autogenerated": false,
"ratio": 3.338607594936709,
"config_test": f... |
__author__ = 'thor'
import os
import pandas as pd
from pandas import ExcelWriter
from openpyxl import load_workbook
from openpyxl.reader.excel import InvalidFileException
try:
from xlwings import Workbook, Sheet
except ImportError as e:
print(e)
def multiple_dfs_to_multiple_sheets(df_list, xls_filepath, shee... | {
"repo_name": "thorwhalen/ut",
"path": "dacc/xls/write.py",
"copies": "1",
"size": "3362",
"license": "mit",
"hash": -255287417913807420,
"line_mean": 37.2045454545,
"line_max": 103,
"alpha_frac": 0.6243307555,
"autogenerated": false,
"ratio": 3.5804046858359957,
"config_test": false,
"has_no... |
__author__ = 'thor'
import os
import pandas as pd
from pymongo import MongoClient
from pymongo.cursor import Cursor
from ut.sound import util as sutil
from ut.daf.manip import reorder_columns_as
from ut.sound.util import Sound
from ut.pstr.trans import str_to_utf8_or_bust
class MgDacc(object):
def __init__(sel... | {
"repo_name": "thorwhalen/ut",
"path": "sound/dacc/mg.py",
"copies": "1",
"size": "5587",
"license": "mit",
"hash": 3129402163358043600,
"line_mean": 38.6241134752,
"line_max": 102,
"alpha_frac": 0.5408985144,
"autogenerated": false,
"ratio": 3.5952380952380953,
"config_test": false,
"has_no_... |
__author__ = 'thor'
import pandas as pd
from numpy import array, random
from sklearn.cluster import KMeans
from scipy.cluster.vq import vq
from collections import Counter
def balanced_data(X, y, method='sample'):
"""
Get get subset of X (and aligned y) such that all y elements have the same count.
(i.e. ... | {
"repo_name": "thorwhalen/ut",
"path": "ml/prep/feature_balancing.py",
"copies": "1",
"size": "3060",
"license": "mit",
"hash": -7271249315278921000,
"line_mean": 35,
"line_max": 118,
"alpha_frac": 0.6114379085,
"autogenerated": false,
"ratio": 3.570595099183197,
"config_test": false,
"has_no... |
__author__ = 'thor'
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import re
from ut.pplot.to import simple_plotly
class ParallelTimeSeriesDacc(object):
def __init__(self, data_source, date_var, index_var, ts_vars_name='vars', **kwargs):
if isinstance(data_source, pd.DataFrame):... | {
"repo_name": "thorwhalen/ut",
"path": "dacc/parallel_timeseries_dacc.py",
"copies": "1",
"size": "6444",
"license": "mit",
"hash": 1677486331001283800,
"line_mean": 39.0248447205,
"line_max": 105,
"alpha_frac": 0.5437616387,
"autogenerated": false,
"ratio": 3.530958904109589,
"config_test": fa... |
__author__ = 'thor'
import pandas as pd
import numpy as np
import ut.daf.manip as daf_manip
import ut.daf.ch as daf_ch
# from ut.pstr.trans import toascii as strip_accents
from sklearn.feature_extraction.text import strip_accents_unicode as strip_accents
def to_lower_ascii(d):
if isinstance(d, pd.DataFrame):
... | {
"repo_name": "thorwhalen/ut",
"path": "semantics/sutils.py",
"copies": "1",
"size": "2987",
"license": "mit",
"hash": -3128530649719419400,
"line_mean": 40.4861111111,
"line_max": 115,
"alpha_frac": 0.6026113157,
"autogenerated": false,
"ratio": 3.104989604989605,
"config_test": false,
"has_... |
__author__ = 'thor'
import pandas as pd
import numpy as np
from collections import Counter, defaultdict
from itertools import islice, chain
import matplotlib.pylab as plt
class Markov(object):
def __init__(self, cond_probs, initial_probs, states=None, t_name=None, t_plus_1_name=None):
self.initial_probs... | {
"repo_name": "thorwhalen/ut",
"path": "ppi/markov.py",
"copies": "1",
"size": "5998",
"license": "mit",
"hash": 6886947191353231000,
"line_mean": 37.2101910828,
"line_max": 105,
"alpha_frac": 0.6125375125,
"autogenerated": false,
"ratio": 3.4510932105868815,
"config_test": false,
"has_no_key... |
__author__ = 'thor'
import pandas as pd
import os
import subprocess
from bs4 import BeautifulSoup
import copy
import itertools
import numpy as np
from hashlib import md5
import ut as ms
from ut.daf.manip import recursive_update
from ut.util.ulist import sort_as
from ut.daf.resources.disp_templates import inline_html_... | {
"repo_name": "thorwhalen/ut",
"path": "daf/to.py",
"copies": "1",
"size": "7524",
"license": "mit",
"hash": -7394011469773842000,
"line_mean": 39.2352941176,
"line_max": 119,
"alpha_frac": 0.6448697501,
"autogenerated": false,
"ratio": 3.446633073751718,
"config_test": false,
"has_no_keyword... |
__author__ = 'thor'
import pandas as pd
import ut.util.ulist as util_ulist
import re
import ut.pcoll.order_conserving as colloc
def incremental_merge(left, right, **kwargs):
"""
as pandas.merge, but can handle the case when left dataframe is empty or None
"""
if left is None or left.shape != (0, 0):
... | {
"repo_name": "thorwhalen/ut",
"path": "daf/op.py",
"copies": "1",
"size": "3032",
"license": "mit",
"hash": 8217559683853580000,
"line_mean": 30.2577319588,
"line_max": 116,
"alpha_frac": 0.5996042216,
"autogenerated": false,
"ratio": 3.025948103792415,
"config_test": false,
"has_no_keywords... |
__author__ = 'thor'
import pymongo as mg
from pymongo import MongoClient
from pymongo.errors import CursorNotFound
import os
import re
import pandas as pd
from numpy import inf, random, int64, int32, ndarray, float64, float32
import subprocess
from datetime import datetime
from pymongo.collection import Collection
fr... | {
"repo_name": "thorwhalen/ut",
"path": "dacc/mong/util.py",
"copies": "1",
"size": "30043",
"license": "mit",
"hash": -5486798114552380000,
"line_mean": 37.3690932312,
"line_max": 119,
"alpha_frac": 0.5921845355,
"autogenerated": false,
"ratio": 3.862561069683723,
"config_test": false,
"has_n... |
__author__ = 'thor'
import pystan
import pickle
from hashlib import md5
import re
import os
stan_models_directory_paths = [
'./',
'./data/',
'../data/'
]
# this_files_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'models')
def stan_cache(model_code, model_name=None, **kwargs):
"""U... | {
"repo_name": "thorwhalen/ut",
"path": "ppi/pstan/io.py",
"copies": "1",
"size": "1785",
"license": "mit",
"hash": -2348772454617518600,
"line_mean": 27.7903225806,
"line_max": 86,
"alpha_frac": 0.6028011204,
"autogenerated": false,
"ratio": 3.3055555555555554,
"config_test": false,
"has_no_k... |
__author__ = 'thor'
import re
import pandas as pd
import numpy as np
from ut.semantics.text_processors import preprocess_text_lower_ascii
from ut.semantics.text_processors import html2text
from pattern.web import plaintext
class TermStats(object):
default = dict()
default['name'] = None
default['term_col'... | {
"repo_name": "thorwhalen/ut",
"path": "semantics/termstats.py",
"copies": "1",
"size": "4866",
"license": "mit",
"hash": -528076704454440900,
"line_mean": 29.8037974684,
"line_max": 108,
"alpha_frac": 0.5928894369,
"autogenerated": false,
"ratio": 3.664156626506024,
"config_test": false,
"ha... |
__author__ = 'thor'
import re
import pandas as pd
import numpy as np
import pickle
import os
import ut as ms
# import ut.parse.html2text_formated as html2text_formated
from pattern.web import plaintext
import ut.pstr.trans
from ut.semantics.termstats import TermStats
from ut.slurp.yboss import Yboss
class YbossText... | {
"repo_name": "thorwhalen/ut",
"path": "webscrape/yboss.py",
"copies": "1",
"size": "6455",
"license": "mit",
"hash": -7292260969961310000,
"line_mean": 39.0931677019,
"line_max": 118,
"alpha_frac": 0.5807900852,
"autogenerated": false,
"ratio": 3.4063324538258577,
"config_test": false,
"has_... |
__author__ = 'thor'
import ut as ms
import pandas as pd
import ut.pcoll.order_conserving
from functools import reduce
class SquareMatrix(object):
def __init__(self, df, index_vars=None, sort=False):
if isinstance(df, SquareMatrix):
self = df.copy()
elif isinstance(df, pd.DataFrame):
... | {
"repo_name": "thorwhalen/ut",
"path": "daf/struct.py",
"copies": "1",
"size": "2689",
"license": "mit",
"hash": 795503597998269800,
"line_mean": 36.3611111111,
"line_max": 103,
"alpha_frac": 0.593529193,
"autogenerated": false,
"ratio": 3.275274056029233,
"config_test": false,
"has_no_keywor... |
__author__ = 'thor'
# import ut
import ut.util.ulist
import ut.daf.ch
import ut.daf.get
import pandas as pd
def group_and_count(df, count_col=None, frequency=False):
if isinstance(df, pd.Series):
t = pd.DataFrame()
t[df.name] = df
df = t
del t
count_col = count_col or ut.daf.g... | {
"repo_name": "thorwhalen/ut",
"path": "daf/gr.py",
"copies": "1",
"size": "2333",
"license": "mit",
"hash": -1746402773201175600,
"line_mean": 39.2413793103,
"line_max": 114,
"alpha_frac": 0.6386626661,
"autogenerated": false,
"ratio": 3.0737812911725957,
"config_test": false,
"has_no_keywor... |
__author__ = 'thor'
import ut.util.log as util_log
import ut.util.pobj as util_pobj
import ut.pdict.get as pdict_get
import ut.util.ulist as util_ulist
import pandas as pd
class DataFlow(object):
"""
DataFlow is a framework to pipeline data processes.
"""
def __init__(self, obj):
[setattr(sel... | {
"repo_name": "thorwhalen/ut",
"path": "util/copy_of_data_flow.py",
"copies": "1",
"size": "7085",
"license": "mit",
"hash": -7480054813963200000,
"line_mean": 45.6184210526,
"line_max": 128,
"alpha_frac": 0.5875793931,
"autogenerated": false,
"ratio": 3.616641143440531,
"config_test": false,
... |
__author__ = 'thor'
model_code = """
// Mixture of two binomials
data {
int<lower=1> nExperiments; // number of data points
int<lower=0> nTrials[nExperiments];
int<lower=0> nSuccess[nExperiments];
}
parameters {
simplex[2] theta; // mixing proportions
real<lower=0,upper=1> latentProb[2]; // locati... | {
"repo_name": "thorwhalen/ut",
"path": "ppi/pstan/models_scripts/mixture_of_two_binomials.py",
"copies": "1",
"size": "1436",
"license": "mit",
"hash": 1886456029259156500,
"line_mean": 22.1774193548,
"line_max": 75,
"alpha_frac": 0.5884401114,
"autogenerated": false,
"ratio": 2.8835341365461846,... |
__author__ = 'thor'
'''
Based on https://github.com/pbharrin/machinelearninginaction/blob/master/Ch12/fpGrowth.py
'''
class treeNode:
def __init__(self, nameValue, numOccur, parentNode):
self.name = nameValue
self.count = numOccur
self.nodeLink = None
self.parent = parentNode ... | {
"repo_name": "thorwhalen/ut",
"path": "ml/association/fptree_harrington.py",
"copies": "1",
"size": "5081",
"license": "mit",
"hash": 574683861785801860,
"line_mean": 38.3875968992,
"line_max": 108,
"alpha_frac": 0.6162172801,
"autogenerated": false,
"ratio": 3.4284750337381915,
"config_test":... |
__author__ = 'thor'
def drop_duplicates_pipe(val_cols, gr_cols=None, take_last=False, no_id=True):
# input processing
val_cols, gr_cols = get_val_and_gr_cols(val_cols, gr_cols, no_id)
if take_last:
first_or_last = '$last'
else:
first_or_last = '$first'
# making the util dicts
g... | {
"repo_name": "thorwhalen/ut",
"path": "dacc/mong/agg.py",
"copies": "1",
"size": "3362",
"license": "mit",
"hash": -1946066978549239800,
"line_mean": 33.306122449,
"line_max": 97,
"alpha_frac": 0.5315288519,
"autogenerated": false,
"ratio": 3.448205128205128,
"config_test": false,
"has_no_ke... |
__author__ = 'thor'
def factor_scatter_matrix(df, factor, palette=None, **kwargs):
'''Create a scatter matrix of the variables in df, with differently colored
points depending on the value of df[factor].
inputs:
df: pandas.DataFrame containing the columns to be plotted, as well
as fact... | {
"repo_name": "thorwhalen/ut",
"path": "others/plot.py",
"copies": "1",
"size": "2784",
"license": "mit",
"hash": -4390619094376370000,
"line_mean": 38.7714285714,
"line_max": 105,
"alpha_frac": 0.5714798851,
"autogenerated": false,
"ratio": 3.6392156862745098,
"config_test": false,
"has_no_k... |
__author__ = 'thor'
from collections import OrderedDict
from ut.util.pobj import methods_of
class Analyzer(object):
"""
An Analyzer is a class to manage a simple dashboard that takes inputs from an html form, and takes action on these
inputs.
An Analyzer is defined by a list of dicts, each specifyi... | {
"repo_name": "thorwhalen/ut",
"path": "wserv/dashboard/analyzer.py",
"copies": "1",
"size": "6799",
"license": "mit",
"hash": -6445283101190125000,
"line_mean": 40.7116564417,
"line_max": 125,
"alpha_frac": 0.61038388,
"autogenerated": false,
"ratio": 4.039809863339275,
"config_test": false,
... |
__author__ = 'thor'
from numpy import *
from mpl_toolkits.basemap import Basemap
def map_records(d, basemap_kwargs={}, plot_kwargs={}, lat_col='latitude', lng_col='longitude'):
# Create the Basemap
basemap_kwargs = dict(dict(projection='merc', # there are other choices though
... | {
"repo_name": "thorwhalen/ut",
"path": "pplot/geo.py",
"copies": "1",
"size": "1379",
"license": "mit",
"hash": -2199670241906323200,
"line_mean": 37.3055555556,
"line_max": 100,
"alpha_frac": 0.4989122553,
"autogenerated": false,
"ratio": 3.7472826086956523,
"config_test": false,
"has_no_key... |
__author__ = 'thor'
from numpy import *
import matplotlib.pyplot as plt
from ut.stats.util import df_picker_data_prep
class BinaryClassifierBase2D(object):
"""
Base class for binary classification with 2D explanatory variable space.
It follows the pattern of sklearn classifiers, with a fit, predict_pro... | {
"repo_name": "thorwhalen/ut",
"path": "stats/classification/bin/base.py",
"copies": "1",
"size": "5197",
"license": "mit",
"hash": 4757597252657867000,
"line_mean": 41.9504132231,
"line_max": 119,
"alpha_frac": 0.5820665769,
"autogenerated": false,
"ratio": 3.5138607167004734,
"config_test": f... |
__author__ = 'thor'
from numpy import *
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
def bell(actual, probs, failure_color='red', success_color='blue',
failure_weight=1, success_weight=1,
log_scale=False):
"""
Plots probs separating failures (actual=False) and suc... | {
"repo_name": "thorwhalen/ut",
"path": "stats/classification/bin/plot.py",
"copies": "1",
"size": "2158",
"license": "mit",
"hash": -1276696009629715500,
"line_mean": 36.8771929825,
"line_max": 104,
"alpha_frac": 0.6357738647,
"autogenerated": false,
"ratio": 3.3405572755417956,
"config_test": ... |
__author__ = 'thor'
from pandas import DataFrame
from operator import sub
from numpy import mean
def group_normalization(df, var_col, group=None, agg=mean, dif=sub,
keep_anchor=False, anchor_name='anchor'):
"""
returns a dataframe where the var_col column values have been normalized ... | {
"repo_name": "thorwhalen/ut",
"path": "stats/trans/normalization.py",
"copies": "1",
"size": "2620",
"license": "mit",
"hash": -7312800852775773000,
"line_mean": 35.3888888889,
"line_max": 117,
"alpha_frac": 0.6106870229,
"autogenerated": false,
"ratio": 3.4025974025974026,
"config_test": fals... |
__author__ = 'thor'
from pymongo import MongoClient
from bson import SON
degree_kms = 111.12
class GeoMongoDacc(object):
def __init__(self, db, collection, coordinate_field):
self.collection = MongoClient()[db][collection]
self.coordinate_field = coordinate_field
def find_nearest_one(self... | {
"repo_name": "thorwhalen/ut",
"path": "iacc/geo/gutil.py",
"copies": "1",
"size": "1420",
"license": "mit",
"hash": 281912962294845950,
"line_mean": 32.0465116279,
"line_max": 106,
"alpha_frac": 0.5922535211,
"autogenerated": false,
"ratio": 3.776595744680851,
"config_test": false,
"has_no_k... |
__author__ = 'thor'
import copy
from itertools import combinations
import re
# import pandas as pd
# import numpy as np
# import ut as ut
#
# import ut.daf.get
class EdgeStats(object):
def __init__(self):
self._count = CountVal(0.0)
self.a = KeyVal()
self.ab = KeyVal()
def count_... | {
"repo_name": "thorwhalen/ut",
"path": "ppi/old/naive_binary_network.py",
"copies": "1",
"size": "8610",
"license": "mit",
"hash": -8724211918621388000,
"line_mean": 26.9545454545,
"line_max": 111,
"alpha_frac": 0.4925667828,
"autogenerated": false,
"ratio": 3.4193804606830818,
"config_test": f... |
__author__ = 'thor'
import copy
from itertools import combinations
class EdgeStats(object):
def __init__(self):
self._count = CountVal(0.0)
self.a = KeyVal()
self.ab = KeyVal()
def count_data(self, item_iterator):
self.__init__()
for nodes in item_iterator:
... | {
"repo_name": "thorwhalen/ut",
"path": "ppi/binary_pairs_kv.py",
"copies": "1",
"size": "8713",
"license": "mit",
"hash": -8642830245028751000,
"line_mean": 27.1064516129,
"line_max": 111,
"alpha_frac": 0.490990474,
"autogenerated": false,
"ratio": 3.4262681871804954,
"config_test": false,
"h... |
__author__ = 'thor'
import copy
import re
# import pandas as pd
# import numpy as np
# import ut as ut
#
# import ut.daf.get
class BipartiteStats(object):
"""
The class that manages the count data.
"""
# _count
# a
# b
# ab
# ba
def __init__(self, get_a_list_from_item=None, ge... | {
"repo_name": "thorwhalen/ut",
"path": "ppi/naive_bayes_graph.py",
"copies": "1",
"size": "8556",
"license": "mit",
"hash": 6755447441144105000,
"line_mean": 27.4252491694,
"line_max": 111,
"alpha_frac": 0.51028518,
"autogenerated": false,
"ratio": 3.166543301258327,
"config_test": false,
"ha... |
__author__ = 'thor'
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
def shifted_color_map(cmap, start=0, midpoint=0.5, stop=1.0, name='shiftedcmap'):
'''
Function to offset the "center" of a colormap. Useful for
data with a negative min and positive max and you want the
middle o... | {
"repo_name": "thorwhalen/ut",
"path": "pplot/color.py",
"copies": "1",
"size": "1882",
"license": "mit",
"hash": -4112410914040092000,
"line_mean": 31.4655172414,
"line_max": 81,
"alpha_frac": 0.5988310308,
"autogenerated": false,
"ratio": 3.598470363288719,
"config_test": false,
"has_no_key... |
__author__ = 'thor'
import pandas as pd
class DistanceClf(object):
def __init__(self,
dist_df, # a df (or ndarray) indexed (rows and columns) by record ids and where df.loc[i,j]=dist(i,j)
labels # an array, dict or series mapping record ids to classification labels
... | {
"repo_name": "thorwhalen/ut",
"path": "ml/knn/distance_based_classification.py",
"copies": "1",
"size": "2386",
"license": "mit",
"hash": -3390644076078340600,
"line_mean": 46.72,
"line_max": 131,
"alpha_frac": 0.6135792121,
"autogenerated": false,
"ratio": 3.6483180428134556,
"config_test": f... |
__author__ = 'thor'
import scipy.stats
from sklearn.preprocessing import normalize
import pandas as pd
from numpy import *
from datetime import datetime, timedelta
class RandomHour(object):
def __init__(self, loc, scale):
self.loc = loc
self.scale = scale
self.norm_rand = scipy.stats.nor... | {
"repo_name": "thorwhalen/ut",
"path": "ml/synthetic/dom/navigation.py",
"copies": "1",
"size": "4366",
"license": "mit",
"hash": 8237985221888120000,
"line_mean": 36.0084745763,
"line_max": 117,
"alpha_frac": 0.5597801191,
"autogenerated": false,
"ratio": 3.368827160493827,
"config_test": fals... |
__author__ = 'thor'
import ut.util.ulist as ulist
import ut.daf.get
import ut.daf.gr
from ut.parse.web.url import get_domain_and_suffix
from ut.parse.web.url import get_sub_domain_and_suffix
import tldextract
def group_count(df, gr_cols=None, count_col=None, keep_order=True):
"""
adds a column containing th... | {
"repo_name": "thorwhalen/ut",
"path": "daf/addcol.py",
"copies": "1",
"size": "1939",
"license": "mit",
"hash": -2246180437881254000,
"line_mean": 34.2727272727,
"line_max": 98,
"alpha_frac": 0.6709644146,
"autogenerated": false,
"ratio": 2.8854166666666665,
"config_test": false,
"has_no_key... |
__author__ = 'thor'
"""
An illustration of various embeddings, based on Pedregosa, Grisel, Blondel, and Varoguaux's code
for the digits dataset. See http://scikit-learn.org/stable/auto_examples/manifold/plot_lle_digits.html
The RandomTreesEmbedding, from the :mod:`sklearn.ensemble` module, is not
technically a manif... | {
"repo_name": "thorwhalen/ut",
"path": "ml/diag/multiple_two_component_manifold_learning.py",
"copies": "1",
"size": "9229",
"license": "mit",
"hash": -6597657868052987000,
"line_mean": 40.0222222222,
"line_max": 110,
"alpha_frac": 0.5261675154,
"autogenerated": false,
"ratio": 3.8152128978916906... |
__author__ = 'thor'
# Searching for ipod through web data:
# http://yboss.yahooapis.com/ysearch/web?q=ipod
# Search the web, images, news services with different query
# http://yboss.yahooapis.com/ysearch/web,images?web.q=ipod&images.q=mp3
# Search the web, images, news services with different queries and different ... | {
"repo_name": "thorwhalen/ut",
"path": "scripts/yboss.py",
"copies": "1",
"size": "1281",
"license": "mit",
"hash": -1124342478858836600,
"line_mean": 17.0563380282,
"line_max": 151,
"alpha_frac": 0.6260733802,
"autogenerated": false,
"ratio": 2.497076023391813,
"config_test": false,
"has_no_... |
__author__ = 'thor'
"""
Utilities to measure binary classification performance based on the confusion matrix.
Definitions taken from http://en.wikipedia.org/wiki/Confusion_matrix.
Author: Thor Whalen
"""
from numpy import *
import sklearn as sk
import matplotlib.pyplot as plt
# metric_mat: dict of matrices which p... | {
"repo_name": "thorwhalen/ut",
"path": "stats/classification/bin/metrics.py",
"copies": "1",
"size": "9886",
"license": "mit",
"hash": 4055748891450768400,
"line_mean": 32.2895622896,
"line_max": 118,
"alpha_frac": 0.587396318,
"autogenerated": false,
"ratio": 3.181847441261667,
"config_test": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.