text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import power
from pybrain.utilities import abstractMethod
from pybrain.rl.environments.task import Task
from pybrain.rl.agents.agent import Agent
from pybrain.structure.modules.module import Module
from pybrain.rl.environments.fitnessevaluator import FitnessEvaluator... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/rl/environments/episodic.py",
"copies": "3",
"size": "2517",
"license": "mit",
"hash": 3963381065843311000,
"line_mean": 33.9583333333,
"line_max": 105,
"alpha_frac": 0.6094557012,
"autogenerated": false,
"ratio":... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import rand, dot
from scipy.linalg import orth, norm, inv
from function import FunctionEnvironment
class OppositeFunction(FunctionEnvironment):
""" the opposite of a function """
def __init__(self, basef):
FunctionEnvironment.__init__(self,... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/environments/functions/transformations.py",
"copies": "1",
"size": "1841",
"license": "bsd-3-clause",
"hash": 5978066776340815000,
"line_mean": 33.1111111111,
"line_max": 86,
"alpha_frac": 0.6219445953,
"autogenerated": false,
"ratio": 3.8... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import randn, zeros
from random import choice, random, gauss
from evolution import Evolution
class GA(Evolution):
""" Genetic algorithm """
# selection schemes
tournament = False
tournamentsize = 2
topproportion = 0.2
elitism = ... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/learners/blackboxoptimizers/evolution/ga.py",
"copies": "1",
"size": "2901",
"license": "bsd-3-clause",
"hash": -8861198322681248000,
"line_mean": 32.7441860465,
"line_max": 110,
"alpha_frac": 0.5639434678,
"autogenerated": false,
"ratio":... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import randn, zeros
from scipy import random as rd, array
from random import choice, random, gauss, shuffle, sample
from numpy import ndarray
from evolution import Evolution
from pybrain.optimization.optimizer import ContinuousOptimizer
class GA(ContinuousOptimizer... | {
"repo_name": "fxsjy/pybrain",
"path": "pybrain/optimization/populationbased/ga.py",
"copies": "2",
"size": "7892",
"license": "bsd-3-clause",
"hash": -5072713444500098000,
"line_mean": 36.2264150943,
"line_max": 100,
"alpha_frac": 0.5263558033,
"autogenerated": false,
"ratio": 4.065945388974756,... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import randn, zeros
import profile, pstats
from pybrain.structure.networks.network import Network
from pybrain.datasets import SequentialDataSet, SupervisedDataSet
from pybrain.supervised import BackpropTrainer
from pybrain.tools.xml import NetworkWriter, Network... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/tests/helpers.py",
"copies": "1",
"size": "3972",
"license": "bsd-3-clause",
"hash": 3616220972121250000,
"line_mean": 32.3781512605,
"line_max": 102,
"alpha_frac": 0.612286002,
"autogenerated": false,
"ratio": 3.8192307692307694,
"config_t... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import reshape, dot, outer
from connection import Connection
from pybrain.structure.parametercontainer import ParameterContainer
class FullConnection(Connection, ParameterContainer):
"""Connection which fully connects every element from the first module's
o... | {
"repo_name": "hassaanm/stock-trading",
"path": "pybrain-pybrain-87c7ac3/pybrain/structure/connections/full.py",
"copies": "5",
"size": "1169",
"license": "apache-2.0",
"hash": 1865975694100525600,
"line_mean": 39.3103448276,
"line_max": 80,
"alpha_frac": 0.6971770744,
"autogenerated": false,
"ra... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import reshape, dot, outer
from pybrain.structure.connections.connection import Connection
from pybrain.structure.parametercontainer import ParameterContainer
class FullConnection(Connection, ParameterContainer):
"""Connection which fully connects every element... | {
"repo_name": "CVML/pybrain",
"path": "pybrain/structure/connections/full.py",
"copies": "25",
"size": "1200",
"license": "bsd-3-clause",
"hash": 7243005929149253000,
"line_mean": 40.3793103448,
"line_max": 80,
"alpha_frac": 0.7016666667,
"autogenerated": false,
"ratio": 3.896103896103896,
"con... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import zeros, array, amin, amax, sqrt
from .colormaps import ColorMap
class CiaoPlot(ColorMap):
""" CIAO plot of coevolution performance with respect to the best
individuals from previous generations (Hall of Fame).
Requires 2 populations. """
@sta... | {
"repo_name": "CVML/pybrain",
"path": "pybrain/tools/plotting/ciaoplot.py",
"copies": "25",
"size": "1591",
"license": "bsd-3-clause",
"hash": 6730345136266058000,
"line_mean": 31.4693877551,
"line_max": 89,
"alpha_frac": 0.5355122564,
"autogenerated": false,
"ratio": 3.1756487025948106,
"confi... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import zeros, array, amin, amax, sqrt
from colormaps import ColorMap
class CiaoPlot(ColorMap):
""" CIAO plot of coevolution performance with respect to the best
individuals from previous generations (Hall of Fame).
Requires 2 populations. """
@stat... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/tools/plotting/ciaoplot.py",
"copies": "1",
"size": "1638",
"license": "mit",
"hash": -8577705615065501000,
"line_mean": 32.4285714286,
"line_max": 89,
"alpha_frac": 0.5177045177,
"autogenerated": false,
"ratio": ... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import zeros, array, ndarray
from pybrain.rl.environments import Environment
from pybrain.utilities import abstractMethod
from pybrain.rl.evaluator import Evaluator
from pybrain.structure.parametercontainer import ParameterContainer
class FunctionEnvironment(Enviro... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/environments/functions/function.py",
"copies": "1",
"size": "2284",
"license": "bsd-3-clause",
"hash": -4684373482395320000,
"line_mean": 28.6753246753,
"line_max": 90,
"alpha_frac": 0.5928196147,
"autogenerated": false,
"ratio": 4,
"con... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import zeros, array
from maze import MazeTask
class CheeseMaze(MazeTask):
"""
#######
# #
# # # #
# #*# #
#######
"""
observations = 7
discount = 0.95
topology = array([[1] * 7,
[1, 0, 1, 0, 1, 0, ... | {
"repo_name": "hassaanm/stock-trading",
"path": "pybrain-pybrain-87c7ac3/pybrain/rl/environments/mazes/tasks/cheesemaze.py",
"copies": "6",
"size": "1073",
"license": "apache-2.0",
"hash": 1708640150473344300,
"line_mean": 22.3260869565,
"line_max": 89,
"alpha_frac": 0.38583411,
"autogenerated": fa... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import zeros, array
from .maze import MazeTask
class CheeseMaze(MazeTask):
"""
#######
# #
# # # #
# #*# #
#######
"""
observations = 7
discount = 0.95
topology = array([[1] * 7,
[1, 0, 1, 0, 1, 0,... | {
"repo_name": "pybrain/pybrain",
"path": "pybrain/rl/environments/mazes/tasks/cheesemaze.py",
"copies": "25",
"size": "1074",
"license": "bsd-3-clause",
"hash": -7162156471995374000,
"line_mean": 22.347826087,
"line_max": 89,
"alpha_frac": 0.3854748603,
"autogenerated": false,
"ratio": 3.22522522... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import zeros, array
from maze import MazeTask
class CheeseMaze(MazeTask):
"""
#######
# #
# # # #
# #*# #
#######
"""
observations = 7
discount = 0.95
topology = array([[1] * 7,
[1, 0,... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/rl/environments/mazes/tasks/cheesemaze.py",
"copies": "3",
"size": "1094",
"license": "mit",
"hash": 8731676081982513000,
"line_mean": 22.7826086957,
"line_max": 89,
"alpha_frac": 0.3784277879,
"autogenerated": fals... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import zeros
from random import choice, random
from .maze import Maze
class PolarMaze(Maze):
""" Mazes with the emphasis on Perseus: allow him to turn, go forward or backward.
Thus there are 4 states per position.
"""
actions = 5
Stay = 0
... | {
"repo_name": "yonglehou/pybrain",
"path": "pybrain/rl/environments/mazes/polarmaze.py",
"copies": "25",
"size": "1644",
"license": "bsd-3-clause",
"hash": -7153873462224306000,
"line_mean": 28.8909090909,
"line_max": 86,
"alpha_frac": 0.5796836983,
"autogenerated": false,
"ratio": 3.307847082494... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import zeros
from random import choice, random
from maze import Maze
class PolarMaze(Maze):
""" Mazes with the emphasis on Perseus: allow him to turn, go forward or backward.
Thus there are 4 states per position.
"""
actions = 5
Stay = 0
... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/environments/mazes/polarmaze.py",
"copies": "1",
"size": "1647",
"license": "bsd-3-clause",
"hash": 2083640603471294700,
"line_mean": 28.9636363636,
"line_max": 86,
"alpha_frac": 0.5737704918,
"autogenerated": false,
"ratio": 3.375,
"con... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import zeros
from random import random, randint
from precisionboundparameters import PrecisionBoundParameters
#TODO: memetic approach / innovation protection
class BoundTotalInformation(PrecisionBoundParameters):
""" all the parameters together are encoded wit... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/learners/search/incrementalcomplexity/boundtotalinformation.py",
"copies": "1",
"size": "3236",
"license": "bsd-3-clause",
"hash": -990769232605324400,
"line_mean": 39.9746835443,
"line_max": 104,
"alpha_frac": 0.6022867738,
"autogenerated":... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import zeros
from pybrain.structure.networks.swiping import SwipingNetwork
from pybrain.structure.modules import BiasUnit
from pybrain.structure.connections.shared import MotherConnection, SharedFullConnection
from pybrain.utilities import iterCombinations, tupleRemo... | {
"repo_name": "yonglehou/pybrain",
"path": "pybrain/structure/networks/borderswiping.py",
"copies": "25",
"size": "5025",
"license": "bsd-3-clause",
"hash": 575660903312064450,
"line_mean": 46.8571428571,
"line_max": 116,
"alpha_frac": 0.5800995025,
"autogenerated": false,
"ratio": 4.276595744680... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import zeros
from swiping import SwipingNetwork
from pybrain.structure.modules import BiasUnit
from pybrain.structure.connections.shared import MotherConnection, SharedFullConnection
from pybrain.utilities import iterCombinations, tupleRemoveItem, reachable, decremen... | {
"repo_name": "hassaanm/stock-trading",
"path": "src/pybrain/structure/networks/borderswiping.py",
"copies": "5",
"size": "4978",
"license": "apache-2.0",
"hash": 160975162897927360,
"line_mean": 46.4095238095,
"line_max": 116,
"alpha_frac": 0.5783447168,
"autogenerated": false,
"ratio": 4.283993... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import zeros
from twoplayergame import TwoPlayerGame
# TODO: factor out the similarities with the CaptureGame and Go.
class GomokuGame(TwoPlayerGame):
""" The game of Go-Moku, alias Connect-Five. """
BLACK = 1
WHITE = -1
EMPTY = 0
star... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/environments/twoplayergames/gomoku.py",
"copies": "1",
"size": "5073",
"license": "bsd-3-clause",
"hash": 3329944393146602500,
"line_mean": 31.9480519481,
"line_max": 97,
"alpha_frac": 0.4632367435,
"autogenerated": false,
"ratio": 3.72740... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import zeros
from .twoplayergame import TwoPlayerGame
# TODO: factor out the similarities with the CaptureGame and Go.
class GomokuGame(TwoPlayerGame):
""" The game of Go-Moku, alias Connect-Five. """
BLACK = 1
WHITE = -1
EMPTY = 0
startcolor ... | {
"repo_name": "jlegendary/pybrain",
"path": "pybrain/rl/environments/twoplayergames/gomoku.py",
"copies": "25",
"size": "4879",
"license": "bsd-3-clause",
"hash": -450071046735220700,
"line_mean": 30.6818181818,
"line_max": 90,
"alpha_frac": 0.4791965567,
"autogenerated": false,
"ratio": 3.561313... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import zeros, ones, mean, array, argmax
from random import choice, shuffle
from ga import GA
from pybrain.tools.functions import sigmoid
from pybrain.utilities import drawIndex
class LiMaG(GA):
""" Linkage Matrix gradients """
learningRate = 0.001
pops... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/learners/blackboxoptimizers/evolution/limag.py",
"copies": "1",
"size": "8550",
"license": "bsd-3-clause",
"hash": -7860425761099193000,
"line_mean": 38.4055299539,
"line_max": 119,
"alpha_frac": 0.5419883041,
"autogenerated": false,
"rati... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import zeros, randn
from random import random, sample, gauss
from pybrain.structure.evolvables.topology import TopologyEvolvable
class MaskedParameters(TopologyEvolvable):
""" A module with a binary mask that can disable (=zero) parameters.
If no maximum is... | {
"repo_name": "sepehr125/pybrain",
"path": "pybrain/structure/evolvables/maskedparameters.py",
"copies": "26",
"size": "4020",
"license": "bsd-3-clause",
"hash": -8105353556903431000,
"line_mean": 35.5454545455,
"line_max": 90,
"alpha_frac": 0.5995024876,
"autogenerated": false,
"ratio": 4.040201... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import zeros, randn
from random import random, sample, gauss
from topology import TopologyEvolvable
class MaskedParameters(TopologyEvolvable):
""" A module with a binary mask that can disable (=zero) parameters.
If no maximum is set, the mask can potentiall... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/structure/evolvables/maskedparameters.py",
"copies": "1",
"size": "3787",
"license": "bsd-3-clause",
"hash": -2529397455823430700,
"line_mean": 35.7766990291,
"line_max": 90,
"alpha_frac": 0.5804066543,
"autogenerated": false,
"ratio": 4.1073... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import zeros, tanh
from neuronlayer import NeuronLayer
from module import Module
from pybrain.structure.parametercontainer import ParameterContainer
from pybrain.tools.functions import sigmoid, sigmoidPrime, tanhPrime
from pybrain.structure.moduleslice import ModuleS... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/structure/modules/mdlstm.py",
"copies": "4",
"size": "8294",
"license": "mit",
"hash": -3396481758584788000,
"line_mean": 45.8644067797,
"line_max": 130,
"alpha_frac": 0.6026042923,
"autogenerated": false,
"ratio"... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import zeros, tanh
from pybrain.structure.modules.neuronlayer import NeuronLayer
from pybrain.structure.modules.module import Module
from pybrain.structure.parametercontainer import ParameterContainer
from pybrain.tools.functions import sigmoid, sigmoidPrime, tanhPri... | {
"repo_name": "chanderbgoel/pybrain",
"path": "pybrain/structure/modules/mdlstm.py",
"copies": "26",
"size": "8125",
"license": "bsd-3-clause",
"hash": 3711826361880569300,
"line_mean": 44.9096045198,
"line_max": 129,
"alpha_frac": 0.6208,
"autogenerated": false,
"ratio": 3.6223807400802497,
"c... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy.optimize import fmin
from pybrain.optimization.optimizer import ContinuousOptimizer
class DesiredFoundException(Exception):
""" The desired target has been found. """
class NelderMead(ContinuousOptimizer):
"""Do the optimization using a simple wrapper for... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/optimization/neldermead.py",
"copies": "1",
"size": "1106",
"license": "mit",
"hash": -4421972703388136400,
"line_mean": 28.9189189189,
"line_max": 70,
"alpha_frac": 0.6157323689,
"autogenerated": false,
"ratio": ... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from xml.dom.minidom import parse, getDOMImplementation
from pybrain.utilities import fListToString
from scipy import zeros
import string
class XMLHandling:
""" general purpose methods for reading, writing and editing XML files.
This class should wrap all the XML-specif... | {
"repo_name": "newemailjdm/pybrain",
"path": "pybrain/tools/customxml/handling.py",
"copies": "25",
"size": "4891",
"license": "bsd-3-clause",
"hash": -3339270993100681700,
"line_mean": 33.4436619718,
"line_max": 98,
"alpha_frac": 0.5818850951,
"autogenerated": false,
"ratio": 4.201890034364261,
... |
__author__ = 'Tom Schaul, tom@idsia.ch'
import os
import pickle
def getAllFilesIn(dir, tag='', extension='.pickle'):
""" return a list of all filenames in the specified directory
(with the given tag and/or extension). """
allfiles = os.listdir(dir)
res = []
for f in allfiles:
if f[-len(ex... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/tools/filehandling.py",
"copies": "1",
"size": "1988",
"license": "mit",
"hash": 5099226543264323000,
"line_mean": 25.1578947368,
"line_max": 76,
"alpha_frac": 0.5261569416,
"autogenerated": false,
"ratio": 3.9444... |
__author__ = 'Tom Schaul, tom@idsia.ch'
import profile
import pstats
import tempfile
from scipy import randn, zeros
from pybrain.structure.networks.network import Network
from pybrain.datasets import SequentialDataSet, SupervisedDataSet
from pybrain.supervised import BackpropTrainer
from pybrain.tools.xml import... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/tests/helpers.py",
"copies": "1",
"size": "4317",
"license": "mit",
"hash": -7447149041629320000,
"line_mean": 30.5109489051,
"line_max": 102,
"alpha_frac": 0.6082927959,
"autogenerated": false,
"ratio": 3.9245454... |
__author__ = 'Tom Schaul, tom@idsia.ch'
import random
import copy
import numpy as np
from scipy import zeros
from pprint import pformat, pprint
import pygame
from pygame.locals import *
from pybrain.utilities import Named
from pybrain.rl.environments.environment import Environment
# TODO: mazes can have any number o... | {
"repo_name": "grschafer/BejeweledBot",
"path": "gfx/environment.py",
"copies": "1",
"size": "26658",
"license": "mit",
"hash": -7929219287877695000,
"line_mean": 40.5881435257,
"line_max": 180,
"alpha_frac": 0.5586315553,
"autogenerated": false,
"ratio": 3.6608074704751443,
"config_test": fals... |
__author__ = 'Tom Schaul, tom@idsia.ch'
import random
import copy
import numpy as np
from scipy import zeros
from pprint import pformat, pprint
from pybrain.utilities import Named
from pybrain.rl.environments.environment import Environment
# TODO: mazes can have any number of dimensions?
BOARDWIDTH = 4
BOARDHEIGHT ... | {
"repo_name": "grschafer/BejeweledBot",
"path": "train/environment.py",
"copies": "1",
"size": "20036",
"license": "mit",
"hash": -7035706251078130000,
"line_mean": 40.8288100209,
"line_max": 180,
"alpha_frac": 0.5429726492,
"autogenerated": false,
"ratio": 3.786807786807787,
"config_test": fal... |
__author__ = 'Tom Schaul, tom@idsia.ch'
import random
from pybrain import SharedFullConnection, MotherConnection, MDLSTMLayer, IdentityConnection
from pybrain import ModuleMesh, LinearLayer, TanhLayer, SigmoidLayer
from pybrain.structure.networks import BorderSwipingNetwork
# TODO: incomplete implementation: missin... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/structure/networks/custom/capturegame.py",
"copies": "3",
"size": "6657",
"license": "mit",
"hash": -9057260685390838000,
"line_mean": 43.0927152318,
"line_max": 129,
"alpha_frac": 0.5902057984,
"autogenerated": fal... |
__author__ = 'Tom Schaul, tom@idsia.ch'
import socket
from captureplayer import CapturePlayer
from pybrain.rl.environments.twoplayergames import CaptureGame
# TODO: allow partially forced random moves.
class ClientCapturePlayer(CapturePlayer):
""" A wrapper class for using external code to play the capture game... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/rl/environments/twoplayergames/capturegameplayers/clientwrapper.py",
"copies": "1",
"size": "2336",
"license": "mit",
"hash": 5215931594662912000,
"line_mean": 30.1466666667,
"line_max": 84,
"alpha_frac": 0.5252568493... |
__author__ = 'Tom Schaul, tom@idsia.ch'
"""
Adaptation of the Acrobot Environment
from the "FAReinforcement" library
of Jose Antonio Martin H. (version 1.0).
"""
from scipy import pi, array, cos, sin
from pybrain.rl.environments.episodic import EpisodicTask
class AcrobotTask(EpisodicTask):
""" TODO: not cu... | {
"repo_name": "CVML/pybrain",
"path": "pybrain/rl/environments/classic/acrobot.py",
"copies": "26",
"size": "5710",
"license": "bsd-3-clause",
"hash": -4458850472625190400,
"line_mean": 25.4351851852,
"line_max": 193,
"alpha_frac": 0.5136602452,
"autogenerated": false,
"ratio": 3.2241671372106153... |
__author__ = 'Tom Schaul, tom@idsia.ch'
"""
Adaptation of the MountainCar Environment
from the "FAReinforcement" library
of Jose Antonio Martin H. (version 1.0).
"""
from scipy import array, cos
from pybrain.rl.environments.episodic import EpisodicTask
class MountainCar(EpisodicTask):
# The current real va... | {
"repo_name": "comepradz/pybrain",
"path": "pybrain/rl/environments/classic/mountaincar.py",
"copies": "26",
"size": "3378",
"license": "bsd-3-clause",
"hash": -309490469733675970,
"line_mean": 23.8382352941,
"line_max": 79,
"alpha_frac": 0.5470692718,
"autogenerated": false,
"ratio": 3.679738562... |
__author__ = 'Tom Schaul, tom@idsia.ch'
class Experiment(object):
""" An experiment matches up a task with an agent and handles their interactions.
"""
def __init__(self, task, agent):
self.task = task
self.agent = agent
self.stepid = 0
def doInteractions(self, number = 1):
... | {
"repo_name": "fxsjy/pybrain",
"path": "pybrain/rl/experiments/experiment.py",
"copies": "34",
"size": "1033",
"license": "bsd-3-clause",
"hash": 6769453387659869000,
"line_mean": 33.4333333333,
"line_max": 91,
"alpha_frac": 0.6234269119,
"autogenerated": false,
"ratio": 4.268595041322314,
"con... |
__author__ = 'Tom Schaul, tom@idsia.ch'
def timeBoundExecution(algo, maxtime):
""" wrap the algo, to stop execution after it has used all its allocated time """
# TODO
return algo
class LevinSeach:
""" a.k.a. Universal Search
Note: don't run this, it's a bit slow... but it will solve all your p... | {
"repo_name": "RatulGhosh/pybrain",
"path": "pybrain/rl/learners/meta/levinsearch.py",
"copies": "25",
"size": "1630",
"license": "bsd-3-clause",
"hash": 1594474881533343500,
"line_mean": 31.62,
"line_max": 85,
"alpha_frac": 0.545398773,
"autogenerated": false,
"ratio": 4.346666666666667,
"conf... |
__author__ = 'Tom Schaul, tom@idsia.ch'
"""
Doing RL when an environment model (transition matrices and rewards) are available,
and the states are observed by a feature vector for each state:
- a feature map (fMap) is a 2D array of features, one row per state.
(otherwise same representation as for in policyiterati... | {
"repo_name": "abhishekgahlot/pybrain",
"path": "pybrain/rl/learners/modelbased/leastsquares.py",
"copies": "2",
"size": "4556",
"license": "bsd-3-clause",
"hash": -7150873871156712000,
"line_mean": 34.874015748,
"line_max": 94,
"alpha_frac": 0.625548727,
"autogenerated": false,
"ratio": 3.405082... |
__author__ = 'Tom Schaul, tom@idsia.ch'
"""
Doing RL when an environment model (transition matrices and rewards) are available.
Representation:
- a policy is a 2D-array of probabilities,
one row per state (summing to 1), one column per action.
- a transition matrix (T) maps from originating states to desti... | {
"repo_name": "blueburningcoder/pybrain",
"path": "pybrain/rl/learners/modelbased/policyiteration.py",
"copies": "28",
"size": "4681",
"license": "bsd-3-clause",
"hash": 8491239053262602000,
"line_mean": 31.5069444444,
"line_max": 106,
"alpha_frac": 0.6421704764,
"autogenerated": false,
"ratio": ... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from handling import XMLHandling
# those imports are necessary for the eval() commands to find the right classes
import pybrain #@UnusedImport
from scipy import array #@UnusedImport
class NetworkReader(XMLHandling):
""" A class that can take read a network from an XML fi... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/tools/xml/networkreader.py",
"copies": "1",
"size": "3747",
"license": "bsd-3-clause",
"hash": 7379392726445571000,
"line_mean": 33.3853211009,
"line_max": 89,
"alpha_frac": 0.5543101148,
"autogenerated": false,
"ratio": 4.191275167785235,
... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from inspect import isclass
from pybrain.utilities import Named
from pybrain.rl.environments.twoplayergames import GomokuGame
from pybrain.rl.environments.twoplayergames.gomokuplayers import RandomGomokuPlayer, ModuleDecidingPlayer
from pybrain.rl.environments.twoplayergames.g... | {
"repo_name": "cmorgan/pybrain",
"path": "pybrain/rl/environments/twoplayergames/tasks/gomokutask.py",
"copies": "31",
"size": "3765",
"license": "bsd-3-clause",
"hash": -8334008441360296000,
"line_mean": 35.5533980583,
"line_max": 111,
"alpha_frac": 0.6403718459,
"autogenerated": false,
"ratio":... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from meta import MetaLearner
from pybrain.structure.modules.module import Module
from pybrain.structure.evolvables.maskedparameters import MaskedParameters
from pybrain.structure.evolvables.maskedmodule import MaskedModule
from pybrain.structure.evolvables.topology import Topol... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/learners/meta/memetic.py",
"copies": "1",
"size": "2165",
"license": "bsd-3-clause",
"hash": 3338430059153201000,
"line_mean": 38.3818181818,
"line_max": 99,
"alpha_frac": 0.6466512702,
"autogenerated": false,
"ratio": 4.278656126482214,
... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from pybrain.utilities import subDict, dictCombinations
import pylab
def plotVariations(datalist, titles, genFun, varyperplot=None, prePlotFun=None, postPlotFun=None,
_differentiator=0.0, **optionlists):
""" A tool for quickly generating a lot of variat... | {
"repo_name": "chanderbgoel/pybrain",
"path": "pybrain/tools/plotting/quickvariations.py",
"copies": "25",
"size": "2931",
"license": "bsd-3-clause",
"hash": 3228057043882094600,
"line_mean": 44.796875,
"line_max": 115,
"alpha_frac": 0.5441828727,
"autogenerated": false,
"ratio": 4.05955678670360... |
__author__ = "Tom Schaul, tom@idsia.ch"
from scipy import median
class AdaptiveResampler(object):
""" A simplified version of the uncertainty handling method described in
Hansen, Niederberger, Guzzella and Koumoutsakos, 2009."""
def __init__(self, f, batchsize, update_factor=1.5, threshold=... | {
"repo_name": "hassaanm/stock-trading",
"path": "pybrain-pybrain-87c7ac3/pybrain/tools/aptativeresampling.py",
"copies": "5",
"size": "2343",
"license": "apache-2.0",
"hash": -4411643879050138000,
"line_mean": 32.9710144928,
"line_max": 92,
"alpha_frac": 0.6000853606,
"autogenerated": false,
"rat... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import ndarray, size, rand
from pybrain.rl.learners import Learner
from pybrain.structure.parametercontainer import ParameterContainer
class BlackBoxOptimizer(Learner):
""" A type of Learner that optimizes an unknown (single-output) function.
It only accep... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/learners/blackboxoptimizers/blackboxoptimizer.py",
"copies": "1",
"size": "3285",
"license": "bsd-3-clause",
"hash": 2543852424815516700,
"line_mean": 34.7173913043,
"line_max": 86,
"alpha_frac": 0.601826484,
"autogenerated": false,
"ratio... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import rand, dot, power, diag, eye, sqrt, sin, log, exp, ravel, clip, arange
from scipy.linalg import orth, norm, inv
from random import shuffle, random, gauss
from function import FunctionEnvironment
from pybrain.structure.parametercontainer import ParameterContain... | {
"repo_name": "fxsjy/pybrain",
"path": "pybrain/rl/environments/functions/transformations.py",
"copies": "2",
"size": "9330",
"license": "bsd-3-clause",
"hash": 2565697601330780700,
"line_mean": 33.4317343173,
"line_max": 117,
"alpha_frac": 0.5031082529,
"autogenerated": false,
"ratio": 3.9086719... |
__author__ = 'Tom Schaul, tom@idsia.ch'
import scipy
from neuronlayer import NeuronLayer
from pybrain.tools.functions import safeExp
class SoftmaxLayer(NeuronLayer):
""" A layer implementing a softmax distribution over the input."""
# TODO: collapsing option?
# CHECKME: temperature parameter?
... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/structure/modules/softmax.py",
"copies": "4",
"size": "1181",
"license": "mit",
"hash": -5846489603716665000,
"line_mean": 29.3076923077,
"line_max": 78,
"alpha_frac": 0.6409822185,
"autogenerated": false,
"ratio"... |
__author__ = 'Tom Schaul, tom@idsia.ch'
import scipy
from pybrain.structure.modules.neuronlayer import NeuronLayer
from pybrain.tools.functions import safeExp
class SoftmaxLayer(NeuronLayer):
""" A layer implementing a softmax distribution over the input."""
# TODO: collapsing option?
# CHECKME: tempe... | {
"repo_name": "comepradz/pybrain",
"path": "pybrain/structure/modules/softmax.py",
"copies": "26",
"size": "1151",
"license": "bsd-3-clause",
"hash": -4963660808008694000,
"line_mean": 29.2894736842,
"line_max": 78,
"alpha_frac": 0.6776715899,
"autogenerated": false,
"ratio": 3.653968253968254,
... |
__author__ = 'Tom Schaul, tom@idsia.ch'
__version__ = '$Id$'
from pybrain.utilities import Named, abstractMethod
class Trainer(Named):
""" A trainer determines how to change the adaptive parameters of a module.
It requires access to a DataSet object (which provides input-target tuples). """
# e.g. bptt... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/supervised/trainers/trainer.py",
"copies": "1",
"size": "1364",
"license": "bsd-3-clause",
"hash": 6204891227006759000,
"line_mean": 30.7441860465,
"line_max": 84,
"alpha_frac": 0.5945747801,
"autogenerated": false,
"ratio": 4.275862068965517... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from pybrain.optimization.distributionbased.distributionbased import DistributionBasedOptimizer
from scipy import dot, exp, log, sqrt, floor, ones, randn
from pybrain.tools.rankingfunctions import HansenRanking
class SNES(DistributionBasedOptimizer):
""" Separable ... | {
"repo_name": "fxsjy/pybrain",
"path": "pybrain/optimization/distributionbased/snes.py",
"copies": "5",
"size": "4480",
"license": "bsd-3-clause",
"hash": 5614599011722238000,
"line_mean": 36.6379310345,
"line_max": 123,
"alpha_frac": 0.5640625,
"autogenerated": false,
"ratio": 4.299424184261037,... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from pybrain.rl.environments.episodic import EpisodicTask
from scipy import array
from random import randint, random
class XORTask(EpisodicTask):
""" Continuous task, producing binary observations, taking a single, binary action
rewarding the agent whenever ac... | {
"repo_name": "hassaanm/stock-trading",
"path": "pybrain-pybrain-87c7ac3/pybrain/rl/environments/classic/xor.py",
"copies": "5",
"size": "2369",
"license": "apache-2.0",
"hash": 5355801295600519000,
"line_mean": 28.0126582278,
"line_max": 86,
"alpha_frac": 0.5297593921,
"autogenerated": false,
"r... |
__author__ = 'Tom Schaul, tom@idsia.ch'
"""
Adaptation of the Acrobot Environment
from the "FAReinforcement" library
of Jose Antonio Martin H. (version 1.0).
"""
from scipy import pi, array, cos, sin
from pybrain.rl.environments.episodic import EpisodicTask
class AcrobotTask(EpisodicTask):
"""... | {
"repo_name": "abhishekgahlot/pybrain",
"path": "pybrain/rl/environments/classic/acrobot.py",
"copies": "5",
"size": "5925",
"license": "bsd-3-clause",
"hash": 4582653428530086000,
"line_mean": 25.4305555556,
"line_max": 193,
"alpha_frac": 0.495021097,
"autogenerated": false,
"ratio": 3.326782706... |
__author__ = 'Tom Schaul, tom@idsia.ch'
"""
Adaptation of the MountainCar Environment
from the "FAReinforcement" library
of Jose Antonio Martin H. (version 1.0).
"""
from scipy import array, cos
from pybrain.rl.environments.episodic import EpisodicTask
class MountainCar(EpisodicTask):
# The cu... | {
"repo_name": "hassaanm/stock-trading",
"path": "pybrain-pybrain-87c7ac3/pybrain/rl/environments/classic/mountaincar.py",
"copies": "5",
"size": "3511",
"license": "apache-2.0",
"hash": -4769956353361656000,
"line_mean": 23.8161764706,
"line_max": 79,
"alpha_frac": 0.5263457704,
"autogenerated": fa... |
__author__ = 'Tom Schaul, tom@idsia.ch, Spyridon Samothrakis ssamot@essex.ac.uk'
## ssamot hacked ask/tell interface, algorithmic implementation is from Tom Schaul
from numpy import dot, exp, log, sqrt, ones, zeros_like, Inf, argmax
import numpy as np
def computeUtilities(fitnesses):
L = len(fitnesses)
rank... | {
"repo_name": "ssamot/infoGA",
"path": "snes.py",
"copies": "1",
"size": "2663",
"license": "apache-2.0",
"hash": -7052732440408984000,
"line_mean": 31.487804878,
"line_max": 133,
"alpha_frac": 0.6034547503,
"autogenerated": false,
"ratio": 3.2123039806996383,
"config_test": false,
"has_no_ke... |
__author__ = 'Tom Schaul, tom@idsia.ch; Sun Yi, yi@idsia.ch'
from numpy import floor, log, eye, zeros, array, sqrt, sum, dot, tile, outer, real
from numpy import exp, diag, power, ravel, minimum, maximum
from numpy.linalg import eig, norm
from numpy.random import randn, rand
from blackboxoptimizer import BlackBoxOpti... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/learners/blackboxoptimizers/cmaes.py",
"copies": "1",
"size": "10283",
"license": "bsd-3-clause",
"hash": 3722830754410397000,
"line_mean": 41.4917355372,
"line_max": 110,
"alpha_frac": 0.5112321307,
"autogenerated": false,
"ratio": 3.4094... |
__author__ = 'Tom Schaul, tom@idsia.ch; Sun Yi, yi@idsia.ch'
from numpy import floor, log, eye, zeros, array, sqrt, sum, dot, tile, outer, real
from numpy import exp, diag, power, ravel
from numpy.linalg import eig, norm
from numpy.random import randn
from pybrain.optimization.optimizer import ContinuousOptimizer
c... | {
"repo_name": "arnaudsj/pybrain",
"path": "pybrain/optimization/distributionbased/cmaes.py",
"copies": "5",
"size": "6656",
"license": "bsd-3-clause",
"hash": 7310588282480264000,
"line_mean": 50.2,
"line_max": 133,
"alpha_frac": 0.5991586538,
"autogenerated": false,
"ratio": 3.4848167539267014,
... |
# ClickCropper based on code by:
# author: Adrian Rosebrock
# website: http://www.pyimagesearch.com
import cv2
import numpy as np
import scipy.signal
class ClickCropper:
'''ClickCropper
Object to support function click_and_crop()'''
def __init__(self, image):
self.image = image
self... | {
"repo_name": "tomwright01/AO_Registration",
"path": "AoRegistration/ImageTools.py",
"copies": "1",
"size": "15102",
"license": "mit",
"hash": -7928200538557429000,
"line_mean": 33.4031890661,
"line_max": 127,
"alpha_frac": 0.5839623891,
"autogenerated": false,
"ratio": 3.356,
"config_test": fa... |
import numpy as np
import scipy
import scipy.signal
import cv2
import logging
import multiprocessing
import FrameStack
import ImageTools
logger = logging.getLogger(__name__)
def apply_displacements(framestack,displacements):
"""Apply displacements to an image stack
Resizes the framestack to the largest... | {
"repo_name": "tomwright01/AO_Registration",
"path": "AoRegistration/StackTools.py",
"copies": "1",
"size": "5276",
"license": "mit",
"hash": 4968647888977125000,
"line_mean": 36.161971831,
"line_max": 199,
"alpha_frac": 0.6478392722,
"autogenerated": false,
"ratio": 3.5989085948158253,
"config... |
__author__ = 'tonnpa'
from matplotlib import pyplot as plt
import csv
import os
SOURCE_FILE = '/media/sf_Ubuntu/opleaders/egonet_features.csv'
# TARGET_DIR = '/media/sf_Ubuntu/opleaders/figures'
TARGET_DIR = '/tmp'
OUT_FILE = '/tmp/commenters.txt'
os.chdir(TARGET_DIR)
csvfile = open(SOURCE_FILE, 'r')
reader = csv.r... | {
"repo_name": "tonnpa/opleaders",
"path": "visuals/draw_figures.py",
"copies": "1",
"size": "1810",
"license": "apache-2.0",
"hash": 7222092673203885000,
"line_mean": 27.746031746,
"line_max": 109,
"alpha_frac": 0.591160221,
"autogenerated": false,
"ratio": 3.0318257956448913,
"config_test": fa... |
__author__ = 'tonnpa'
import csv
import json
import os
import re
from datetime import date, timedelta
import networkx as nx
import input_check as ic
import primitive_graph as pgraph
def build_graph(src_dir, **kwargs):
"""
Builds graphs from json files retrieved from disqus listPosts.
:param src_dir... | {
"repo_name": "tonnpa/opleaders",
"path": "graphs/portal444/discussion_graph.py",
"copies": "1",
"size": "6824",
"license": "apache-2.0",
"hash": -6220219000999802000,
"line_mean": 32.6206896552,
"line_max": 99,
"alpha_frac": 0.5584701055,
"autogenerated": false,
"ratio": 3.906124785346308,
"co... |
__author__ = 'tonnpa'
import json
from urllib.request import urlopen
# static variables common to all URLs
api_version = '3.0'
output_type = '.json?'
api_key = 'api_key=OjL90VsZnaWjtuJwYhWEC6RJKN2lNucCCCUSkygOJCc6gWtjHjZdDKcceBRbL4V2'
def get_url_list_threads(forum, since='', cursor='', limit=100, order='asc'):
... | {
"repo_name": "tonnpa/opleaders",
"path": "disqus/fetch.py",
"copies": "1",
"size": "1614",
"license": "apache-2.0",
"hash": 1113179644009549000,
"line_mean": 27.8392857143,
"line_max": 99,
"alpha_frac": 0.5879801735,
"autogenerated": false,
"ratio": 3.2738336713995944,
"config_test": false,
... |
__author__ = 'tonnpa'
import os
import os.path
def src_dir_exists(path):
exists = os.path.exists(path)
if not exists:
print('ERROR: Source directory does not exist: ' + path)
return exists
def src_dir_empty(path):
if not os.listdir(path):
print('ERROR: Empty source directory: ' + pa... | {
"repo_name": "tonnpa/opleaders",
"path": "input_check.py",
"copies": "1",
"size": "1126",
"license": "apache-2.0",
"hash": 5660880257862194000,
"line_mean": 22.9574468085,
"line_max": 88,
"alpha_frac": 0.6429840142,
"autogenerated": false,
"ratio": 3.679738562091503,
"config_test": false,
"h... |
__author__ = 'tonnpa'
def build_adjacency_list(adj_list, comments, comm_authors):
"""
Builds the adjacency list by appending the authors and their
relations to other authors extracted from the comments
:param comm_authors: dictionary that contains which comments
were written by whom
"""... | {
"repo_name": "tonnpa/opleaders",
"path": "graphs/portal444/primitive_graph.py",
"copies": "1",
"size": "3703",
"license": "apache-2.0",
"hash": 2522705061529112600,
"line_mean": 47.7368421053,
"line_max": 110,
"alpha_frac": 0.5654874426,
"autogenerated": false,
"ratio": 4.526894865525672,
"con... |
__author__ = 'Tony Beltramelli - http://www.tonybeltramelli.com'
from random import randint
import json
class CustomSimpleCaptcha:
_challenge_path = None
_questions = None
def __init__(self, challenge_path):
self._challenge_path = challenge_path
def get_challenge(self):
questions = ... | {
"repo_name": "tonybeltramelli/Custom-Simple-Captcha",
"path": "python/CustomSimpleCaptcha.py",
"copies": "1",
"size": "1531",
"license": "mit",
"hash": 8146283485374515000,
"line_mean": 26.8363636364,
"line_max": 74,
"alpha_frac": 0.6048334422,
"autogenerated": false,
"ratio": 4.03957783641161,
... |
__author__ = 'Tony Beltramelli www.tonybeltramelli.com - 04/09/2015'
import scipy.signal as signal
from ..utils.UMath import *
from pandas import Series
from ..Path import Path
class Sensor:
def __init__(self, file_path, view=None, preprocess_signal=True):
data = np.genfromtxt(file_path, delimiter=',', ... | {
"repo_name": "tonybeltramelli/Deep-Spying",
"path": "server/analytics/modules/sensor/Sensor.py",
"copies": "1",
"size": "7484",
"license": "apache-2.0",
"hash": -1938991734075862800,
"line_mean": 34.3018867925,
"line_max": 132,
"alpha_frac": 0.5968733298,
"autogenerated": false,
"ratio": 3.46963... |
__author__ = 'Tony Beltramelli www.tonybeltramelli.com - 07/09/2015'
import os
import random
import collections
from pybrain.tools.xml.networkwriter import NetworkWriter
from pybrain.tools.xml.networkreader import NetworkReader
from RelevanceAssessment import *
from ..utils.UMath import *
class Classifier:
LABE... | {
"repo_name": "tonybeltramelli/Deep-Spying",
"path": "server/analytics/modules/classification/Classifier.py",
"copies": "1",
"size": "5874",
"license": "apache-2.0",
"hash": -4126217842591803000,
"line_mean": 31.453038674,
"line_max": 99,
"alpha_frac": 0.5592441267,
"autogenerated": false,
"ratio... |
__author__ = 'Tony Beltramelli www.tonybeltramelli.com - 13/09/2015'
from pybrain.datasets import SequentialDataSet
from pybrain.supervised.trainers import RPropMinusTrainer
from Classifier import *
from ..utils.UNeuralNet import *
class Recurrent(Classifier):
def __init__(self, neurons_per_layer=[9]):
C... | {
"repo_name": "tonybeltramelli/Deep-Spying",
"path": "server/analytics/modules/classification/Recurrent.py",
"copies": "1",
"size": "1392",
"license": "apache-2.0",
"hash": 5400862364911610000,
"line_mean": 34.6923076923,
"line_max": 104,
"alpha_frac": 0.6609195402,
"autogenerated": false,
"ratio... |
__author__ = 'Tony Beltramelli www.tonybeltramelli.com - 14/09/2015'
import scipy.stats as stats
from PeakAnalysis import *
from ..utils.UMath import *
from ..Path import Path
class FeatureExtractor:
def __init__(self, output_path, view, use_statistical_features=False):
self.output_path = output_path
... | {
"repo_name": "tonybeltramelli/Deep-Spying",
"path": "server/analytics/modules/feature/FeatureExtractor.py",
"copies": "1",
"size": "5617",
"license": "apache-2.0",
"hash": -8357687460745404000,
"line_mean": 38.0138888889,
"line_max": 133,
"alpha_frac": 0.6019227346,
"autogenerated": false,
"rati... |
__author__ = 'Tony Beltramelli www.tonybeltramelli.com - 16/09/2015'
from ..utils.UMath import *
from ..View import *
import collections
class RelevanceAssessment:
def __init__(self, labels):
self.labels = labels
self.view = View(False, True)
self.positives = []
self.negatives =... | {
"repo_name": "tonybeltramelli/Deep-Spying",
"path": "server/analytics/modules/classification/RelevanceAssessment.py",
"copies": "1",
"size": "5998",
"license": "apache-2.0",
"hash": 4901916751871069000,
"line_mean": 34.4970414201,
"line_max": 133,
"alpha_frac": 0.6020340113,
"autogenerated": false... |
__author__ = 'Tony Beltramelli www.tonybeltramelli.com - 17/10/2015'
from pybrain.structure import *
from scipy import random
class UNeuralNet:
@staticmethod
def get_neural_net(input_number, output_number, NetworkType, HiddenLayerType, neurons_per_layer=[9], use_bias=False):
random.seed(123)
... | {
"repo_name": "tonybeltramelli/Deep-Spying",
"path": "server/analytics/modules/utils/UNeuralNet.py",
"copies": "1",
"size": "1545",
"license": "apache-2.0",
"hash": -5206350949494828000,
"line_mean": 28.7307692308,
"line_max": 121,
"alpha_frac": 0.6284789644,
"autogenerated": false,
"ratio": 3.80... |
__author__ = 'Tony Beltramelli www.tonybeltramelli.com - 19/08/2016'
import numpy as np
import codecs
class Vocabulary:
vocabulary = {}
binary_vocabulary = {}
char_lookup = {}
size = 0
separator = '->'
def generate(self, input_file_path):
input_file = codecs.open(input_file_path, 'r',... | {
"repo_name": "tonybeltramelli/Deep-Lyrics",
"path": "modules/Vocabulary.py",
"copies": "1",
"size": "2278",
"license": "mit",
"hash": -2537366358327459300,
"line_mean": 35.1587301587,
"line_max": 121,
"alpha_frac": 0.5579455663,
"autogenerated": false,
"ratio": 3.9617391304347827,
"config_test... |
__author__ = 'Tony Beltramelli www.tonybeltramelli.com - 22/09/2015'
from pybrain.datasets import SupervisedDataSet
from pybrain.supervised.trainers import RPropMinusTrainer
from Classifier import *
from ..utils.UNeuralNet import *
class FeedForward(Classifier):
def __init__(self, neurons_per_layer=[9]):
... | {
"repo_name": "tonybeltramelli/Deep-Spying",
"path": "server/analytics/modules/classification/FeedForward.py",
"copies": "1",
"size": "1186",
"license": "apache-2.0",
"hash": 5730023990415354000,
"line_mean": 31.9444444444,
"line_max": 106,
"alpha_frac": 0.6661045531,
"autogenerated": false,
"rat... |
__author__ = 'Tony Beltramelli www.tonybeltramelli.com - 25/08/2015'
import numpy as np
import pylab
from posixpath import basename
class View:
def __init__(self, to_show=True, to_save=True, screen_size=None):
self.to_show = to_show
self.to_save = to_save
self.screen_size = screen_size
... | {
"repo_name": "tonybeltramelli/Deep-Spying",
"path": "server/analytics/modules/View.py",
"copies": "1",
"size": "8251",
"license": "apache-2.0",
"hash": 7657459001146209000,
"line_mean": 29.9026217228,
"line_max": 124,
"alpha_frac": 0.5522966913,
"autogenerated": false,
"ratio": 3.561070349589987... |
__author__ = 'Tony Beltramelli www.tonybeltramelli.com - 29/08/2015'
from math import *
from pandas import Series
import numpy as np
class UMath:
@staticmethod
def normalize(range_min, range_max, x, x_min, x_max):
return range_min + (((x - x_min) * (range_max - range_min)) * (1 / (x_max - x_min)))
... | {
"repo_name": "tonybeltramelli/Deep-Spying",
"path": "server/analytics/modules/utils/UMath.py",
"copies": "1",
"size": "1804",
"license": "apache-2.0",
"hash": 1175661133173016600,
"line_mean": 25.1594202899,
"line_max": 97,
"alpha_frac": 0.5626385809,
"autogenerated": false,
"ratio": 3.365671641... |
__author__ = 'Tony Beltramelli - www.tonybeltramelli.com'
import numpy as np
START_TOKEN = "<START>"
END_TOKEN = "<END>"
PLACEHOLDER = " "
SEPARATOR = '->'
class Vocabulary:
def __init__(self):
self.binary_vocabulary = {}
self.vocabulary = {}
self.token_lookup = {}
self.size = 0
... | {
"repo_name": "hippyk/pix2code",
"path": "model/classes/Vocabulary.py",
"copies": "1",
"size": "2300",
"license": "apache-2.0",
"hash": -8680290703923480000,
"line_mean": 32.3333333333,
"line_max": 105,
"alpha_frac": 0.5617391304,
"autogenerated": false,
"ratio": 3.8983050847457625,
"config_tes... |
__author__ = 'Tony Beltramelli - www.tonybeltramelli.com'
import string
import random
class Utils:
@staticmethod
def get_random_text(length_text=10, space_number=1, with_upper_case=True):
results = []
while len(results) < length_text:
char = random.choice(string.ascii_letters[:26]... | {
"repo_name": "hippyk/pix2code",
"path": "compiler/classes/Utils.py",
"copies": "2",
"size": "1382",
"license": "apache-2.0",
"hash": 5356650004667248000,
"line_mean": 26.0980392157,
"line_max": 78,
"alpha_frac": 0.5578871201,
"autogenerated": false,
"ratio": 3.8711484593837535,
"config_test": ... |
__author__ = 'Tony Beltramelli - www.tonybeltramelli.com'
import sys
import numpy as np
START_TOKEN = "<START>"
END_TOKEN = "<END>"
PLACEHOLDER = " "
SEPARATOR = '->'
class Vocabulary:
def __init__(self):
self.binary_vocabulary = {}
self.vocabulary = {}
self.token_lookup = {}
sel... | {
"repo_name": "tonybeltramelli/pix2code",
"path": "model/classes/Vocabulary.py",
"copies": "1",
"size": "2568",
"license": "apache-2.0",
"hash": 4389036306471576600,
"line_mean": 31.9230769231,
"line_max": 105,
"alpha_frac": 0.5549065421,
"autogenerated": false,
"ratio": 3.944700460829493,
"con... |
__author__ = 'tonycastronova'
__AdapedBy__ = 'AdelAbdallah'
class POSTGRESQL():
def __init__(self):
pass
def map_data_type(self,type):
type = self._fixTypeNames(type.lower())
type = self._mapPostgresDataTypes(type.lower())
return type
def _fixTypeNames(self, type):
... | {
"repo_name": "amabdallah/WaM-DaM",
"path": "01Documentation/02DDL/data_mapping.py",
"copies": "1",
"size": "5924",
"license": "bsd-3-clause",
"hash": 5015963081784704000,
"line_mean": 25.0969162996,
"line_max": 56,
"alpha_frac": 0.4392302498,
"autogenerated": false,
"ratio": 4.404460966542751,
... |
__author__ = 'tonycastronova'
__AdapedBy__ = 'AdelAbdallah'
import os, sys
from os.path import join, dirname, basename
import base
import translator
import xml.etree.ElementTree as et
from optparse import OptionParser
input_file = 'WaMDaMAugust19_2015.xml'
use_schemas = True
default_schema = 'WaMDaMAugust19_2015'
de... | {
"repo_name": "amabdallah/WaM-DaM",
"path": "01Documentation/02DDL/build_ddl.py",
"copies": "1",
"size": "7943",
"license": "bsd-3-clause",
"hash": 1341043750170665000,
"line_mean": 33.3852813853,
"line_max": 149,
"alpha_frac": 0.5440010072,
"autogenerated": false,
"ratio": 3.6186788154897496,
... |
__author__ = 'tonycastronova'
__AdapedBy__ = 'AdelAbdallah'
class Schema():
def __init__(self, name):
self.__name = name
self.__tables = []
def name(self):
return self.__name
def add_table(self, table):
self.__tables.append(table)
def get_tables(self):
return ... | {
"repo_name": "amabdallah/WaM-DaM",
"path": "01Documentation/02DDL/base.py",
"copies": "1",
"size": "2161",
"license": "bsd-3-clause",
"hash": 2666964003808776000,
"line_mean": 26.3544303797,
"line_max": 158,
"alpha_frac": 0.533086534,
"autogenerated": false,
"ratio": 3.8727598566308243,
"confi... |
__author__ = 'tonycastronova'
__AdapedBy__ = 'AdelAbdallah'
from math import floor, ceil
import data_mapping
class MSSQL():
def __init__(self, options, dbwrenchObj):
self.__schemas = dbwrenchObj
self.__use_schemas = options.use_schemas
self.map = data_mapping.MSSQL()
self.__global... | {
"repo_name": "amabdallah/WaM-DaM",
"path": "01Documentation/02DDL/translator.py",
"copies": "1",
"size": "18313",
"license": "bsd-3-clause",
"hash": -5102119053744180000,
"line_mean": 39.4260485651,
"line_max": 149,
"alpha_frac": 0.5359034566,
"autogenerated": false,
"ratio": 3.639308426073132,
... |
__author__ = 'tonycastronova'
from math import floor, ceil
import data_mapping
class MSSQL():
def __init__(self, options, dbwrenchObj):
self.__schemas = dbwrenchObj
self.__use_schemas = options.use_schemas
self.map = data_mapping.MSSQL()
self.__global_schema = options.global_schema
... | {
"repo_name": "miguelcleon/ODM2",
"path": "src/build_schemas/translator.py",
"copies": "1",
"size": "16588",
"license": "bsd-3-clause",
"hash": -104801151905195230,
"line_mean": 35.6181015453,
"line_max": 355,
"alpha_frac": 0.52176272,
"autogenerated": false,
"ratio": 3.6993755575379126,
"confi... |
__author__ = 'tonycastronova'
class POSTGRESQL():
def __init__(self):
pass
def map_data_type(self,type):
type = self._fixTypeNames(type.lower())
type = self._mapPostgresDataTypes(type.lower())
return type
def _fixTypeNames(self, type):
fixNames = {
'in... | {
"repo_name": "miguelcleon/ODM2",
"path": "src/build_schemas/data_mapping.py",
"copies": "2",
"size": "5888",
"license": "bsd-3-clause",
"hash": -8066941416937054000,
"line_mean": 25.0530973451,
"line_max": 56,
"alpha_frac": 0.437669837,
"autogenerated": false,
"ratio": 4.433734939759036,
"conf... |
__author__ = 'tonycastronova'
from unittest import TestCase
from hs_core.hydroshare import resource, get_resource_by_shortkey
from hs_core.hydroshare import users
from hs_core.models import GenericResource
from django.contrib.auth.models import User, Group
import datetime as dt
class TestCreateResource(TestCase):
... | {
"repo_name": "hydroshare/hydroshare_temp",
"path": "hs_core/tests/api/native/test_create_resource.py",
"copies": "1",
"size": "7022",
"license": "bsd-3-clause",
"hash": 2861076532739800000,
"line_mean": 49.884057971,
"line_max": 147,
"alpha_frac": 0.618199943,
"autogenerated": false,
"ratio": 4.... |
__author__ = 'tonycastronova'
import os, sys
from os.path import join, dirname, basename
import base
import translator
import xml.etree.ElementTree as et
from optparse import OptionParser
input_file = 'ODM2_DBWrench_Schema.xml'
use_schemas = True
default_schema = 'ODM2'
def parse_xml(input_file):
# parse the dbw... | {
"repo_name": "miguelcleon/ODM2",
"path": "src/build_schemas/build_ddl.py",
"copies": "2",
"size": "7733",
"license": "bsd-3-clause",
"hash": -5538598283714575000,
"line_mean": 33.9954751131,
"line_max": 149,
"alpha_frac": 0.5405405405,
"autogenerated": false,
"ratio": 3.7195767195767195,
"conf... |
__author__ = 'tonycastronova'
class Schema():
def __init__(self, name):
self.__name = name
self.__tables = []
def name(self):
return self.__name
def add_table(self, table):
self.__tables.append(table)
def get_tables(self):
return self.__tables
class Table():
... | {
"repo_name": "miguelcleon/ODM2",
"path": "src/build_schemas/base.py",
"copies": "2",
"size": "2729",
"license": "bsd-3-clause",
"hash": -644701477120063500,
"line_mean": 26.5656565657,
"line_max": 158,
"alpha_frac": 0.5404910224,
"autogenerated": false,
"ratio": 3.983941605839416,
"config_test... |
__author__ = 'tony'
__all__ = ['Trie', 'StringTrie', 'SortedTrie', 'SortedStringTrie', 'Node']
import sys
from copy import copy
from operator import itemgetter
from collections import MutableMapping
# Python 3 interoperability
PY3 = sys.version_info[0] == 3
if PY3:
def itervalues(d):
return d.values()
... | {
"repo_name": "Tony-Wang/YaYaNLP",
"path": "yaya/collection/trie.py",
"copies": "1",
"size": "12837",
"license": "apache-2.0",
"hash": 5301850574676164000,
"line_mean": 29.8581730769,
"line_max": 85,
"alpha_frac": 0.5574511179,
"autogenerated": false,
"ratio": 4.361875637104995,
"config_test": ... |
__author__ = 'Tony'
from TournamentService import *
from RPSGame import *
from Display import *
from BEPCPlayer import *
from CDJKPlayer import *
from DWPMPlayer import *
from GRTCPlayer import *
from GSACPlayer import *
from MMJRPlayer import *
from PBATPlayer import *
from VMPlayer import *
from SHJPPlayer import *
... | {
"repo_name": "geebzter/game-framework",
"path": "RPSDriver.py",
"copies": "1",
"size": "1164",
"license": "apache-2.0",
"hash": -8383235139441252000,
"line_mean": 21.8235294118,
"line_max": 110,
"alpha_frac": 0.6993127148,
"autogenerated": false,
"ratio": 3.548780487804878,
"config_test": fals... |
__author__ = 'tony petrov'
import threading
import numpy as np
from constants import *
import math
import time
import constants as c
def split_into(l, n):
'Splits the list into smaller lists with n elements each'
for i in xrange(0, len(l), n):
yield l[i:i + n]
def fit_in_range(min, max, x):
"""fi... | {
"repo_name": "2087829p/smores",
"path": "smores/utils.py",
"copies": "1",
"size": "5440",
"license": "mit",
"hash": -2165812484087281700,
"line_mean": 38.7153284672,
"line_max": 116,
"alpha_frac": 0.5472426471,
"autogenerated": false,
"ratio": 3.467176545570427,
"config_test": false,
"has_no... |
__author__ = 'tony petrov'
DEFAULT_SOCIAL_MEDIA_CYCLE = 3600 # 1 hour since most social media websites have a 1 hour timeout
# tasks
TASK_EXPLORE = 0
TASK_BULK_RETRIEVE = 1
TASK_FETCH_LISTS = 2
TASK_FETCH_USER = 3
TASK_UPDATE_WALL = 4
TASK_FETCH_STREAM = 5
TASK_GET_DASHBOARD = 6
TASK_GET_TAGGED = 7
TASK_GET_BLOG_POST... | {
"repo_name": "2087829p/smores",
"path": "smores/constants.py",
"copies": "1",
"size": "2885",
"license": "mit",
"hash": -691124533984096800,
"line_mean": 34.1829268293,
"line_max": 112,
"alpha_frac": 0.772270364,
"autogenerated": false,
"ratio": 2.8228962818003915,
"config_test": false,
"has... |
__author__ = 'tony petrov'
import os
import pickle
import time
import threading
import constants
from concurrent import futures
import Queue
def __abs_path__(fl):
curr_dir = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
abs_file_path = os.path.join(curr_dir, fl)
return abs_file_p... | {
"repo_name": "2087829p/smores",
"path": "smores/storage.py",
"copies": "1",
"size": "6795",
"license": "mit",
"hash": -608918296809650000,
"line_mean": 31.9854368932,
"line_max": 124,
"alpha_frac": 0.5804267844,
"autogenerated": false,
"ratio": 3.978337236533958,
"config_test": false,
"has_n... |
__author__ = 'tony petrov'
import threading
from handlers import TwitterStreamer
import copy
import time
from constants import *
import datetime
import copy
from twython import TwythonRateLimitError,TwythonError
class Minion(threading.Thread):
def __init__(self, task, lock, scheduler):
threading.Thread.... | {
"repo_name": "2087829p/smores",
"path": "smores/minion.py",
"copies": "1",
"size": "5971",
"license": "mit",
"hash": 8031586214901908000,
"line_mean": 43.2296296296,
"line_max": 161,
"alpha_frac": 0.5315692514,
"autogenerated": false,
"ratio": 4.210860366713681,
"config_test": false,
"has_no... |
__author__ = 'tony petrov'
# The following is an implementation of the algorithm proposed by McMinn A. J., Joemon Jose J. M. [DOI>10.1007/978-3-319-24027-5_6]
from storage import Filter
from nltk.tag import StanfordNERTagger
from math import *
from utils import *
from collections import Counter
from scheduler import S... | {
"repo_name": "2087829p/smores",
"path": "smores/tests.py",
"copies": "1",
"size": "11234",
"license": "mit",
"hash": 1008325038106426200,
"line_mean": 37.7379310345,
"line_max": 132,
"alpha_frac": 0.5455759302,
"autogenerated": false,
"ratio": 3.586845466155811,
"config_test": true,
"has_no_... |
__author__ = 'topcircler'
from google.appengine.api import search
from google.appengine.ext import ndb
from model.anno import Anno
from model.user import User
from model.base_model import BaseModel
from message.followup_message import FollowupMessage
from message.user_message import UserMessage
class FollowUp(BaseM... | {
"repo_name": "usersource/anno",
"path": "anno_gec_server/model/follow_up.py",
"copies": "1",
"size": "3207",
"license": "mpl-2.0",
"hash": 7401592604399635000,
"line_mean": 33.8586956522,
"line_max": 109,
"alpha_frac": 0.5793576551,
"autogenerated": false,
"ratio": 4.033962264150944,
"config_t... |
__author__ = 'topcircler'
from google.appengine.ext import ndb
from helper.utils_enum import PlatformType
class AppInfo(ndb.Model):
"""
This class represents a 3rd party app information.
"""
name = ndb.StringProperty(required=True)
lc_name = ndb.ComputedProperty(lambda self: self.name.lower())
... | {
"repo_name": "usersource/anno",
"path": "anno_gec_server/model/appinfo.py",
"copies": "1",
"size": "3631",
"license": "mpl-2.0",
"hash": 7264704784344223000,
"line_mean": 37.6276595745,
"line_max": 127,
"alpha_frac": 0.5866152575,
"autogenerated": false,
"ratio": 4.449754901960785,
"config_tes... |
__author__ = 'topcircler'
from google.appengine.ext import ndb
from model.anno import Anno
from model.base_model import BaseModel
from message.flag_message import FlagMessage
class Flag(BaseModel):
"""
Flag data model.
"""
anno_key = ndb.KeyProperty(kind=Anno)
last_modified = ndb.DateTimePropert... | {
"repo_name": "usersource/anno",
"path": "anno_gec_server/model/flag.py",
"copies": "1",
"size": "1519",
"license": "mpl-2.0",
"hash": 8557157365730159000,
"line_mean": 29.38,
"line_max": 96,
"alpha_frac": 0.6082949309,
"autogenerated": false,
"ratio": 3.6339712918660285,
"config_test": false,
... |
__author__ = 'topcircler'
from google.appengine.ext import ndb
from model.anno import Anno
from model.base_model import BaseModel
from message.followup_message import FollowupMessage
from message.user_message import UserMessage
class FollowUp(BaseModel):
"""
Follow up data model.
"""
comment = ndb.S... | {
"repo_name": "usersource/tasks",
"path": "tasks_phonegap/Tasks/plugins/io.usersource.anno/anno_gec_server/model/follow_up.py",
"copies": "1",
"size": "1072",
"license": "mpl-2.0",
"hash": -1939246083771023400,
"line_mean": 27.972972973,
"line_max": 70,
"alpha_frac": 0.6501865672,
"autogenerated": ... |
__author__ = 'topcircler'
from google.appengine.ext import ndb
from model.anno import Anno
from model.base_model import BaseModel
from message.vote_message import VoteMessage
class Vote(BaseModel):
"""
Vote data model.
"""
anno_key = ndb.KeyProperty(kind=Anno)
last_modified = ndb.DateTimeProper... | {
"repo_name": "usersource/anno",
"path": "anno_gec_server/model/vote.py",
"copies": "1",
"size": "1520",
"license": "mpl-2.0",
"hash": 5907291683618121000,
"line_mean": 28.8039215686,
"line_max": 96,
"alpha_frac": 0.6078947368,
"autogenerated": false,
"ratio": 3.543123543123543,
"config_test": ... |
__author__ = 'topcircler'
from protorpc import messages
from protorpc import message_types
class AppInfoMessage(messages.Message):
"""
ProtoRPC message definition to represent 3rd party app information.
"""
id = messages.IntegerField(1)
name = messages.StringField(2)
icon = messages.BytesField... | {
"repo_name": "usersource/anno",
"path": "anno_gec_server/message/appinfo_message.py",
"copies": "1",
"size": "1078",
"license": "mpl-2.0",
"hash": 1479814983251923500,
"line_mean": 32.6875,
"line_max": 71,
"alpha_frac": 0.7384044527,
"autogenerated": false,
"ratio": 3.8637992831541217,
"config... |
__author__ = 'topcircler'
import re
import endpoints
import httplib
import json
import logging
import base64
from model.user import User
def get_endpoints_current_user(raise_unauthorized=True):
"""Returns a current user and (optionally) causes an HTTP 401 if no user.
Args:
raise_unauthorized: Boolea... | {
"repo_name": "usersource/tasks",
"path": "tasks_phonegap/Tasks/plugins/io.usersource.anno/anno_gec_server/api/utils.py",
"copies": "2",
"size": "5319",
"license": "mpl-2.0",
"hash": 1719120151206160100,
"line_mean": 34.4666666667,
"line_max": 118,
"alpha_frac": 0.6679827035,
"autogenerated": false... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.