text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = 'Thales Menato'
__author__ = 'Daniel Nobusada'
from plot_graph import write_images
from load_graph import load_graph
from dijkstra import *
from write_simulation import write_simulation
import networkx as nx
import numpy as np
import datetime
data_path = '../data/'
data = {
'uk12':{'dist':data_path +... | {
"repo_name": "UFSCar-CS-011/graph-theory-2012-2",
"path": "tasks/task4/src/main.py",
"copies": "1",
"size": "7406",
"license": "mit",
"hash": -9121487058633729000,
"line_mean": 40.15,
"line_max": 101,
"alpha_frac": 0.565352417,
"autogenerated": false,
"ratio": 3.026563138536984,
"config_test":... |
__author__ = 'Thales Menato'
__author__ = 'Daniel Nobusada'
import networkx as nx
import matplotlib.pyplot as plt
import datetime
def plot_weighted_graph(G,
pos=None,
pi=None,
writeNodeLabel = False,
writeEdgeLabel = False... | {
"repo_name": "UFSCar-CS-011/graph-theory-2012-2",
"path": "tasks/task4/src/plot_graph.py",
"copies": "1",
"size": "13989",
"license": "mit",
"hash": 5807008935118862000,
"line_mean": 37.1198910082,
"line_max": 108,
"alpha_frac": 0.4646507971,
"autogenerated": false,
"ratio": 3.8718516468308883,
... |
__author__ = 'Thales Menato'
__author__ = 'Daniel Nobusada'
import numpy as np
import networkx as nx
def dijkstra(G, seed):
"""
Como referencia foram utilizadas as seguintes fontes:
Pseudo-codigo: https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm
codigo em Python por Andre Walker e Camilo ... | {
"repo_name": "UFSCar-CS-011/graph-theory-2012-2",
"path": "tasks/task4/src/dijkstra.py",
"copies": "1",
"size": "14112",
"license": "mit",
"hash": 7664490689974449000,
"line_mean": 73.2789473684,
"line_max": 120,
"alpha_frac": 0.5089994331,
"autogenerated": false,
"ratio": 2.631363043072907,
"... |
__author__ = 'Thales Menato'
__author__ = 'Daniel Nobusada'
import numpy as np
import networkx as nx
def load_graph(graph_path, label_path):
"""
Carrega os arquivos para simulacao na estrutura grafo do NetworkX
Parametros
----------
graph_path: string
Path para o arquivo contendo a ma... | {
"repo_name": "UFSCar-CS-011/graph-theory-2012-2",
"path": "tasks/task4/src/load_graph.py",
"copies": "1",
"size": "1239",
"license": "mit",
"hash": 7763341719450854000,
"line_mean": 24.2857142857,
"line_max": 73,
"alpha_frac": 0.6384180791,
"autogenerated": false,
"ratio": 3.1209068010075565,
... |
__author__ = 'Thales Menato'
import networkx as nx
import matplotlib.pyplot as plt
import os
import numpy as np
def plot_graph(G,
iterations=100,
node_size=1000,
node_color=(0.8, 0.6, 1),
font_size=9,
width=0.5,
img_name="defaul... | {
"repo_name": "UFSCar-CS-011/graph-theory-2012-2",
"path": "tasks/task1/src/plot_graph.py",
"copies": "1",
"size": "2066",
"license": "mit",
"hash": 1547860494596820700,
"line_mean": 29.8358208955,
"line_max": 115,
"alpha_frac": 0.5440464666,
"autogenerated": false,
"ratio": 3.5620689655172413,
... |
__author__ = 'Thales Menato'
import networkx
from plot_graph import plot_graph, plot_hist
import datetime
import numpy as np
def main():
nodes = [5, 20, 50, 100, 200]
p_list = [ i / 10.0 for i in range(0, 11)]
for n in nodes:
pos = None
for p in p_list:
# Grafo R gerado com n... | {
"repo_name": "UFSCar-CS-011/graph-theory-2012-2",
"path": "tasks/task1/src/main.py",
"copies": "1",
"size": "6558",
"license": "mit",
"hash": 2202750339772641000,
"line_mean": 41.0384615385,
"line_max": 101,
"alpha_frac": 0.3244891735,
"autogenerated": false,
"ratio": 4.598877980364656,
"confi... |
__author__ = 'Thales'
import datetime
def write_simulation(data, uk12=True, wg59=True, usair97=True):
uk12_data = ""
wg59_data = ""
usair97_data = ""
if uk12 is True:
# Gera relatorio para grafo UK12
uk12_data += \
"Grafo UK12:\n" \
"\na) Sementes utilizadas: "... | {
"repo_name": "UFSCar-CS-011/graph-theory-2012-2",
"path": "tasks/task4/src/write_simulation.py",
"copies": "1",
"size": "6033",
"license": "mit",
"hash": -3666160219287313400,
"line_mean": 45.4153846154,
"line_max": 117,
"alpha_frac": 0.4520139234,
"autogenerated": false,
"ratio": 3.011982026959... |
from __future__ import print_function
import numpy as np
import sys
from heapq import heappush as push, heappop as pop
#FIXME: normalize data
def l1_measure(pt1, pt2):
assert len(pt1) == len(pt2)
return np.sum(np.absolute(pt1 - pt2))
def l2_measure(pt1, pt2):
assert len(pt1) == len(pt2)
return np.sqr... | {
"repo_name": "thammegowda/notes",
"path": "usc-csci-ml/hw1/src/knn_classify.py",
"copies": "2",
"size": "3050",
"license": "apache-2.0",
"hash": 5021077010900289000,
"line_mean": 33.6590909091,
"line_max": 87,
"alpha_frac": 0.562295082,
"autogenerated": false,
"ratio": 2.9326923076923075,
"con... |
from argparse import ArgumentParser
import copy
class Statement(object): # just a parent class
pass
class AtomicStatement(Statement):
def __init__(self, name, args):
self.args = args
self.name = name
def substitute(self, vals):
for idx, arg in enumerate(self.args):
i... | {
"repo_name": "thammegowda/algos",
"path": "ai/inference/hw2cs561s16.py",
"copies": "2",
"size": "8129",
"license": "apache-2.0",
"hash": -5168612920333713000,
"line_mean": 33.0125523013,
"line_max": 111,
"alpha_frac": 0.5381965801,
"autogenerated": false,
"ratio": 3.843498817966903,
"config_te... |
__author__ = 'Thamme Gowda tgowdan@gmail.com'
__date__ = "September 20, 2015"
from notes.util.arrays import format_2d_array
import sys
import numpy as np
def __backtrace_alignment(matrix, i, j, alignments):
"""
recursively back traces alignment of strings from given position (i,j) using edit distance matrix
... | {
"repo_name": "thammegowda/notes",
"path": "text/edit_distance.py",
"copies": "2",
"size": "5663",
"license": "apache-2.0",
"hash": -5957326502741150000,
"line_mean": 35.3012820513,
"line_max": 103,
"alpha_frac": 0.5846724351,
"autogenerated": false,
"ratio": 3.5086741016109046,
"config_test": ... |
__author__ = 'Tharun'
import MySQLdb as MS
import os
#contains all the unzipped stackexchange folders with their xml dumps
root_path = 'F:\Code\Python\ResearchAide\StackExchange\Test'
#Gets all immediate sub directories under root
sites = [name for name in os.listdir(root_path) if os.path.isdir(os.path.join(root_pa... | {
"repo_name": "tgomudur/Stackexchange-XML-Dump-Importer",
"path": "xml2sql.py",
"copies": "1",
"size": "1522",
"license": "mit",
"hash": 7649154731895455000,
"line_mean": 32.0869565217,
"line_max": 108,
"alpha_frac": 0.6386333771,
"autogenerated": false,
"ratio": 3.922680412371134,
"config_test... |
__author__ = 'thatcher'
from django.contrib import admin
# from django.contrib.auth.models import User
# from django.contrib.auth.admin import UserAdmin
# from django.contrib.sessions.
from django.contrib.sessions.models import Session
from .models import *
from base.forms import *
def images_thubmnail(self):
ret... | {
"repo_name": "ZmG/trywsk",
"path": "base/admin.py",
"copies": "1",
"size": "1654",
"license": "apache-2.0",
"hash": -6469168215432475000,
"line_mean": 28.5357142857,
"line_max": 103,
"alpha_frac": 0.7237001209,
"autogenerated": false,
"ratio": 3.4173553719008263,
"config_test": false,
"has_n... |
__author__ = 'thatcher'
from django import template
from django.core.urlresolvers import reverse
import re
register = template.Library()
@register.simple_tag
def navactive(request, path, reverse_args=None):
"""
Navactive expects two or three arguments.
if there are two arguments, the second argument is e... | {
"repo_name": "ZmG/trywsk",
"path": "base/templatetags/navactive.py",
"copies": "1",
"size": "2163",
"license": "apache-2.0",
"hash": -3703671694506878500,
"line_mean": 26.0375,
"line_max": 114,
"alpha_frac": 0.5852981969,
"autogenerated": false,
"ratio": 4.088846880907372,
"config_test": false... |
__author__ = 'thauser'
from argh import arg
from six import iteritems
import logging
from pnc_cli import swagger_client
from pnc_cli import utils
import pnc_cli.cli_types as types
from pnc_cli.pnc_api import pnc_api
@arg("-p", "--page-size", help="Limit the amount of builds returned")
@arg("--page-index", help="Sele... | {
"repo_name": "project-ncl/pnc-cli",
"path": "pnc_cli/builds.py",
"copies": "2",
"size": "1259",
"license": "apache-2.0",
"hash": 4350210631277940700,
"line_mean": 29.7317073171,
"line_max": 132,
"alpha_frac": 0.6759332804,
"autogenerated": false,
"ratio": 3.2786458333333335,
"config_test": fal... |
__author__ = 'thauser'
from mock import patch, MagicMock
from pnc_cli import productreleases
from pnc_cli.swagger_client.models import ProductReleaseRest
def test_create_product_release_object():
compare = ProductReleaseRest()
compare.version = '1.0.1.DR1'
compare.support_level = 'EOL'
result = produc... | {
"repo_name": "jianajavier/pnc-cli",
"path": "test/unit/test_productreleases.py",
"copies": "1",
"size": "4762",
"license": "apache-2.0",
"hash": -6800023379168911000,
"line_mean": 46.62,
"line_max": 110,
"alpha_frac": 0.6751364973,
"autogenerated": false,
"ratio": 3.6490421455938695,
"config_t... |
__author__ = 'thawes'
from com.inin.purecloud.devops.util import AuthToken
from com.amazonaws.services.dynamodbv2 import AmazonDynamoDBClient
from com.amazonaws.services.dynamodbv2.model import DescribeTableRequest
from com.amazonaws.services.dynamodbv2.model import ProvisionedThroughput
from re import match
from math... | {
"repo_name": "timotheosh/DynamoDbBackup",
"path": "src/main/resources/Lib/DynamoDB/DynamoDbFunctions.py",
"copies": "1",
"size": "2759",
"license": "apache-2.0",
"hash": -7194223971621810000,
"line_mean": 35.7866666667,
"line_max": 80,
"alpha_frac": 0.5878941646,
"autogenerated": false,
"ratio":... |
__author__ = 'thawes'
from com.inin.purecloud.devops.util import Conversions, AuthToken
from com.amazonaws.services.s3 import AmazonS3Client
from com.amazonaws.services.s3.model import PutObjectRequest
from com.amazonaws.services.s3.model import ObjectMetadata, AmazonS3Exception
from datetime import datetime
from json... | {
"repo_name": "timotheosh/DynamoDbBackup",
"path": "src/main/resources/Lib/S3Storage/S3Functions.py",
"copies": "1",
"size": "2006",
"license": "apache-2.0",
"hash": 1089721419495167200,
"line_mean": 37.5769230769,
"line_max": 77,
"alpha_frac": 0.5977068794,
"autogenerated": false,
"ratio": 3.996... |
__author__ = 'thawes'
from com.inin.purecloud.devops.util import Conversions
from org.rythmengine import RythmEngine
class HiveGeneration:
def __init__(self, tables, s3BucketName, s3path, readPercent):
"""
Returns a string containing the Hive script to be executed on the list
of tables, in... | {
"repo_name": "timotheosh/DynamoDbBackup",
"path": "src/main/resources/Lib/HiveGeneration/HiveGeneration.py",
"copies": "1",
"size": "1916",
"license": "apache-2.0",
"hash": 293596937988291000,
"line_mean": 35.8653846154,
"line_max": 92,
"alpha_frac": 0.617954071,
"autogenerated": false,
"ratio":... |
__author__ = 'thawes'
from DynamoDB import DynamoDbFunctions
class PreBackup:
"""
Class for preparing backing up DynamoDB Tables by an EMR instance.
This does not actually do the back up process. It initializes the DynamoDb
tables, increasing the read throughputs in preparation of backing up the
t... | {
"repo_name": "timotheosh/DynamoDbBackup",
"path": "src/main/resources/Lib/DynamoDbBackup/PreBackup.py",
"copies": "1",
"size": "1101",
"license": "apache-2.0",
"hash": -2491531944343171600,
"line_mean": 30.4571428571,
"line_max": 78,
"alpha_frac": 0.6394187103,
"autogenerated": false,
"ratio": 4... |
__author__ = '@thebongy (Rishit Bansal) <rishit.bansal0@gmail.com>'
__license__ = 'MIT'
__status__ = 'Development'
import subprocess,os,sys
from docx import Document
from docx.shared import Pt,Inches
from docx.enum.text import WD_ALIGN_PARAGRAPH,WD_UNDERLINE
FONT = 'Courier New'
SIZE = Pt(11)
TOP = Inches(0.5)
BOTTOM... | {
"repo_name": "thebongy/MakeMyOutputs",
"path": "main.py",
"copies": "1",
"size": "4021",
"license": "mit",
"hash": -4631997477699872000,
"line_mean": 27.7214285714,
"line_max": 102,
"alpha_frac": 0.6294454116,
"autogenerated": false,
"ratio": 3.3676716917922946,
"config_test": false,
"has_no... |
__author__ = 'the-kid89'
"""
A sample program that uses multiple intents and disambiguates by
intent confidence
try with the following:
PYTHONPATH=. python examples/multi_intent_parser.py "what's the weather like in tokyo"
PYTHONPATH=. python examples/multi_intent_parser.py "play some music by the clash"
"""
import js... | {
"repo_name": "MycroftAI/adapt",
"path": "examples/multi_domain_intent_parser.py",
"copies": "1",
"size": "2084",
"license": "apache-2.0",
"hash": -8441741423562454000,
"line_mean": 20.0505050505,
"line_max": 86,
"alpha_frac": 0.6799424184,
"autogenerated": false,
"ratio": 3.2870662460567823,
"... |
__author__ = 'thgoette'
from BasicTest import BasicTest, wait
import unittest
import twisted.internet.defer as defer
class PubSubComplexKeywords(BasicTest):
@wait
def test_CallWithStar(self):
print "Starting Test with Mixed Parameters"
d = defer.Deferred()
def callback(tag, resul... | {
"repo_name": "CN-UPB/OpenBarista",
"path": "utils/decaf-utils-rpc/tests/unittests/PubSubComplexKeyword.py",
"copies": "1",
"size": "1297",
"license": "mpl-2.0",
"hash": 7955324982874851000,
"line_mean": 22.5818181818,
"line_max": 74,
"alpha_frac": 0.5805705474,
"autogenerated": false,
"ratio": 3... |
__author__ = 'thgoette'
import decaf_utils_rpc.rpc_layer as rpc
import time
import decaf_utils_rpc.sync_result
import twisted.internet.defer
import threading
def echo(x):
#print threading.currentThread()
return x
def echo1(x, foo='bar'):
#print threading.currentThread()
return x, foo
@twisted.i... | {
"repo_name": "CN-UPB/OpenBarista",
"path": "utils/decaf-utils-rpc/tests/rpc_layer_test.py",
"copies": "1",
"size": "1898",
"license": "mpl-2.0",
"hash": -1686123307430531600,
"line_mean": 19.8681318681,
"line_max": 82,
"alpha_frac": 0.6290832455,
"autogenerated": false,
"ratio": 2.93353941267387... |
__author__ = 'thgoette'
import unittest
import decaf_utils_rpc.rpc_layer as rpc
import time
import twisted.internet.defer as defer
import threading
class RpcLayerBasicTests(unittest.TestCase):
def setUp(self):
def unnamed(x):
return x
def mixed(x, foo='bar'):
return x,f... | {
"repo_name": "CN-UPB/OpenBarista",
"path": "utils/decaf-utils-rpc/tests/rpc_tests.py",
"copies": "1",
"size": "2854",
"license": "mpl-2.0",
"hash": 4365468241186841600,
"line_mean": 24.7117117117,
"line_max": 67,
"alpha_frac": 0.5728801682,
"autogenerated": false,
"ratio": 3.931129476584022,
"... |
__author__ = 'thiago'
import sys
def search(n, item_list, instances, files, tholds):
f = open(files[n], "r")
if n == 1:
for line in f:
split = line.split()
if len(split) == 4 and int(split[0]) <= instances:
if int(split[3]) < tholds[n]:
# Ad... | {
"repo_name": "thiagorcdl/ANIDS",
"path": "trab/cascade.py",
"copies": "2",
"size": "1689",
"license": "mit",
"hash": -7132217846756243000,
"line_mean": 30.8867924528,
"line_max": 88,
"alpha_frac": 0.5014801658,
"autogenerated": false,
"ratio": 3.6167023554603857,
"config_test": false,
"has_n... |
__author__ = 'Thibaut Royer'
from .. import app
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy import create_engine, orm, inspect
from flask_sqlalchemy_session import flask_scoped_session
# Handling relationships naming conventions
def _name_for_coll... | {
"repo_name": "Obero/custom_sqla_init",
"path": "__init__.py",
"copies": "2",
"size": "4108",
"license": "bsd-2-clause",
"hash": -5855565388990072000,
"line_mean": 32.813559322,
"line_max": 100,
"alpha_frac": 0.5535540409,
"autogenerated": false,
"ratio": 4.465217391304348,
"config_test": false... |
from pox.lib.revent import *
from pox.core import core
import pox.openflow.libopenflow_01 as of
import pox.lib.packet as pkt
from pox.lib.addresses import IPAddr
import pox.lib.packet.dns as pkt_dns
import time
import threading
log = core.getLogger()
class DNSUpdateNotification(Event):
def __init__(self, ite... | {
"repo_name": "pthien92/sdn",
"path": "ext/dns_firewall.py",
"copies": "1",
"size": "8221",
"license": "apache-2.0",
"hash": -5720296007336771000,
"line_mean": 34.5887445887,
"line_max": 108,
"alpha_frac": 0.5551636054,
"autogenerated": false,
"ratio": 4.000486618004866,
"config_test": false,
... |
from pox.core import core
from pox.lib.packet.ethernet import ethernet, ETHER_BROADCAST
from pox.lib.packet.arp import arp
import pox.lib.packet as pkt
from pox.lib.addresses import EthAddr, IPAddr
from pox.lib.util import dpid_to_str, str_to_bool
from pox.lib.revent import *
import pox.openflow.libopenflow_01 as of
... | {
"repo_name": "pthien92/sdn",
"path": "ext/sdn.py",
"copies": "1",
"size": "22705",
"license": "apache-2.0",
"hash": 970409444174641400,
"line_mean": 37.7457337884,
"line_max": 124,
"alpha_frac": 0.5806650518,
"autogenerated": false,
"ratio": 3.781015820149875,
"config_test": false,
"has_no_k... |
__author__ = 'Thierry Schellenbach'
__copyright__ = 'Copyright 2010, Thierry Schellenbach'
__credits__ = ['Thierry Schellenbach, mellowmorning.com, @tschellenbach']
__license__ = 'BSD'
__version__ = '5.0.2prealpha'
__maintainer__ = 'Thierry Schellenbach'
__email__ = 'thierryschellenbach@gmail.com'
__status__... | {
"repo_name": "fogcitymarathoner/djfb",
"path": "facebook_example/django_facebook/__init__.py",
"copies": "2",
"size": "1124",
"license": "bsd-3-clause",
"hash": 5575434047986589000,
"line_mean": 27.5789473684,
"line_max": 81,
"alpha_frac": 0.7144128114,
"autogenerated": false,
"ratio": 3.3254437... |
__author__ = 'Thinesh'
from app.subsystem.courses.course import Course
import json
import logging
import django.core.exceptions
from django.core.management.base import BaseCommand, CommandError
logger = logging.getLogger(__name__)
class Command(BaseCommand):
help = 'Runs scrapper to populate DataBase'
def ... | {
"repo_name": "foxtrot94/EchelonPlanner",
"path": "src/app/management/commands/populateprereq.py",
"copies": "1",
"size": "1130",
"license": "mit",
"hash": -4749698217820902000,
"line_mean": 30.4166666667,
"line_max": 95,
"alpha_frac": 0.5451327434,
"autogenerated": false,
"ratio": 4.296577946768... |
__author__ = 'Thinesh'
from bs4 import BeautifulSoup;
import sqlite3;
import json;
import urllib.request
import urllib.error
import re
# Needed to convert names with accents to normal
from unidecode import unidecode
# This file scrapes descriptions, as well as hatchTime catchRate and gender ratios
# TOD... | {
"repo_name": "foxtrot94/ECE-Pokedex",
"path": "Scrapper/scrapper_description.py",
"copies": "1",
"size": "8453",
"license": "mit",
"hash": 6506178010587269000,
"line_mean": 37.125,
"line_max": 222,
"alpha_frac": 0.661933499,
"autogenerated": false,
"ratio": 3.422843256379101,
"config_test": fa... |
__author__ = 'Thinesh'
# Run this after the pokemon_unique_info table is complete, and the pokemon_suffix table is compelete
# IN other words, run after scrapper_pokemon.py AND scraper_SuffixFixer.py
# This file uses both the info contained in the JSON file with evolutions
# and information from serebii to fill... | {
"repo_name": "foxtrot94/ECE-Pokedex",
"path": "Scrapper/scraper_evolutions.py",
"copies": "1",
"size": "8858",
"license": "mit",
"hash": 4559866132456373000,
"line_mean": 44.1354166667,
"line_max": 132,
"alpha_frac": 0.5618649808,
"autogenerated": false,
"ratio": 4.308365758754864,
"config_tes... |
__author__ = 'Thinesh'
# Run this after the pokemon_unique_info table is complete, and the pokemon_suffix table is compelete
# pokemon_common_info table also needs to be complete
# IN other words, run after scrapper_pokemon.py AND scraper_SuffixFixer.py AND scrapper_description.py
# Script uses Bulbapedia's Bre... | {
"repo_name": "foxtrot94/ECE-Pokedex",
"path": "Scrapper/scraper_eggGroups.py",
"copies": "1",
"size": "5543",
"license": "mit",
"hash": -4733216183024501000,
"line_mean": 41.6299212598,
"line_max": 210,
"alpha_frac": 0.7081754196,
"autogenerated": false,
"ratio": 3.3541162227602905,
"config_te... |
__author__ = 'Thinesh'
# Run this after the pokemon_unique_info table is complete, and the pokemon_suffix table is partially compelete
# IN other words, run after scrapper_pokemon.py
# This file, goes through pokemon_unique_info, and finds all instance of a pokemon with a dash(-) in its name
# The pokemon returne... | {
"repo_name": "foxtrot94/ECE-Pokedex",
"path": "Scrapper/scraper_SuffixFixer.py",
"copies": "1",
"size": "3165",
"license": "mit",
"hash": -7353750917183764000,
"line_mean": 41.9583333333,
"line_max": 118,
"alpha_frac": 0.7001579779,
"autogenerated": false,
"ratio": 3.785885167464115,
"config_t... |
__author__ = 'think'
from time import ctime
from tkinter import *
import socket
import threading
import sys
class DNCclitGUI(object):
def __init__(self):
self.top=Tk()
self.top.title('Dog is Not a Chat client')
#creer le socket
self.ChatClitSock=socket.socket(socket.AF_INET,socket.... | {
"repo_name": "geoff11/dnc",
"path": "client.py",
"copies": "1",
"size": "3398",
"license": "mit",
"hash": 7842044306659830000,
"line_mean": 31.0566037736,
"line_max": 133,
"alpha_frac": 0.5971159506,
"autogenerated": false,
"ratio": 3.4185110663983904,
"config_test": false,
"has_no_keywords"... |
__author__ = 'third'
from matplotlib import pyplot as plt
from matplotlib import animation
import numpy as np
from Boids.flock import Flock
class Boids(object):
def __init__(self, flock, positions, velocities):
self.flock = flock
self.positions = positions
self.velocities = velocities
... | {
"repo_name": "ucaptmh/Boids",
"path": "Boids/boids.py",
"copies": "1",
"size": "2672",
"license": "mit",
"hash": -6649186566217733000,
"line_mean": 42.8196721311,
"line_max": 128,
"alpha_frac": 0.6571856287,
"autogenerated": false,
"ratio": 3.543766578249337,
"config_test": false,
"has_no_ke... |
__author__ = 'third'
import numpy as np
class Flock(object):
def __init__(self,
flock_size=50,
formation_flying_distance=100,
formation_flying_strength=0.125,
alert_distance=10,
attraction_strength=0.01,
axes_min... | {
"repo_name": "ucaptmh/Boids",
"path": "Boids/flock.py",
"copies": "1",
"size": "1914",
"license": "mit",
"hash": 3547707635595289000,
"line_mean": 40.6304347826,
"line_max": 74,
"alpha_frac": 0.5809822362,
"autogenerated": false,
"ratio": 3.9545454545454546,
"config_test": false,
"has_no_key... |
import sys
import time
from KMCLib.Backend.Backend import MPICommons
from KMCLib.Utilities.Trajectory.Trajectory import Trajectory
class CFGTrajectory(Trajectory):
#Class for handling cfg IO to a trajectory file.
def __init__(self,
trajectory_filename,
configuratio... | {
"repo_name": "txd283/FeCu-Irradiation-KMCLib",
"path": "KMCLib/Utilities/Trajectory/CFGTrajectory.py",
"copies": "1",
"size": "5968",
"license": "mit",
"hash": 6575751690988509000,
"line_mean": 39.5986394558,
"line_max": 106,
"alpha_frac": 0.4607908847,
"autogenerated": false,
"ratio": 4.3090252... |
from KMCLib import *
import math
# required to set up processes, however will be overridded with the customRateCalculator.py
rate = 1.0
#if diffusion is sucessful, swap vacacny (0) with Fe (1)
before_Va_Fe = ['0', '1']
after_Va_Fe = ['1', '0']
#if diffusion is sucessful, swap vacacny (0) with Cu (0.1)
before_Va_Cu... | {
"repo_name": "txd283/FeCu-Irradiation-KMCLib",
"path": "processes.py",
"copies": "1",
"size": "20797",
"license": "mit",
"hash": 6844423111180689000,
"line_mean": 44.5098468271,
"line_max": 104,
"alpha_frac": 0.4702601337,
"autogenerated": false,
"ratio": 4.750342622201918,
"config_test": fals... |
#Calculates the repetitons based on the number of atoms
repetitions = (len(sites)/2)**(1/3.0)
i = 0
# loop for the number of steps (called i).
print ("Converting the lattice trajectory to cluster.<steps>.txt files for clusterCalculator.")
for steps in range(len(steps)):
n_atoms = len(sites)
print("Total numbe... | {
"repo_name": "txd283/FeCu-Irradiation-KMCLib",
"path": "UsefulCode/convertToCluster.py",
"copies": "1",
"size": "1690",
"license": "mit",
"hash": 2101742894978141400,
"line_mean": 39.2619047619,
"line_max": 95,
"alpha_frac": 0.6266272189,
"autogenerated": false,
"ratio": 3.393574297188755,
"co... |
import os
import sys
import csv
import json
import matplotlib
matplotlib.use("Agg", warn=False)
import matplotlib.pyplot as plt
from npsgd.standalone_task import StandaloneTask
from npsgd.model_parameters import *
import abmu_c
class ABMB(abmu_c.ABMU):
short_name = 'abmb_c'
full_name = 'ABM-B'
subtitle... | {
"repo_name": "cosbynator/NPSGD",
"path": "models/abmb_c.py",
"copies": "1",
"size": "9295",
"license": "bsd-3-clause",
"hash": 3372744025519681500,
"line_mean": 55.3333333333,
"line_max": 169,
"alpha_frac": 0.6560516407,
"autogenerated": false,
"ratio": 3.9252533783783785,
"config_test": false... |
"""Model (plug-in) loader with versioning support."""
import os
import sys
import imp
import glob
import hashlib
import inspect
import logging
import threading
from npsgd.config import config
from model_task import ModelTask
class InvalidModelError(RuntimeError): pass
class ModelManager(object):
"""Object for keep... | {
"repo_name": "cosbynator/NPSGD",
"path": "npsgd/model_manager.py",
"copies": "1",
"size": "5115",
"license": "bsd-3-clause",
"hash": 5346892088031418000,
"line_mean": 33.5608108108,
"line_max": 100,
"alpha_frac": 0.6275659824,
"autogenerated": false,
"ratio": 4.241293532338308,
"config_test": ... |
"""Module containing abstract base class for standalone models."""
import os
import logging
import subprocess
from model_task import ModelTask
from config import config
class StandaloneError(RuntimeError): pass
class StandaloneTask(ModelTask):
"""Abstract base task for standalone models.
This class is meant t... | {
"repo_name": "cosbynator/NPSGD",
"path": "npsgd/standalone_task.py",
"copies": "1",
"size": "1821",
"license": "bsd-3-clause",
"hash": -1266646968319430100,
"line_mean": 34.7058823529,
"line_max": 96,
"alpha_frac": 0.6600768808,
"autogenerated": false,
"ratio": 4.441463414634146,
"config_test"... |
"""Module containing any functions that are useful for templates."""
def pretty_forward_time_delta(diff):
day_diff = diff.days
second_diff = diff.seconds
if day_diff < 0:
return ''
if day_diff == 0:
if second_diff < 10:
return "just now"
if second_diff < 60:
... | {
"repo_name": "cosbynator/NPSGD",
"path": "npsgd/text_helpers.py",
"copies": "1",
"size": "1047",
"license": "bsd-3-clause",
"hash": 1076406287629981600,
"line_mean": 28.9142857143,
"line_max": 68,
"alpha_frac": 0.5558739255,
"autogenerated": false,
"ratio": 3.561224489795918,
"config_test": fa... |
"""Module containing a 'task queue' for the queue daemon."""
import os
import sys
import time
import logging
import threading
class TaskQueueException(RuntimeError): pass
class TaskQueue(object):
"""Main queue object (thread safe).
Contains two internal queues: one for actually holding requests, and one
... | {
"repo_name": "cosbynator/NPSGD",
"path": "npsgd/task_queue.py",
"copies": "1",
"size": "3644",
"license": "bsd-3-clause",
"hash": -4224087711488804000,
"line_mean": 33.3773584906,
"line_max": 98,
"alpha_frac": 0.6133369923,
"autogenerated": false,
"ratio": 4.276995305164319,
"config_test": fal... |
"""Module containing the main superclass for all models."""
import os
import sys
import uuid
import random
import string
import logging
import subprocess
from email_manager import Email
import shutil
from config import config
class LatexError(RuntimeError): pass
class ModelTask(object):
"""Abstract base class for... | {
"repo_name": "cosbynator/NPSGD",
"path": "npsgd/model_task.py",
"copies": "1",
"size": "6866",
"license": "bsd-3-clause",
"hash": 4635827684957961000,
"line_mean": 35.5212765957,
"line_max": 114,
"alpha_frac": 0.6245266531,
"autogenerated": false,
"ratio": 4.288569643972517,
"config_test": tru... |
"""Module holding all types of model parameters."""
import copy
import logging
class ValidationError(RuntimeError): pass
class MissingError(RuntimeError): pass
class ModelParameter(object):
"""Model parameter - keeps track of arguments to a model.
This object has a dual purpose, first to declare the paramete... | {
"repo_name": "cosbynator/NPSGD",
"path": "npsgd/model_parameters.py",
"copies": "1",
"size": "15464",
"license": "bsd-3-clause",
"hash": -1663300194931377700,
"line_mean": 33.6726457399,
"line_max": 189,
"alpha_frac": 0.5528323849,
"autogenerated": false,
"ratio": 3.9722578987927046,
"config_t... |
"""Module used within the queue daemon for keeping track of confirmation codes."""
import random
import string
import logging
import threading
from datetime import datetime
from config import config
class ConfirmationEntry(object):
def __init__(self, request):
self.timestamp = datetime.now()
self.... | {
"repo_name": "cosbynator/NPSGD",
"path": "npsgd/confirmation_map.py",
"copies": "1",
"size": "2412",
"license": "bsd-3-clause",
"hash": -1290928385274735000,
"line_mean": 32.9718309859,
"line_max": 84,
"alpha_frac": 0.6310116086,
"autogenerated": false,
"ratio": 4.307142857142857,
"config_test... |
"""Module containing classes relating to Matlab modelling tasks."""
import os
import logging
import subprocess
from model_task import ModelTask
from config import config
class MatlabError(RuntimeError): pass
class MatlabTask(ModelTask):
"""Abstract base matlab task.
This class is meant to be the superclass o... | {
"repo_name": "cosbynator/NPSGD",
"path": "npsgd/matlab_task.py",
"copies": "1",
"size": "1593",
"license": "bsd-3-clause",
"hash": -5125638103272205000,
"line_mean": 36.9285714286,
"line_max": 94,
"alpha_frac": 0.6748273697,
"autogenerated": false,
"ratio": 3.7570754716981134,
"config_test": f... |
__author__ = 'Thomas Heavey'
import re
filename = "testg.out"
def findallgeoms(filename):
"""A function that takes a file name and returns a list of
geometries. Works with Gaussian output, haven't checked with
Q-Chem."""
relevantelem = [1,3,4,5]
xyzformat = '{:>2} {: f} {: f} {: f}'
... | {
"repo_name": "thompcinnamon/QM-calc-scripts",
"path": "gautools/geomRegex.py",
"copies": "1",
"size": "2092",
"license": "apache-2.0",
"hash": -5933269434866634000,
"line_mean": 38.4716981132,
"line_max": 74,
"alpha_frac": 0.5592734226,
"autogenerated": false,
"ratio": 3.7357142857142858,
"con... |
__author__ = 'thomas'
from jinja2 import nodes
from jinja2.ext import Extension
import inspect
import os
class PropertyDetails(object):
def __init__(self, name, template=None, css_classes="", label=None, include=None, exclude=None):
self.name = name
self.template = template
self.css_class... | {
"repo_name": "PhantomPayne/jinjitsu",
"path": "jinjitsu/display-old.py",
"copies": "1",
"size": "7271",
"license": "bsd-3-clause",
"hash": 8251726495844490000,
"line_mean": 37.4761904762,
"line_max": 119,
"alpha_frac": 0.6314124605,
"autogenerated": false,
"ratio": 4.181138585393905,
"config_t... |
__author__ = 'thomas'
from jinja2 import nodes
from jinja2.ext import Extension
import inspect
class Property(object):
def __init__(self, type=None, template=None, css_classes="", label=None):
self.type = type
self.template = template
self.css_classes = css_classes
self.label = la... | {
"repo_name": "PhantomPayne/jinjitsu",
"path": "jinjitsu/display.py",
"copies": "1",
"size": "8957",
"license": "bsd-3-clause",
"hash": -7688660752134149000,
"line_mean": 34.2677165354,
"line_max": 123,
"alpha_frac": 0.6273305794,
"autogenerated": false,
"ratio": 4.09743824336688,
"config_test"... |
__author__ = "Thomas Perkov"
__license__ = 'MIT'
# -------------------------------------------------------------------------------------------------------------------- #
# IMPORTS
# Modules:
from sshtunnel import SSHTunnelForwarder
import mongoengine
import typing
from delphin_6_automation.logging.ribuild_logger impo... | {
"repo_name": "thp44/delphin_6_automation",
"path": "delphin_6_automation/database_interactions/mongo_setup.py",
"copies": "1",
"size": "1731",
"license": "mit",
"hash": -3095063755587534000,
"line_mean": 26.9193548387,
"line_max": 120,
"alpha_frac": 0.5158867707,
"autogenerated": false,
"ratio":... |
__author__ = "Thomas Perkov"
__license__ = 'MIT'
# -------------------------------------------------------------------------------------------------------------------- #
# IMPORTS
# Modules:
import os
import codecs
import re
import datetime
# RiBuild Modules:
from delphin_6_automation.logging.ribuild_logger import r... | {
"repo_name": "thp44/delphin_6_automation",
"path": "delphin_6_automation/file_parsing/material_parser.py",
"copies": "1",
"size": "12951",
"license": "mit",
"hash": 6242241949235887000,
"line_mean": 35.1759776536,
"line_max": 120,
"alpha_frac": 0.4432862327,
"autogenerated": false,
"ratio": 3.83... |
__author__ = 'Thomas Rueckstiess and Tom Schaul'
from pybrain.rl.environments.cartpole.nonmarkovpole import NonMarkovPoleEnvironment
from pybrain.rl.tasks import EpisodicTask
from cartpole import CartPoleEnvironment
from scipy import pi, dot, array
class BalanceTask(EpisodicTask):
""" The task of balancing some ... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/environments/cartpole/balancetask.py",
"copies": "1",
"size": "4061",
"license": "bsd-3-clause",
"hash": 1793331633410718700,
"line_mean": 32.8416666667,
"line_max": 91,
"alpha_frac": 0.5582368875,
"autogenerated": false,
"ratio": 3.629133... |
__author__ = 'Thomas Rueckstiess and Tom Schaul'
from scipy import pi, dot, array
from pybrain.rl.environments.cartpole.nonmarkovpole import NonMarkovPoleEnvironment
from pybrain.rl.environments import EpisodicTask
from cartpole import CartPoleEnvironment
class BalanceTask(EpisodicTask):
""" The task of balanci... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/rl/environments/cartpole/balancetask.py",
"copies": "3",
"size": "5824",
"license": "mit",
"hash": 3611364401861048000,
"line_mean": 30.825136612,
"line_max": 90,
"alpha_frac": 0.5530563187,
"autogenerated": false,
... |
__author__ = 'Thomas Rueckstiess and Tom Schaul'
from scipy import pi, dot, array, ones, exp
from scipy.linalg import norm
from pybrain.rl.environments.cartpole.nonmarkovpole import NonMarkovPoleEnvironment
from pybrain.rl.environments.cartpole.doublepole import DoublePoleEnvironment
from pybrain.rl.environments impo... | {
"repo_name": "yonglehou/pybrain",
"path": "pybrain/rl/environments/cartpole/balancetask.py",
"copies": "25",
"size": "8177",
"license": "bsd-3-clause",
"hash": 6683669190011696000,
"line_mean": 30.94140625,
"line_max": 90,
"alpha_frac": 0.5777179895,
"autogenerated": false,
"ratio": 3.6117491166... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
# $Id$
from scipy import ravel, r_
from random import sample
from supervised import SupervisedDataSet
class EmptySequenceError(Exception): pass
class SequentialDataSet(SupervisedDataSet):
"""A SequentialDataSet is like a SupervisedDataSet except that it ca... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/datasets/sequential.py",
"copies": "1",
"size": "9086",
"license": "bsd-3-clause",
"hash": 7754422782282451000,
"line_mean": 42.0616113744,
"line_max": 130,
"alpha_frac": 0.6026854501,
"autogenerated": false,
"ratio": 4.502477700693756,
"co... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
# $Id$
from scipy import ravel, r_
from random import sample
from pybrain.datasets.supervised import SupervisedDataSet
class EmptySequenceError(Exception): pass
class SequentialDataSet(SupervisedDataSet):
"""A SequentialDataSet is like a SupervisedDataSet... | {
"repo_name": "pybrain2/pybrain2",
"path": "pybrain/datasets/sequential.py",
"copies": "2",
"size": "8788",
"license": "bsd-3-clause",
"hash": 5117509737947306000,
"line_mean": 40.4528301887,
"line_max": 124,
"alpha_frac": 0.6121984524,
"autogenerated": false,
"ratio": 4.463179278821737,
"confi... |
__author__ = ('Thomas Rueckstiess, ruecksti@in.tum.de'
'Justin Bayer, bayer.justin@googlemail.com')
from scipy import zeros, asarray, sign, array, cov, dot, clip, ndarray
from scipy.linalg import inv
class GradientDescent(object):
def __init__(self):
""" initialize algorithms with standar... | {
"repo_name": "hassaanm/stock-trading",
"path": "pybrain-pybrain-87c7ac3/pybrain/auxiliary/gradientdescent.py",
"copies": "31",
"size": "5966",
"license": "apache-2.0",
"hash": 6988852558548421000,
"line_mean": 33.4855491329,
"line_max": 99,
"alpha_frac": 0.5982232652,
"autogenerated": false,
"ra... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from agent import Agent
from pybrain.datasets import ReinforcementDataSet
class HistoryAgent(Agent):
""" This agent stores actions, states, and rewards encountered during interaction with an environment
in a ReinforcementDataSet (which is a variation o... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/agents/history.py",
"copies": "1",
"size": "2202",
"license": "bsd-3-clause",
"hash": -905972750446682600,
"line_mean": 35.7,
"line_max": 112,
"alpha_frac": 0.6294277929,
"autogenerated": false,
"ratio": 4.466531440162272,
"config_test":... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from history import HistoryAgent
class LearningAgent(HistoryAgent):
""" LearningAgent has a module and a learner, that modifies the module. It can
have learning enabled or disabled and can be used continously or with episodes.
"""
def __in... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/agents/learning.py",
"copies": "1",
"size": "1959",
"license": "bsd-3-clause",
"hash": -7023267923810003000,
"line_mean": 35.9622641509,
"line_max": 100,
"alpha_frac": 0.6140888208,
"autogenerated": false,
"ratio": 4.412162162162162,
"co... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from learning import LearningAgent
from history import HistoryAgent
from pybrain.structure import GaussianLayer, IdentityConnection, FeedForwardNetwork
# TODO: support for SoftMax output layers
# TODO: support for more complex networks, which have more than a sing... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/agents/policygradient.py",
"copies": "1",
"size": "3677",
"license": "bsd-3-clause",
"hash": -2861996738507899400,
"line_mean": 38.1170212766,
"line_max": 106,
"alpha_frac": 0.6483546369,
"autogenerated": false,
"ratio": 4.4461910519951635... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from matplotlib.mlab import rk4
from math import sin, cos
import time
from scipy import eye, matrix, random, asarray
from pybrain.rl.environments.graphical import GraphicalEnvironment
class CartPoleEnvironment(GraphicalEnvironment):
""" This environment impl... | {
"repo_name": "sepehr125/pybrain",
"path": "pybrain/rl/environments/cartpole/cartpole.py",
"copies": "24",
"size": "4817",
"license": "bsd-3-clause",
"hash": 272340535988211650,
"line_mean": 32.4513888889,
"line_max": 150,
"alpha_frac": 0.5904089682,
"autogenerated": false,
"ratio": 3.66033434650... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from matplotlib.mlab import rk4
from math import sin, cos
import time
from scipy import eye, matrix, random
from pybrain.rl.environments.graphical import GraphicalEnvironment
class CartPoleEnvironment(GraphicalEnvironment):
""" This environment implements t... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/environments/cartpole/cartpole.py",
"copies": "1",
"size": "4784",
"license": "bsd-3-clause",
"hash": 1094493812790901200,
"line_mean": 33.6739130435,
"line_max": 121,
"alpha_frac": 0.5769230769,
"autogenerated": false,
"ratio": 3.71717171... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from OpenGL.GL import * #@UnusedWildImport
from OpenGL.GLU import * #@UnusedWildImport
from OpenGL.GLUT import * #@UnusedWildImport
from math import pi, acos, sqrt
from tools.mathhelpers import dotproduct, crossproduct, norm
from pybrain.rl.environments.renderer i... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/environments/ode/renderer.py",
"copies": "1",
"size": "14336",
"license": "bsd-3-clause",
"hash": -4506582315571481000,
"line_mean": 35.6649616368,
"line_max": 123,
"alpha_frac": 0.557547433,
"autogenerated": false,
"ratio": 3.627530364372... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from policygradient import PolicyGradientLearner
from scipy import mean
class Reinforce(PolicyGradientLearner):
""" Reinforce is a gradient estimator technique by Williams (see
"Simple Statistical Gradient-Following Algorithms for
Connectionis... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/learners/policygradients/reinforce.py",
"copies": "1",
"size": "1218",
"license": "bsd-3-clause",
"hash": -3351870111549864400,
"line_mean": 35.9393939394,
"line_max": 75,
"alpha_frac": 0.6280788177,
"autogenerated": false,
"ratio": 4.0872... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from policygradient import PolicyGradientLearner
from scipy import zeros, mean
### NOT WORKING YET ###
class GPOMDP(PolicyGradientLearner):
def __init__(self):
PolicyGradientLearner.__init__(self)
def calculateGradient(self):
# normalize... | {
"repo_name": "arnaudsj/pybrain",
"path": "pybrain/rl/learners/directsearch/gpomdp.py",
"copies": "5",
"size": "1492",
"license": "bsd-3-clause",
"hash": -1737286324478960000,
"line_mean": 37.2564102564,
"line_max": 132,
"alpha_frac": 0.5857908847,
"autogenerated": false,
"ratio": 3.4298850574712... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from .policygradient import PolicyGradientLearner
from scipy import zeros, mean
### NOT WORKING YET ###
class GPOMDP(PolicyGradientLearner):
def __init__(self):
PolicyGradientLearner.__init__(self)
def calculateGradient(self):
# normaliz... | {
"repo_name": "blueburningcoder/pybrain",
"path": "pybrain/rl/learners/directsearch/gpomdp.py",
"copies": "25",
"size": "1494",
"license": "bsd-3-clause",
"hash": 3388126433994483000,
"line_mean": 37.3076923077,
"line_max": 132,
"alpha_frac": 0.5850066934,
"autogenerated": false,
"ratio": 3.41095... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from policygradient import PolicyGradientLearner
from scipy import zeros, mean
### NOT WORKING YET ###
class GPOMDP(PolicyGradientLearner):
def __init__(self):
PolicyGradientLearner.__init__(self)
def calculateGradient(self):
... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/learners/policygradients/gpomdp.py",
"copies": "1",
"size": "1505",
"license": "bsd-3-clause",
"hash": -139893018610748670,
"line_mean": 37.6153846154,
"line_max": 123,
"alpha_frac": 0.580730897,
"autogenerated": false,
"ratio": 3.50815850... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pybrain.datasets import SequentialDataSet
from pybrain.auxiliary import GaussianProcess
from episodic import EpisodicExperiment
from scipy import mgrid, array, floor, c_, r_, reshape
class ModelExperiment(EpisodicExperiment):
""" An experiment that learn... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/experiments/gpmodel.py",
"copies": "1",
"size": "3909",
"license": "bsd-3-clause",
"hash": 7461027468661351000,
"line_mean": 36.9611650485,
"line_max": 133,
"alpha_frac": 0.5482220517,
"autogenerated": false,
"ratio": 3.909,
"config_test... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pybrain.datasets.sequential import SequentialDataSet
from pybrain.datasets.dataset import DataSet
from scipy import zeros
class ReinforcementDataSet(SequentialDataSet):
def __init__(self, statedim, actiondim):
""" initialize the reinforcement dat... | {
"repo_name": "zygmuntz/pybrain",
"path": "pybrain/datasets/reinforcement.py",
"copies": "26",
"size": "2317",
"license": "bsd-3-clause",
"hash": 1439799573577027000,
"line_mean": 40.375,
"line_max": 92,
"alpha_frac": 0.642209754,
"autogenerated": false,
"ratio": 4.189873417721519,
"config_test... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pybrain.rl.agents.agent import Agent
from pybrain.datasets import ReinforcementDataSet
class LoggingAgent(Agent):
""" This agent stores actions, states, and rewards encountered during
interaction with an environment in a ReinforcementDataSet (whi... | {
"repo_name": "Ryanglambert/pybrain",
"path": "pybrain/rl/agents/logging.py",
"copies": "31",
"size": "2380",
"license": "bsd-3-clause",
"hash": -1972886908061613600,
"line_mean": 29.9090909091,
"line_max": 100,
"alpha_frac": 0.6466386555,
"autogenerated": false,
"ratio": 4.311594202898551,
"co... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pybrain.rl.agents.logging import LoggingAgent
class LearningAgent(LoggingAgent):
""" LearningAgent has a module, a learner, that modifies the module, and an explorer,
which perturbs the actions. It can have learning enabled or disabled and can be... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/rl/agents/learning.py",
"copies": "1",
"size": "2629",
"license": "mit",
"hash": -2046557975867937800,
"line_mean": 32.2784810127,
"line_max": 93,
"alpha_frac": 0.5876759224,
"autogenerated": false,
"ratio": 4.604... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pybrain.rl.environments import EpisodicTask
from scipy import pi
class GradualRewardTask(EpisodicTask):
''' task gives more reward, the higher the bar is.'''
def __init__(self, environment):
EpisodicTask.__init__(self, environment)
sel... | {
"repo_name": "ii0/pybrain",
"path": "pybrain/rl/environments/ode/tasks/acrobot.py",
"copies": "31",
"size": "1235",
"license": "bsd-3-clause",
"hash": -263401264667713660,
"line_mean": 29.875,
"line_max": 67,
"alpha_frac": 0.5910931174,
"autogenerated": false,
"ratio": 3.5488505747126435,
"con... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pybrain.rl.environments import EpisodicTask
class MinimizeTask(EpisodicTask):
def __init__(self, environment):
EpisodicTask.__init__(self, environment)
self.N = 15
self.t = 0
self.state = [0.0] * environment.dim
se... | {
"repo_name": "garyfeng/pybrain",
"path": "pybrain/rl/environments/simple/tasks.py",
"copies": "26",
"size": "1027",
"license": "bsd-3-clause",
"hash": 8178708026661422000,
"line_mean": 25.3333333333,
"line_max": 83,
"alpha_frac": 0.5783836417,
"autogenerated": false,
"ratio": 3.4347826086956523,... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pybrain.rl.environments import EpisodicTask
class MinimizeTask(EpisodicTask):
def __init__(self, environment):
EpisodicTask.__init__(self, environment)
self.N = 15
self.t = 0
self.state = [0.0] * environment.dim
... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/rl/environments/simple/tasks.py",
"copies": "3",
"size": "1069",
"license": "mit",
"hash": 651728686881317600,
"line_mean": 26.4102564103,
"line_max": 83,
"alpha_frac": 0.5556594949,
"autogenerated": false,
"ratio... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pybrain.rl.learners.directsearch.directsearch import DirectSearchLearner
from pybrain.rl.learners.learner import DataSetLearner, ExploringLearner
from pybrain.utilities import abstractMethod
from pybrain.auxiliary import GradientDescent
from pybrain.rl.explore... | {
"repo_name": "yonglehou/pybrain",
"path": "pybrain/rl/learners/directsearch/policygradient.py",
"copies": "31",
"size": "4200",
"license": "bsd-3-clause",
"hash": -4886327113816697000,
"line_mean": 30.3432835821,
"line_max": 84,
"alpha_frac": 0.67,
"autogenerated": false,
"ratio": 4.393305439330... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pybrain.rl.learners.directsearch.policygradient import PolicyGradientLearner
from scipy import mean, ravel, array
class Reinforce(PolicyGradientLearner):
""" Reinforce is a gradient estimator technique by Williams (see
"Simple Statistical Gradien... | {
"repo_name": "pybrain2/pybrain2",
"path": "pybrain/rl/learners/directsearch/reinforce.py",
"copies": "31",
"size": "1304",
"license": "bsd-3-clause",
"hash": 3658680543474381000,
"line_mean": 38.5151515152,
"line_max": 122,
"alpha_frac": 0.6610429448,
"autogenerated": false,
"ratio": 3.683615819... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pybrain.rl.learners.learner import ExploringLearner, DataSetLearner, EpisodicLearner
from pybrain.rl.explorers.discrete.egreedy import EpsilonGreedyExplorer
class ValueBasedLearner(ExploringLearner, DataSetLearner, EpisodicLearner):
""" An RL algorithm b... | {
"repo_name": "styskin/pybrain",
"path": "pybrain/rl/learners/valuebased/valuebased.py",
"copies": "31",
"size": "1423",
"license": "bsd-3-clause",
"hash": 7506629608774046000,
"line_mean": 29.2765957447,
"line_max": 89,
"alpha_frac": 0.6612789881,
"autogenerated": false,
"ratio": 3.8459459459459... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pybrain.rl.learners.rllearner import RLLearner
from pybrain.utilities import abstractMethod
from pybrain.auxiliary import GradientDescent
from scipy import ravel
class PolicyGradientLearner(RLLearner):
""" The PolicyGradientLearner takes a ReinforcementDa... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/learners/policygradients/policygradient.py",
"copies": "1",
"size": "1908",
"license": "bsd-3-clause",
"hash": -2415837969128462000,
"line_mean": 37.18,
"line_max": 110,
"alpha_frac": 0.6603773585,
"autogenerated": false,
"ratio": 4.510638... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pybrain.rl.learners.rllearner import RLLearner
class QLambda(RLLearner):
def __init__(self, nActions):
self.alpha = 0.5
self.gamma = 0.99
self.qlambda = 0.9
self.laststate = None
self.lastaction = Non... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/learners/discrete/qlambda.py",
"copies": "1",
"size": "1283",
"license": "bsd-3-clause",
"hash": -3910231981973209000,
"line_mean": 31.9230769231,
"line_max": 129,
"alpha_frac": 0.5518316446,
"autogenerated": false,
"ratio": 3.634560906515... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pybrain.rl.learners.rllearner import RLLearner
class Q(RLLearner):
def __init__(self, nActions):
self.alpha = 0.5
self.gamma = 0.99
self.laststate = None
self.lastaction = None
self.nActions = nA... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/learners/discrete/q.py",
"copies": "1",
"size": "1202",
"license": "bsd-3-clause",
"hash": 6573338344887396000,
"line_mean": 31.5135135135,
"line_max": 128,
"alpha_frac": 0.5881863561,
"autogenerated": false,
"ratio": 3.864951768488746,
... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pybrain.rl.learners.rllearner import RLLearner
class SARSA(RLLearner):
def __init__(self, nActions):
self.alpha = 0.5
self.gamma = 0.99
self.laststate = None
self.lastaction = None
self.nActions ... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/learners/discrete/sarsa.py",
"copies": "1",
"size": "1173",
"license": "bsd-3-clause",
"hash": -3088816996370294300,
"line_mean": 30.7297297297,
"line_max": 126,
"alpha_frac": 0.5848252344,
"autogenerated": false,
"ratio": 3.84590163934426... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pybrain.rl.learners.valuebased.valuebased import ValueBasedLearner
class QLambda(ValueBasedLearner):
""" Q-lambda is a variation of Q-learning that uses an eligibility trace. """
offPolicy = True
batchMode = False
def __init__(self, alpha=0... | {
"repo_name": "hassaanm/stock-trading",
"path": "pybrain-pybrain-87c7ac3/pybrain/rl/learners/valuebased/qlambda.py",
"copies": "31",
"size": "1396",
"license": "apache-2.0",
"hash": 4359052722025766400,
"line_mean": 32.2380952381,
"line_max": 133,
"alpha_frac": 0.5938395415,
"autogenerated": false,... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pybrain.rl.learners.valuebased.valuebased import ValueBasedLearner
class Q(ValueBasedLearner):
offPolicy = True
batchMode = True
def __init__(self, alpha=0.5, gamma=0.99):
ValueBasedLearner.__init__(self)
self.a... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/rl/learners/valuebased/q.py",
"copies": "3",
"size": "2015",
"license": "mit",
"hash": 7077905272652124000,
"line_mean": 34.9821428571,
"line_max": 136,
"alpha_frac": 0.5662531017,
"autogenerated": false,
"ratio":... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pybrain.rl.learners.valuebased.valuebased import ValueBasedLearner
class Q(ValueBasedLearner):
offPolicy = True
batchMode = True
def __init__(self, alpha=0.5, gamma=0.99):
ValueBasedLearner.__init__(self)
self.alpha = alpha
... | {
"repo_name": "arnaudsj/pybrain",
"path": "pybrain/rl/learners/valuebased/q.py",
"copies": "5",
"size": "2043",
"license": "bsd-3-clause",
"hash": -7691151425637002000,
"line_mean": 34.224137931,
"line_max": 145,
"alpha_frac": 0.5819872736,
"autogenerated": false,
"ratio": 4.393548387096774,
"c... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pybrain.rl.learners.valuebased.valuebased import ValueBasedLearner
class SARSA(ValueBasedLearner):
""" State-Action-Reward-State-Action (SARSA) algorithm.
In batchMode, the algorithm goes through all the samples in the
history and performs... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/rl/learners/valuebased/sarsa.py",
"copies": "3",
"size": "1734",
"license": "mit",
"hash": 1138291937291895800,
"line_mean": 32.3461538462,
"line_max": 134,
"alpha_frac": 0.57727797,
"autogenerated": false,
"ratio... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pybrain.rl.tasks import EpisodicTask
from scipy import pi
class GradualRewardTask(EpisodicTask):
''' task gives more reward, the higher the bar is.'''
def __init__(self, environment):
EpisodicTask.__init__(self, environment)
self.rewar... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/environments/ode/tasks/acrobot.py",
"copies": "1",
"size": "1096",
"license": "bsd-3-clause",
"hash": 3748049452623323600,
"line_mean": 30.3142857143,
"line_max": 67,
"alpha_frac": 0.5629562044,
"autogenerated": false,
"ratio": 3.605263157... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pybrain.rl.tasks import EpisodicTask
class MinimizeTask(EpisodicTask):
def __init__(self, environment):
EpisodicTask.__init__(self, environment)
self.N = 15
self.t = 0
self.state = [0.0]*environment.dim
self.acti... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/environments/simple/tasks.py",
"copies": "1",
"size": "1054",
"license": "bsd-3-clause",
"hash": 6927056295838633000,
"line_mean": 26.0512820513,
"line_max": 81,
"alpha_frac": 0.5569259962,
"autogenerated": false,
"ratio": 3.54882154882154... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pybrain.utilities import abstractMethod, Named
class RLLearner(Named):
""" A RL-Learner determines how to change the adaptive parameters of a module,
but unlike a Trainer (supervised), a RL-learner's dataset has no target but
only a rein... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/learners/rllearner.py",
"copies": "1",
"size": "1244",
"license": "bsd-3-clause",
"hash": -3891972713920791000,
"line_mean": 34.5428571429,
"line_max": 84,
"alpha_frac": 0.6471061093,
"autogenerated": false,
"ratio": 3.97444089456869,
"c... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pybrain.utilities import abstractMethod
from pybrain.rl.learners.rllearner import RLLearner
from scipy import zeros
class FDLearner(RLLearner):
""" FDLearner is the base class for all Finite Difference Learners. It
implements basic common functio... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/learners/finitedifference/fd.py",
"copies": "1",
"size": "2198",
"license": "bsd-3-clause",
"hash": 3380217557630800000,
"line_mean": 38.25,
"line_max": 89,
"alpha_frac": 0.6196542311,
"autogenerated": false,
"ratio": 4.431451612903226,
... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pybrain.utilities import abstractMethod
from pybrain.structure.modules import Table, Module, TanhLayer, LinearLayer, BiasUnit
from pybrain.structure.connections import FullConnection
from pybrain.structure.networks import FeedForwardNetwork
from pybrain.struct... | {
"repo_name": "pybrain/pybrain",
"path": "pybrain/rl/learners/valuebased/interface.py",
"copies": "2",
"size": "3648",
"license": "bsd-3-clause",
"hash": 8182168928170893000,
"line_mean": 37.8085106383,
"line_max": 120,
"alpha_frac": 0.6883223684,
"autogenerated": false,
"ratio": 4.16914285714285... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pylab import ion, figure, draw, Rectangle, Line2D
from scipy import cos, sin
from pybrain.rl.environments.renderer import Renderer
import threading
import time
class CartPoleRenderer(Renderer):
def __init__(self):
Renderer.__init__(self)
... | {
"repo_name": "Ryanglambert/pybrain",
"path": "pybrain/rl/environments/cartpole/renderer.py",
"copies": "31",
"size": "2182",
"license": "bsd-3-clause",
"hash": 7363702868813558000,
"line_mean": 29.7323943662,
"line_max": 130,
"alpha_frac": 0.5779101742,
"autogenerated": false,
"ratio": 3.2960725... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pylab import ion, figure, draw, Rectangle, Line2D #@UnresolvedImport
from scipy import cos, sin
from pybrain.rl.environments.renderer import Renderer
import threading
import time
class CartPoleRenderer(Renderer):
def __init__(self):
Renderer.__... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/environments/cartpole/renderer.py",
"copies": "1",
"size": "2261",
"license": "bsd-3-clause",
"hash": -3604659853426249000,
"line_mean": 31.3142857143,
"line_max": 126,
"alpha_frac": 0.5647943388,
"autogenerated": false,
"ratio": 3.3898050... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pylab import plot, figure, ion, Line2D, draw, arange
from pybrain.rl.environments.renderer import Renderer
import threading
import time
class SimpleRenderer(Renderer):
def __init__(self):
Renderer.__init__(self)
self.dataLock = threading... | {
"repo_name": "cmorgan/pybrain",
"path": "pybrain/rl/environments/simple/renderer.py",
"copies": "25",
"size": "2133",
"license": "bsd-3-clause",
"hash": -3099235592717171700,
"line_mean": 25.012195122,
"line_max": 61,
"alpha_frac": 0.5597749648,
"autogenerated": false,
"ratio": 3.457050243111831... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pylab import plot, figure, ion, Line2D, draw, arange
from pybrain.rl.environments.renderer import Renderer
import threading
import time
class SimpleRenderer(Renderer):
def __init__(self):
Renderer.__init__(self)
self.dataLock ... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/rl/environments/simple/renderer.py",
"copies": "3",
"size": "2216",
"license": "mit",
"hash": -3215132655494507000,
"line_mean": 26.0243902439,
"line_max": 61,
"alpha_frac": 0.5370036101,
"autogenerated": false,
"... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pylab import plot, figure, ion, Line2D, draw, arange #@UnresolvedImport
from pybrain.rl.environments.renderer import Renderer
import threading
import time
class SimpleRenderer(Renderer):
def __init__(self):
Renderer.__init__(self)
... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/environments/simple/renderer.py",
"copies": "1",
"size": "2225",
"license": "bsd-3-clause",
"hash": 7011962609165012000,
"line_mean": 26.8125,
"line_max": 76,
"alpha_frac": 0.5420224719,
"autogenerated": false,
"ratio": 3.612012987012987,
... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from random import sample
from scipy import isscalar
from dataset import DataSet
from pybrain.utilities import fListToString
class SupervisedDataSet(DataSet):
"""SupervisedDataSets have two fields, one for input and one for the target.
"""
def __ini... | {
"repo_name": "abhishekgahlot/pybrain",
"path": "pybrain/datasets/supervised.py",
"copies": "1",
"size": "4175",
"license": "bsd-3-clause",
"hash": 930686889878516000,
"line_mean": 34.6837606838,
"line_max": 80,
"alpha_frac": 0.5844311377,
"autogenerated": false,
"ratio": 4.1917670682730925,
"c... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from scipy import argmax, array, r_, asarray
from pybrain.utilities import abstractMethod
from pybrain.structure.modules import Table, Module
from pybrain.structure.parametercontainer import ParameterContainer
from pybrain.tools.shortcuts import buildNetwork
from p... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/rl/learners/valuebased/interface.py",
"copies": "1",
"size": "2895",
"license": "mit",
"hash": 1525483927985959700,
"line_mean": 36.1153846154,
"line_max": 120,
"alpha_frac": 0.6728842832,
"autogenerated": false,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.