blob_id
large_string
repo_name
large_string
path
large_string
src_encoding
large_string
length_bytes
int64
score
float64
int_score
int64
detected_licenses
large list
license_type
large_string
text
string
download_success
bool
cc6e64d10729083b89673e26ca7c6147f8ef1a1e
mikpim01/Google-IT-Automation-with-Python-Professional-Certificate-1
/Crash Course on Python/Week 2/programming_excercises/format_name.py
UTF-8
1,070
3.921875
4
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ Created on Fri Jan 24 17:58:09 2020 @author: garyn """ ''' Complete the body of the format_name function. This function receives first_name and last_name, then prints a formatted string of "Name: last_name, first_name" if both names are not blank, or "Name: " with just one of the...
true
759e9abdbcb99d6d05112622818f2c0f5ac49434
Lashuk2/git_exercise
/task_1_4.py
UTF-8
327
3.421875
3
[]
no_license
from math import sqrt a = float(input('a=')) #вводим 2 b = float(input('b=')) #вводим 8 c = (a+b)/2 #среднее арифметическое d = sqrt(a*b) #среднее геометрическое print(c) #получаем 5.0 print(d) #получаем 4.0
true
396bc6f3eafee9621547d7a476360f3ccf47f309
qianjing2020/cs-module-project-hash-tables
/lecture/index_records.py
UTF-8
635
3.390625
3
[]
no_license
# indexing # get records for all Engineering personnel records = [ ("Alice", "Engineering"), ("Bob", "Sales"), ("Erin", "Engineering") ] engineers = [] for record in records: if record[1] =='Engineering': engineers.append(record) # let's make an index for instant access by attribute search ind...
true
28b7e93a1be34d2e253ad538c97cebe2ed4c0ae8
PinkDiamond1/tools-5
/scripts/testnet_inflation/testnet_accounts.py
UTF-8
1,913
2.625
3
[]
no_license
from decimal import Decimal from stellar_base.keypair import Keypair from stellar_base.address import Address import requests import argparse import json import logging TESTNET_HORIZON = 'https://horizon-testnet.stellar.org' class AccountNotFunded(Exception): pass def fund_account(keypair): pk = keypair.a...
true
620852e4f0ca5fd841e7102c67e42ed9c37606f7
Chillee/CompProgramming
/archive/CF475/E/main.py
UTF-8
912
2.6875
3
[]
no_license
import math MAXN = int(2e5 + 5) N = 0 # ll W[MAXN], H[MAXN], C[MAXN]; W = [0 for i in range(MAXN)] H = [0 for i in range(MAXN)] C = [0 for i in range(MAXN)] def lcm(a, b): return a*b/math.gcd(a, b) N = int(input()) minC = 1 << 60 for i in range(N): w, h, c = input().split() w, h, c = int(w), int(h), in...
true
08d5138763682138d3202eab0a8657d92f4dc206
ineed-coffee/PS_source_code
/LeetCode/160. Intersection of Two Linked Lists(EASY).py
UTF-8
690
3.328125
3
[]
no_license
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode: pointer_A=headA node_visited=set() while pointer_A: ...
true
c42dc499d50a5d27e5091493a71a4807f09075ec
AlejandroDurango/Calculadora_Analisis_Numerico
/Editable/Interfaz.py
UTF-8
2,688
2.703125
3
[]
no_license
import tkinter as tk from Class_interpolacion import VentanaInterpolacion from Class_integral import VentanaIntegrales from Class_regresion import Regresion from Class_Ecua import Ecuaciones from tkinter.messagebox import * icono = "Src/Icono.ico" tamano_default = '500x500' color_fondo = "#FEF5ED" class interfaz(): ...
true
5ccaaefc8e0884e62033f7fea7de658db35b4d06
afcarl/isa
/code/models/stackedmodel.py
UTF-8
1,083
2.625
3
[ "MIT" ]
permissive
from distribution import Distribution from numpy import zeros class StackedModel(Distribution): def __init__(self, *args): self.transforms = list(args[:-1]) self.model = args[-1] self.dim = self.model.dim def __getitem__(self, key): return (list(self.transforms) + [self.model])[key] def initialize(sel...
true
29c2895d3d2ed7707809940679dab24d9da05de4
supawichable/AI_Projects
/knights/puzzle.py
UTF-8
2,934
3.53125
4
[]
no_license
from logic import * AKnight = Symbol("A is a Knight") AKnave = Symbol("A is a Knave") AOnlyOne = And(Or(AKnight, AKnave), Not(And(AKnight, AKnave))) # A is either a Knight or a Knave BKnight = Symbol("B is a Knight") BKnave = Symbol("B is a Knave") BOnlyOne = And(Or(BKnight, BKnave), Not(And(BKnight, BKnave))) # B is...
true
bf9f577cdb31a69e8c49f7a1d268c3bf7624306e
xuzhihua95/quant
/project/multi_factor/alpha_model/exposure/alpha_factor_gg_npg_bias.py
UTF-8
1,919
2.640625
3
[]
no_license
import pandas as pd from quant.stock.date import Date from quant.stock.stock import Stock from quant.utility.factor_preprocess import FactorPreProcess from quant.project.multi_factor.alpha_model.exposure.alpha_factor import AlphaFactor class AlphaGGNPGBias(AlphaFactor): """ 因子说明: 一致预期净利润同比偏离 """ def...
true
276c00294c5a7ef026cb50a13c164ecd6785380c
ammevissen/Udemy_REST_APIs_with_Flask_and_Python
/Python_Primer/24_str_ and_repr/code.py
UTF-8
517
4.09375
4
[]
no_license
class Person: def __init__(self, name, age): self.name=name self.age=age def __str__(self): #magic method, called when you want to turn your object to a string return f"Person {self.name}, {self.age} years old." def __repr__(self): #magic method, can also be called when you turn yo...
true
ed30421dc82a1b62648778d84a864bc3deee8a99
umarov90/VariantStudy
/attribution.py
UTF-8
2,678
2.890625
3
[]
no_license
import tensorflow as tf def interpolate_images(baseline, image, alphas): alphas_x = alphas[:, tf.newaxis, tf.newaxis] baseline_x = tf.expand_dims(baseline, axis=0) input_x = tf.expand_dims(image, axis=0) delta = input_x - baseline_x images = baseline_x...
true
383d88903cb1e0a3dc1a0126ce5aa3bc448db526
ashray-00/teaching
/training_error.py
UTF-8
2,118
2.765625
3
[]
no_license
#%matplotlib notebook from sklearn import linear_model from sklearn.neighbors import KNeighborsRegressor from sklearn.preprocessing import StandardScaler import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D X=np.loadtxt("prostate_training.csv", skiprows=1, usecols=(1,2,3,4,5,6,7,...
true
d27f3cfd6770a4fc051b54ed0d4014e3f64c5aac
m9rehman/Machine-Learning
/Machine Learning Sandbox/regression.py
UTF-8
826
3.34375
3
[]
no_license
import pandas as pd import quandl import math df = quandl.get("WIKI/GOOGL") #Cleaning up the stock df df = df[['Adj. Open','Adj. High','Adj. Low','Adj. Close','Adj. Volume']] df['HighLow_Volatility'] = (df['Adj. High']- df['Adj. Low'])/df['Adj. High'] * 100 df['OpenClose_Change'] = (df['Adj. Close']- df['Adj. Open...
true
11e78a1d16bf348669594bed39f669d3eed11ef7
gitdog01/AlgoPratice
/random/no_category/1261/main.py
UTF-8
751
2.90625
3
[]
no_license
import sys import heapq N, M = map(int, sys.stdin.readline().replace("\n", "").split(" ")) maze = [] for _ in range(M): maze.append(list(sys.stdin.readline().replace("\n", ""))) dp = [[sys.maxsize for _ in range(N)] for _ in range(M)] dp[0][0] = 0 answer = sys.maxsize queue = [] heapq.heappush(queue, (0, [0, 0]))...
true
9cba47f2b11e11cea1f8003db18ea5784b140e22
liquidgenius/pg_channels
/pg_channels/__init__.py
UTF-8
2,782
3.03125
3
[ "MIT" ]
permissive
import psycopg2 from select import select class PGChannels: ''' Simple wrapper utilizing PostgreSQL's LISTEN and NOTIFY commands to make implentation easier. ''' def __init__(self, connection=None, **kwargs): ''' Constructor that accepts a Psycopg2 connection or dan key word args to construct one. ''' ...
true
6e95655ff7d650f11b81ccca17b85b0e1781689b
anooprh/leetcode-python
/algorithm/a013_Roman_To_Integer.py
UTF-8
1,030
3.515625
4
[]
no_license
import os class Solution(object): def romanToInt(self, s): """ :type s: str :rtype: int """ table = { "I": 1, "V": 5, "X": 10, "L": 50, "C": 100, "D": 500, "M": 1000, } next ...
true
6b1ee457fa01a12a1c114232a427b46fe8e7f58c
fbolsen/DARPA
/DiscovairPlot.py
UTF-8
1,305
2.859375
3
[]
no_license
from glob import iglob import os import argparse import pandas as pd def get_csv_files(pth): # remove files with zero size and 'conflict' in filename # filenames with 'conflict' indicates sync problem with Tresorit # iglob returns iterator, glob.glob returns list file_list = [f for f in iglob(pth, r...
true
6e89f0530157d1da1fc856e337068392c08ec981
altimore/django-currency-rates
/currency_rates/converters/forexpython.py
UTF-8
323
2.5625
3
[]
no_license
import datetime from decimal import Decimal from forex_python.converter import CurrencyRates, RatesNotAvailableError def get_rate( from_currency, to_currency, amount=1, date=datetime.date.today() ) -> Decimal: c = CurrencyRates() rate = c.get_rate(from_currency, to_currency, date) return Decimal(rat...
true
90c9743d943e05a42a0933cbf05979825f73ee9b
headshoter13/HW-Python_2017-18
/homework_1/task_2.py
UTF-8
864
3.84375
4
[]
no_license
#Task 2 - Hierarchy class text: def __init__(self, text): self.text = str(text) def outp(self): raise NotImplementedError("Subclass must implement abstract method") class JSON(text): def outp(self, tag="text"): return "{\""+tag+"\":\""+self.text+"\"}" class HTML(...
true
64c5631f07d92053520a1d8a83db73e2404ea054
beskyfil/labels
/labelsync/service.py
UTF-8
1,886
2.953125
3
[ "MIT" ]
permissive
from abc import ABCMeta, abstractmethod class Service(metaclass=ABCMeta): """Abstract class of service which will be suported by this label-syncing app, this is just to make sure you dont forget to implement any of these required methods """ @abstractmethod def __init__(self, config, name, api_url)...
true
f155daba149e34aab14e1eb39bfcb5002f7a9e13
rahamanankit/InstaDB-Integration
/instadb.py
UTF-8
2,117
3.078125
3
[]
no_license
import cx_Oracle con = cx_Oracle.connect("ankit123/ankit") cur = con.cursor() print("Select from the below options ") print("---------------------------------------- ") print("Press 1 for Max Likes") print("Press 2 for Min Likes") print("Press 3 for Music Pictures") print("Press 4 for Popular Tag") print("Press 5 for M...
true
560765960228ec3bfa96bb74c06be78b6e2795cf
grpnpraveen/Python_Learnings
/FIRST_learning/sort.py
UTF-8
271
3.546875
4
[]
no_license
def selection(a,size): for i in range(size-1): min=i for j in range(i+1,size): if a[j]<a[min]: min=j temp=a[i] a[i]=a[min] a[min]=temp a=[1,2,4,3] selection(a,4) for i in range(4): print(a[i])
true
66d88110e500652c54221eb3a6f97ea31de9a9d9
eddiedb6/rate
/util/DumpUtil.py
UTF-8
449
2.59375
3
[]
no_license
import pickle import os from RateConfig import * def FetchExchangeRateForUpdateFromFile(): rates = [] path = ImportPath if not os.path.exists(path): print("Error: invalid import path: " + path) return rates with open(path, "rb") as f: rates = pickle.load(f) return rat...
true
8eb8233138a194d3277941e2178066130ae98fef
faststare/accounting
/transaction/tests/test_transaction.py
UTF-8
3,871
3.015625
3
[ "Unlicense" ]
permissive
"""Test cases for the transaction class.""" import datetime from transaction.transaction import Transaction class TestTransaction(object): """Transaction test cases.""" transaction = Transaction def test_transaction_amount(self, transactions): """Test the amount is a float.""" for item ...
true
1561c9c2b39ea862b1afbf78ffc17de009f618cb
CarterWS/Summer2020
/PythonCode/PyCom/Examples/WiFi.py
UTF-8
454
2.6875
3
[ "MIT" ]
permissive
''' https://docs.pycom.io/tutorials/all/wlan.html ''' import machine from network import WLAN wlan = WLAN(mode=WLAN.STA) nets = wlan.scan() nets for net in nets: if net.ssid == 'HighPeaks': print('Network found!') wlan.connect(net.ssid, auth=(net.sec, 'password'), timeout=5000) while not...
true
07d071b6aaf6a0150636704ad958a0ddd14e857d
920630yzx/pachong
/scrapy项目/test02/test02/spiders/test.py
UTF-8
2,302
2.796875
3
[]
no_license
from scrapy.spiders import CrawlSpider, Rule from scrapy.linkextractors import LinkExtractor import scrapy import time import re class BookSpider(CrawlSpider): name = 'book' start_urls = ['http://www.quanwenyuedu.io/'] # 编写连接提取器规则 book_link = LinkExtractor(allow=r'aoshidanshen.quanwenyuedu.io$', deny...
true
2aab95472c803b1b6c7543b5a199fa93c3074eab
Szonek/PKM2
/PKM2/grupa2_algorytmy_detekcji/Marek_main_recognition_by_findContours_and_color.py
UTF-8
3,816
3
3
[]
no_license
#Python 2.7.10 OpenCV 3.2 from collections import deque import numpy as np import argparse import imutils import cv2 #ustawiamy parametru HSV koloru jaki ma zostac wykryty Lower = (0, 120, 0) Upper = (3, 255, 255) #inicjalizujemy parametry naszego obramowania ==0 maxy=0 maxx=0 miny=0 minx=0 offset=10 #offset do obram...
true
bba070587c2974d451be59fad55f94efa4bf51cf
cr8ivecodesmith/pycert
/pycert.py
UTF-8
2,924
2.765625
3
[]
no_license
import csv, os import PyPDF2 import StringIO from reportlab.pdfgen import canvas from reportlab.lib.pagesizes import portrait, letter, landscape # Import smtplib for the actual sending function import smtplib # Import the email modules we'll need from email.mime.multipart import MIMEMultipart from email.mime.text impo...
true
0c0e5679b0cae2a861578cbaccf7341e373294c5
qinzhouhit/leetcode
/917reverseOnlyLetters.py
UTF-8
1,292
3.859375
4
[]
no_license
''' keys: isalpha() Solutions: Similar: T: S: ''' from typing import List class Solution: # reversed pointer def reverseOnlyLetters2(self, S): ans = [] j = len(ans) - 1 for i, x in enumerate(S): if x.isalpha(): while not S[j].isalpha(): ...
true
56e886bf638be66c70b672b9691199c12f31b717
EyeTechPae/EyeTech
/Processing/Optical flow/opticalFlow_2.py
UTF-8
3,480
2.5625
3
[]
no_license
#!/usr/bin/python import cv2 import numpy as np #Downsampling factor for the image scaling_factor = 0.5 #Number of frames to keep in the buffer when you are tracking. #If you increase it, feature points will have more "inertia". num_frames_to_track = 2 #Skip every 'n' frames. This is just to increase the speed. num...
true
f4cd70d02b34dace868203be5c7ef9459cc3d64f
POE-DAMERON/Glie-44
/Model/UI/Glie_44_utils.py
UTF-8
2,670
3.046875
3
[]
no_license
from PIL import ImageDraw, ImageFont import torchvision class Utils(): """ converts a PIL image into a PyTorch Tensor """ @staticmethod def to_tensor(): return torchvision.transforms.Compose([torchvision.transforms.ToTensor()]) """ Input: Path of the txt file with annotations ...
true
467233207cdeb919f852450b991d3b4c595c7e57
rita0124/python-learning
/9_how_to_use_class/people.py
UTF-8
753
3.890625
4
[]
no_license
class People: name = '' money = 0 # 在以 People類別 實作出各個物件時(下方幾個人的誕生),預設會被呼叫的函式 # 以物件導向程式設計的觀念來說,這是一個「建構子函式」(constructor function) # 憲法第一條規定,如果出生時不取名字的話 就會被稱為無名氏 # 憲法第二條規定,任何人出生的時候,如果沒有錢,就會得到一百元 def __init__(self, n = '無名氏', m = 100): self.name = n self.money = m ...
true
0901255093317b56005df55fb1830b7047ccf214
amcat/nlpipe
/tests/test_frog.py
UTF-8
1,553
2.765625
3
[ "MIT" ]
permissive
""" Test the Frog tagger/lemmatizer functions and task. """ from __future__ import unicode_literals import logging from unittest import SkipTest import os.path import socket; from io import BytesIO from nose.tools import assert_equal, assert_in from nlpipe.modules.frog import call_frog from nlpipe.tasks import frog...
true
a32bd7abe9f85fbbae80e8f310c087b68f5b0d60
Natan-Gabriel/Fundamentals-of-Programming
/Create quiz and take quiz/repo.py
UTF-8
5,160
2.984375
3
[]
no_license
from random import randint class Repo: def __init__(self,id=0,text=0,a=0,b=0,c=0,correct=0,diff=0): self.__id=id self.__text=text self.__a=a self.__b=b self.__c=c self.__correct=correct self.__diff=diff def get_id(self): retu...
true
f7de2fab05f87601780bf1da73b44331f4a4bbb4
sagrawal19/CIS104
/H2P1.py
UTF-8
525
4.5625
5
[]
no_license
# Asking the user for their age and stores it in a variable. age = int(input("Please enter your age :")) # calculates age in 10 years and output the msg age_10Year = (age + 10) print("After Ten Year age will be : ", age_10Year) # input temperature in degrees Fahrenheit, Fahrenheit = float(input("Please Enter Th...
true
fe289a659e62d3998854608231f1c57c0439416b
prashanthr11/Leetcode
/practice/Graph/All Paths From Source to Target.py
UTF-8
539
3.125
3
[]
no_license
class Solution: def allPathsSourceTarget(self, a: List[List[int]]) -> List[List[int]]: # Time: O(2 ^ N) If all the nodes are connected i.e., for every i < j, there an outgoing path from i to j. # Space: O(1) ret, ln = list(), len(a) def solve(s, t, l, path): if s == t:...
true
a206e4a8580985dc060a78ca232fc842109c99a5
SvVoRPy/coursera
/python3_specialization/course04_classes_and_inheritances/week03.py
UTF-8
9,774
4.28125
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Apr 12 11:19:52 2020 @author: svollnhals Python 3 Specialization on Coursera Course 4 Python Classes and Inheritance Week 03 stuff """ # equality test assert 'No' == 'Yes' assert 'Yes' == 'Yes' # type test assert type(9//5) == int assert type(9.0//5) == int # Check that...
true
b383690492bed4e718733e9d7e04a76f44600311
zdassen/image-processing
/lib/plotter.py
UTF-8
592
3.046875
3
[]
no_license
# -*- coding: utf-8 -*- # # plotter.py # from matplotlib import pyplot as plt def collate(images, titles, nr, nc, show=True): """複数の画像をプロットする (比較用)""" for i, image in enumerate(images): plt.subplot(nr, nc, i + 1) # グレー画像の場合とそれ以外で描画方法を切り分ける is_gray = len(image.shape) == 2 ...
true
816c51b868c1afec86dad0b487d17519a9b1daf3
wudi306/SmartCar-laneDetection
/scripts/utility/Polyfit2d.py
UTF-8
2,547
3.25
3
[]
no_license
""" 参考: https://blog.csdn.net/u011023470/article/details/111381695 https://blog.csdn.net/u011023470/article/details/111381298 """ from math import sqrt class Polyfit2d: "二次曲线拟合类" def reset(self) -> None: "重置状态" self.n = 0 self.x = self.y = self.x2 = self.x3 = self.x4 = self.xy = self....
true
927d835ac4ba9df96a44dd847840c426f6d1860c
COUNTERKILL/XedusGame
/logicObject.py
UTF-8
814
2.953125
3
[]
no_license
from object import Position import math class LogicObject: def __init__(self, objectLogicPath, object): self._object = object self._objectLogicPath = objectLogicPath def GetWidth(self): return self._object.GetWidth() def GetHeight(self): return self._object.GetHeight() def GetPosition(self): return self...
true
68b941addb465f1bfafac9912f2c20e130f9b69a
WeareJoker/inparadox
/BeautifulSoup.py
UTF-8
1,362
3.328125
3
[]
no_license
import csv import mechanize import urllib2 from bs4 import BeautifulSoup #Start to input values into csv files def csvstart(daily): csv_file = open("./result/" + str(daily) + "/result.csv",'wb') cw = csv.writer(csv_file, delimiter=',',quotechar='|') cw.writerow([u"번호".encode("euc-kr"),"name","email","Subject","Rec...
true
5becad9219ad9633ca6638b52b469074443f6a7b
xzoert/dedalus
/dedalus/ui/AsyncReceiver.py
UTF-8
902
2.984375
3
[ "MIT" ]
permissive
from PySide.QtCore import QObject, Signal ''' for making asychronous calls being thread safe in Qt. it exploits Qt's signal system. usage: myClient.someCall(...,async=True,callback=AsyncReceiver(myCallback).callback) the async receiver will call 'myCallback' on its own thread gently merged in the event loop. myC...
true
49024d7d93450e09454fb1c31da2f9bd3327d01d
zopefoundation/z3c.sampledata
/src/z3c/sampledata/interfaces.py
UTF-8
3,688
2.5625
3
[]
no_license
############################################################################### # # Copyright 2006 by Zope Foundation and Contributors # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFT...
true
b31cdd1a7f55c5af9f4e865836e67f747a9ba945
bleist88/Io
/Data.py
UTF-8
7,794
3.265625
3
[]
no_license
""" This file contains functions which are designed to read and write ascii files to and from numpy record arrays. The typical text file might look somethin like: ## This is a comment at the top of the file. #< col_1 int32 #< col_2 float32 #< col_3 float32 #< col...
true
95c455aa23d1f89087b76c1b7822c2278dfe993a
DaichiMorimoto/GANs-in-action
/datasets.py
UTF-8
1,293
2.703125
3
[]
no_license
import os import glob import torch from PIL import Image from torchvision import datasets, transforms class CycleGANDatasets(torch.utils.data.Dataset): def __init__(self, root, img_shape=(128, 128), is_train=True): # Directory Name if is_train: root_A = root + os.sep + 'trainA/' ...
true
a4c3bd6c2798772736447354cda5fdda662b4ac2
SAVERCOUGARNASA/SAVER
/KerberosSDR_script-devel/joystick.py
UTF-8
1,402
2.75
3
[]
no_license
#!/usr/bin/env python3 import time import sys import numpy as np import serial import json from os import environ environ['PYGAME_HIDE_SUPPORT_PROMPT'] = '1' import pygame import logging as log log.basicConfig(format='[%(levelname)s][%(asctime)s]%(message)s', level=log.DEBUG) pygame.init() if pygame.joystick.get_coun...
true
a692a6bd9bdfc610f36ed018c6c5491506ab9904
BlueCakeWithCows/Code-Samples
/ProgrammingQuestions/DailyCode9Hard.py
UTF-8
1,014
4.1875
4
[]
no_license
"""Given a list of integers, write a function that returns the largest sum of non-adjacent numbers. Numbers can be 0 or negative. For example, [2, 4, 6, 2, 5] should return 13, since we pick 2, 6, and 5. [5, 1, 1, 5] should return 10, since we pick 5 and 5. """ from collections import OrderedDict def largest_sum(lst...
true
c7880a6690bdf4eb487a995ca4a6cbc7b703f348
ssami/python
/pyTutorial/py_essentials/class/04_stdlib/sql.py
UTF-8
1,073
3.375
3
[]
no_license
#sql.py import sqlite3 conn = sqlite3.connect(":memory:") c = conn.cursor() c.execute(''' create table if not exists employees (name text, rank text) ''') # must be a list of tuples employees = [ ("bob", "CEO"), ("betty", "CEO level 2"), ] c.executemany(''' insert into employees values (?, ?) ''', emp...
true
5b26bdcfa831215e1c47daceccd203b46d1d1de5
tailaiwang/Competitive-Programming
/Leetcode/sum-of-root-to-leaf-binary-numbers.py
UTF-8
1,065
3.71875
4
[]
no_license
#Sum or Root to Leaf Binary Numbers #https://leetcode.com/problems/sum-of-root-to-leaf-binary-numbers/ #Easy (Daily Challenge), 11/01/2022 #Tailai Wang # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = l...
true
43f7e2476454fe241d50381d38a2c75714f34221
bamcleod/agwsbench
/agwsvalid-makefields.py
UTF-8
424
2.921875
3
[]
no_license
import numpy as np import pylab as pl nrows = 10000 data = np.zeros((nrows,8)) i=0 for ang0 in [ 90, 180, 270, 0]: r = np.random.uniform(6,10,size=nrows) / 60. ang = np.random.uniform(ang0-45, ang0+45,size=nrows) x = r * np.cos(np.radians(ang)) y = r * np.sin(np.radians(ang)) data[:,2*i] = x d...
true
fecbb110b4d22baa1374e11dcf071470f4645034
jdelamer/Trust_POMDP
/controller/StatisticsExperiments.py
UTF-8
1,307
3.3125
3
[]
no_license
import math import numpy as np class StatisticsExperiments: def __init__(self): self.minimum = [] self.std_minimum = 0 self.maximum = [] self.std_maximum = 0 self.average = [] self.std_average = 0 def add_stats_distances(self, distances, nb_agents): m...
true
669dbd2496ee2f661a2929f75baed462c01e0fef
sanbaideng/image-compare
/src/comAlth/hashTest.py
UTF-8
1,940
2.953125
3
[]
no_license
import PIL from PIL import Image import imagehash lenna400 = PIL.Image.open('9.jpg') lenna512 = PIL.Image.open('81.jpg') lennaText = PIL.Image.open('82.jpg') p = imagehash.phash(lenna400) p1 = imagehash.phash(lenna512) p2 = imagehash.phash(lennaText) print('phash leanna400 : ', p) print('phash leanna512 : ', p1) pr...
true
e1e5c122b80d20637fc462e35508d598a6aef977
Jennifer-Yu/LINE_JENNIFERYU
/draw.py
UTF-8
1,877
3.703125
4
[]
no_license
from display import * def draw_line( x0, y0, x1, y1, screen, color ): #OCTANTS 3-6 (SWITCH ENDPOINTS) if x0 > x1: temp = x0 temp = y0 x0 = x1 y0 = y1 x1 = temp y1 = temp #UNDEFINED SLOPE (VERTICAL LINE) if (x1 - x0) == 0: while y0...
true
3d4cccf2dc8e25e9ab09380f319e54586d71ea79
RobHam99/NumPy-Chess
/chess.py
UTF-8
17,099
3.25
3
[]
no_license
import numpy as np from copy import deepcopy import itertools from colorama import Fore, Back class Piece: def __init__(self, id, team, name): self.id = id self.team = team self.name = name def find_pos(self, board): """ Function to find the indices of the piece chosen ...
true
c2375cab4090bb4f42397ba4f4b67601c1a548d5
puneet87m/Python-Basics
/Python-Basic(local)/GuessingGame.py
UTF-8
771
4.34375
4
[]
no_license
""" Generate a random number between 1 and 9 (including 1 and 9). Ask the user to guess the number, then tell them whether they guessed too low, too high, or exactly right. Extras: Keep the game going until the user types exit Keep track of how many guesses the user has taken, and when the game ends, print t...
true
afb33fb498a3db2415db46b95788bb1b3bcc332c
All3yp/Daily-Coding-Problem-Solutions
/Solutions/324.py
UTF-8
1,067
4.3125
4
[ "MIT" ]
permissive
""" Problem: Consider the following scenario: there are N mice and N holes placed at integer points along a line. Given this, find a method that maps mice to holes such that the largest number of steps any mouse takes is minimized. Each move consists of moving one mouse one unit to the left or right, and only one mou...
true
78328bdb8a1d4647533db259c71b43276201994b
elrreader/LIS5786_Recreational_Activity_Survey
/Load_Flat_File_to_MySQL.py
UTF-8
5,435
3.359375
3
[]
no_license
import logging import sys import datetime import pandas as pd def main(): """Takes in the survey response flat file and creates a SQL text file of insert statements. This command line script ingests the `Recreational Activity Survey (Responses)` flat file provided by Google Forms into a pandas dataframe, sep...
true
99d50d73f492ad3f470ab1911dff549e3cf879d9
ncucjm/notebook
/GNN/paper_code/NAS/graphnas/GraphNas_code/graphnas/search_space.py
UTF-8
1,741
2.609375
3
[ "Apache-2.0" ]
permissive
import torch class MacroSearchSpace(object): def __init__(self, search_space=None): if search_space: self.search_space = search_space else: # Define operators in search space self.search_space = { "attention_type": ["gat", "gcn", "cos", "const", ...
true
90358ea49c42155097cb2f422647f669c09088ff
arvakagdi/Dynamic-Programming
/DP/MinJumps.py
UTF-8
1,992
4.09375
4
[]
no_license
''' Given an array of positive integers, find min jumps you will need to reach end of array. Every integer represents how many steps you can take. Ex: Array = [3,4,1,2,2,7,1,1,1,3] At index 0, we have 3 - i.e we can either go to index 1,2,or 3. Ans: 3 ( 3->4->7->3) ''' # Method 1: Time:O(N^2) ...
true
7048741190c8a03ca8fa210084e2195699ead12b
Dathator/YAProject04
/forms/game_form.py
UTF-8
490
2.5625
3
[]
no_license
from flask_wtf import FlaskForm from wtforms import StringField, TextAreaField from wtforms import SubmitField from wtforms.validators import DataRequired class GameForm(FlaskForm): title = StringField('Название', validators=[DataRequired()]) short_content = TextAreaField("Краткое писание") full_content =...
true
253df64cef3ddb75a460d7fb71f50a27b0639167
sidv/Assignments
/Neethu/Aug17/modules/menudrivenfile/main.py
UTF-8
1,393
3.71875
4
[]
no_license
while True: print("1.create file") print("2.write file") print("3.Delete file") print("4.Read file") print("5.Copy file") print("6.Find certain string inside a file") print("7.compare two file contents and print unique content of both file") print("8.Exit file") choice = int(input("Enter your choice : ")) ...
true
8be01dea894579a1639081f9c520fd60a1db156c
WANGHONGYIN813/Collector
/docs/tlv-parse/docs/udp-send.py
UTF-8
846
2.71875
3
[]
no_license
import socket ip = '0.0.0.0' port = 8000 filepath = "" import sys import getopt def help(): print("-i 0.0.0.0 -p 8000 -f 12.bin\n") def OptParse(argv): global ip global port global filepath try: opts, args = getopt.getopt(argv, "i:p:f:") except getopt.GetoptError: hel...
true
5da0e222ad3027a339e0f75ee4d4ca8016689bc6
MdSaifulIslamSajol/Implementation-of-Word2Vec-Embedding-with-CBOW-and-SkipGram-algorithms-_NLP_-Pytorch-
/SkipGram.py
UTF-8
6,188
2.859375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Oct 1 11:07:11 2021 @author: saifu """ import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import matplotlib.pyplot as plt from torch.utils.data import DataLoader from sklearn.manifold import TSNE #%% #Downloading th...
true
76bce81d928fa4dfac2797f0a60dd80b6071d4ca
Aasthaengg/IBMdataset
/Python_codes/p02973/s519387995.py
UTF-8
513
3.046875
3
[]
no_license
N = int(input()) A = [] for _ in range(N): A.append(int(input())) def binsearch(threshold, lst): left, right = -1, len(lst) while right - left > 1: mid = (left + right) // 2 if lst[mid] < threshold: right = mid else: left = mid return right last=[] for ...
true
33cfa7fbcca4fb5156d73eee71c958921ee33261
HoodCat/python-ch2.4
/for.py
UTF-8
778
4.53125
5
[]
no_license
# for 반복문 a = ['car', 'cow', 'tiger'] for animal in a: print(animal, end=' ') else: print('') # 복합 자료형을 사용하는 for문 l = [('둘리', 10), ('마이콜', 20), ('도우넛', 30)] for data in l: print('이름: %s, 나이: %d' % data) for name, age in l: print('이름: {}, 나이: {}'.format(name, age)) l = [{'name': '둘리', 'age': 10}, ...
true
165f1325039f5c8cf74429af6e987490bf4f7d42
luluwang11/ResumeClassifier
/app/data_clean.py
UTF-8
2,170
2.890625
3
[]
no_license
import numpy as np import pandas as pd from pandas import Series, DataFrame import matplotlib.pyplot as plt import scipy.stats as stats import nltk from nltk.corpus import stopwords from nltk.stem.snowball import SnowballStemmer import re import sys import warnings from sklearn.model_selection import train_test_split f...
true
0e5f90a16b30f49e4c4a1b06de096af908cd228d
mrajp7/python_scripts
/9_Control_Flow.py
UTF-8
1,779
4.0625
4
[]
no_license
# if elif else if True: print("I enter if loop") if False: print("I will be skipped") else: print("I entered else") if False: print("First block") elif False: print("Second block") elif True: print("elif I am printed on third block") else: print("i will be skipped") # for loops # itera...
true
04a12c3f7e8aa5da95ec2d134706483f6e3edc55
jiadaizhao/LeetCode
/1401-1500/1437-Check If All 1's Are at Least Length K Places Away/1437-Check If All 1's Are at Least Length K Places Away.py
UTF-8
310
2.78125
3
[ "MIT" ]
permissive
class Solution: def kLengthApart(self, nums: List[int], k: int) -> bool: lastOne = -1 for i, num in enumerate(nums): if num == 1: if lastOne != -1 and i - lastOne - 1 < k: return False lastOne = i return True
true
4218f5e0dd5adda9e8926a83cec9d2693638fc53
rajatrj16/PythonCode
/PythonCode/Exception.py
UTF-8
563
3.171875
3
[]
no_license
try: f = open('Textfile.txt','r') #f = open('Textfile.txt','w') f.write("Write something into the textfile") #except IOError: except: print("Error: Could not find file or Data") finally: #else: #print("File Found") print("****************************************************************...
true
ce5ca5a6bc6e2f348f9a4216039d4b52eeeffd0d
PhungXuanAnh/data-structures-and-algorithms
/sorting/quick_sort.py
UTF-8
4,953
4.46875
4
[]
no_license
# -*- coding: utf-8 -*- """ Quick sort Quick sort is based on the divide-and-conquer approach based on the idea of choosing one element as a pivot element and partitioning the array around it such that: Left side of pivot contains all the elements that are less than the pivot element Right side contai...
true
8dfdf02c853b8f70dcd77b63172704d9e44b0731
Rahul-Krishna14/Self-driving-Car-
/Models/Training.py
UTF-8
1,191
2.734375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Dec 20 12:04:29 2020 @author: Rahul K """ from utils import * from sklearn.model_selection import train_test_split ### loading IMG path path = r'D:\car simulator\data' # image fun from util data = ImageData(path) # Normalizing data = normalizeData(data) # loading IMG and...
true
063eebe66bcf4883c6e5020c71ae96d2e577920b
QIAOZHIBAO0104/My-Leetcode-Records
/1812. Determine Color of a Chessboard Square.py
UTF-8
226
3.09375
3
[]
no_license
''' https://leetcode.com/problems/determine-color-of-a-chessboard-square/ ''' ''' Time:O(1) Space:O(1) ''' class Solution: def squareIsWhite(self, c: str) -> bool: return True if (ord(c[0])+int(c[1]))%2 else False
true
0384feb034ce2a3e75dd694f8665cb5b8fd54023
imann24/code_samples
/models.py
UTF-8
5,689
3.21875
3
[]
no_license
# Author: Isaiah Mann # Description: A models file for a Python Django Web Application for finding people to carpool with from __future__ import unicode_literals from django.db import models import datetime from geopy.geocoders import Nominatim from carpool.bounding_box import BoundingBox from carpool.algorithm import ...
true
08ed141d4be164b2550cccaeff06b9408fc3e1bb
Everything-VMware/vmware-sd-wan-velocloud-bi-intake
/Functions/vco_calls.py
UTF-8
11,103
2.6875
3
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
""" Copyright 2018-2020 VMware, Inc. SPDX-License-Identifier: BSD-2-Clause With a properly authenticated VCO Connection, these calls MUST NOT return any errors to the caller All data calls MUST return a tuple On successful calls: First item MUST be the object/s requested Second item SHOULD be a No...
true
21a293d80d3f17110ee4bfb9f447addef359b1bb
sm4machinelearning/hobby
/Machine Learning in Finance/Week 2/assignment2_part2.py
UTF-8
491
3
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Sep 9 14:31:24 2020 @author: Casper Witlox (426233) """ "perform assignment 2" import pandas as pd from sklearn.linear_model import Lasso #adjust data df = pd.read_csv('trainingSet.csv') outcome = df["Outcome"] del df["Outcome"] X = df #declare LASSO vari...
true
17aea74248c9bdfe9099178efed76cd229c2cec0
jenifaelle/blitz2017
/src/pathfinder.py
UTF-8
1,896
2.96875
3
[ "MIT" ]
permissive
from game import Game, TAVERN, TavernTile import math def get_our_hero_id(game): for hero in game.heroes: if hero.name == "Natural 20": return hero.id class Pathfinder: def __init__(self, game): assert isinstance(game, Game) self.game = game self.our_he...
true
444d913690377e9aad4c59ce4515ebd2b69a0f88
tpsoe/CS4650
/test.py
UTF-8
290
2.8125
3
[]
no_license
from pandas import Series, DataFrame import pandas as pd import numpy as np df = pd.read_csv("Salaries.csv") # print(df.tail(10)) # print(df.head(100)) # print(df['salary'].dtype) # print(df.dtypes) # print(df.axes) # print(df.std()) # m = df.head(50) # print(m.mean()) print(df.std())
true
243be4b587c97d85b004e18e44cff33298caf714
dekuRockShooter/numerical_analysis
/HW3/Rom.py
UTF-8
1,314
3.171875
3
[]
no_license
import numpy as np from math import * #romberg integration over a function, not a set of points # initial ,final , function to pass, number of devisions def romberg_integration(x_i, x_f, funct, max_divs): #max_divs should be a power of 2 estimates = [] temp = [] iteration = 1 ret_val = 0 #trapezoids for i in ...
true
a8d74ba26dc826bc6400a7ad81190c85cdc00b44
AlexandraKovalenko/amis_python
/km72/Kovalenko_Olexandra/Homework 9/Task 2.py
UTF-8
188
3.5
4
[]
no_license
a,n = float(input()),int(input()) def power(a,n): if n == 0: return 1 elif n>0: return a*power(a,n-1) else: return 1/a*power(a,n+1) print (power(a,n))
true
d44d7b439a8b2ed8ceee4729956c59a1a6e856f1
Nicholas42/Bwinf34-2
/Aufgabe2/aufgabe2.py
UTF-8
13,839
3.171875
3
[]
no_license
#!/bin/env python3 from datetime import datetime, timedelta import fortschritt DirToStr = {(0, 1): 'O', (1, 0): 'S', (0, -1): 'W', (-1, 0): 'N', (0, 0): '_'} StrToDir = {'N': (-1, 0), 'W': (0, -1), 'S': (1, 0), 'O': (0, 1), '_': (0, 0)} twoxtwo = [{(0, 1): (0, 1), (1, 0): (1, 1), (0, 0): (0, 0), (1, 1): (1, 0)}, ...
true
3815128bd4c2e24b24a7c2214fd5afae658c3d30
Ishant89/toolTracker
/ToolTracker/python_temp
UTF-8
378
3.46875
3
[]
no_license
#!/usr/bin/python import sys if len(sys.argv) < 5: print "less number of args" exit(-1) print "File arg is as " with open(sys.argv[1],'r') as temp1: for x in temp1: print x print "Integer arg is as " print str(sys.argv[2]) print "Float arg is as " print str(sys.argv[3]) print "String arg is...
true
76270d288fc338d423d6eccde0e00d920de9702c
minkookBae/algorithm_prac
/BOJ_2903.py
UTF-8
208
3.171875
3
[]
no_license
import sys N = int(sys.stdin.readline()) dp = [0 for _ in range(15)] # dp[0] = 2*2 # dp[1] = 3*3 # dp[2] = 5*5 # dp[3] = 9*9 cnt = 2 for i in range(15): cnt += cnt-1 dp[i] = cnt**2 print(dp[N-1])
true
bb33ea63cbc0b4ea95909039359f9183afa008f9
sssalam1/Optimization-Codes
/Ant_Colony_Optimization.py
UTF-8
2,420
2.5625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Sep 21 11:32:31 2019 @author: Salam Saudagar """ import numpy as np, math dist_vec = np.random.uniform(0,100,6) dis_mat = np.array([[0,dist_vec[0],dist_vec[1],dist_vec[2]], [dist_vec[0],0,dist_vec[3],dist_vec[4]], [dist_ve...
true
c922fcd169294ffb9b2e52e9be208a44dc9dac92
mukesh1011/Python123
/Scope/filesanddirectories.py
UTF-8
204
3.015625
3
[]
no_license
import os listing = os.walk('.') #print(sorted(listing)) for root, direcotories, files in listing: print(root) for d in direcotories: print(d) for file in files: print(file)
true
e599911faf04f59375d84311d6e2e51752024233
hamidb/interview-questions
/python/algorithm/isomorphic_trees.py
UTF-8
2,458
3.359375
3
[]
no_license
"""Isomorphism""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from adt.graph import Graph class TreeNode: def __init__(self, key, parent=None): self.key = key self.parent = parent self.children = [] def add_child(self, child): asser...
true
1fe497f24d32f63cbe4d50ebc8fedc2b83d88b87
maybedy/MLDLStudy
/week1/JY/perceptron.py
UTF-8
1,732
3.5625
4
[ "MIT" ]
permissive
import numpy as np ####################################### # AND, OR, NAND, XOR using PERCEPTRON # ####################################### def step_function(x): y = x > 0 return y.astype(np.int) def AND(x1, x2): x = np.array([x1, x2]) w = np.array([0.5, 0.5]) b = -0.7 tmp = np.sum(w * x) + ...
true
93aaf2e14c04665bbf6274fc16b3ea321f57cec9
jakesant/tsp_machine_learning
/travellingsalesman.py
UTF-8
2,977
3.359375
3
[]
no_license
import tsplib95 #https://tsplib95.readthedocs.io/en/stable import acopy #https://acopy.readthedocs.io/en/latest/ from satsp import solver #https://pypi.org/project/satsp/ import time """Instances and their best known solutions http://elib.zib.de/pub/mp-testdata/tsp/tsplib/stsp-sol.html berlin52 : 7542 st70 : 675 pr10...
true
57c083a7740935f2ee67167e13b235b10951c83c
daojinjin/dPCR
/dPCR_Gui/my_lib_ever/disheDetect.py
UTF-8
5,978
2.578125
3
[]
no_license
import sys import math from PyQt5.QtWidgets import QWidget, QApplication import pyqtgraph as pg from ImageAnalysisTools import * from sklearn.linear_model import LinearRegression import matplotlib.pyplot as plt from tensorflow import keras from keras_preprocessing import image new_model = keras.models.load_m...
true
34a9d9093462aede318c580cb9873ced47784fca
markpal/islplot
/islplot/plotter3d.py
UTF-8
840,650
2.921875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
from islplot.support import * # color scheme # http://colorschemedesigner.com/#01400w0w0w0w0 colors = [] # red colors.append({'base': '0xff0700', 'light': '0xff7673', 'dark': '0xA60400'}) # blue colors.append({'base': '0x3B14Af', 'light': '0x886E7D'}) # yellow colors.append({'base': '0xFFD500', 'light': '0xFFE873'...
true
31a364ee93790252ed784d80ca21547d8698ee5a
chengyi818/kata
/Language/python/grammer/generator/generator_fib.py
UTF-8
624
3.015625
3
[]
no_license
#!/usr/bin/env python3 ''' # ============================================================================= # FileName: test.py # Desc: # Author: ChengYi # Email: chengyi@antiy.cn # HomePage: http://www.antiy.com/ # Created: 2016-12-06 10:24:32 # Version: 0.0.1 # LastChan...
true
453de763e2cd4850ebee6d446674c3d43cdf3aa3
johnbomba/python-scripts
/blue-team/05-network-logs.py
UTF-8
1,433
2.59375
3
[]
no_license
#!/usr/bin/env python3 import sys import re ip_count = set() term_count = {} def read_log(logfile): with open (logfile, 'r') as f: for line in f: read_src(line) read_dst(line) protocols(line) def read_dst(line): search = re.search(r"DST=\b(?:\d{1,3}\.){3}\d{1,3}\...
true
39db64429c2cef189f045b5861d00205d69b9e29
jacksonyoudi/AlgorithmCode
/PyProject/sparkproject/rdd/actions/foreach.py
UTF-8
288
2.515625
3
[]
no_license
# coding: Utf-8 from pyspark import SparkConf, SparkContext if __name__ == '__main__': conf = SparkConf().setAppName("rdd").setMaster("local[*]") sc = SparkContext(conf=conf) data = [i for i in range(1, 11)] disData = sc.parallelize(data, 10) disData.foreach(print)
true
24d0e9c4465a417aa140f6a9540b010ae609072e
haolin-ds/DataAnalysis
/bioinformatics/delete_know_ab.py
UTF-8
1,562
2.953125
3
[]
no_license
"""Exclude the proteins which is similar to known antibody. Extract the protein ids which has high similarity reported in blastp result of a given antibody sequence vs antibody database. Exclude these ids to generate a new antibody database """ import re def extract_protein_id_from_blastp_result(blastp_ou...
true
8ce0cd9d7d7763ef69236e1df6ce05dc8314c8d7
darsovit/pyRayTracerChallenge
/tests/features/steps/materials.py
UTF-8
7,027
2.828125
3
[ "MIT" ]
permissive
#! python # # steps for materials feature from behave import given, then, when from renderer.material import Material from renderer.bolts import Color, Point from math import isclose @given(u'{materialvar:w} ← material()') def step_impl(context, materialvar): print(u'STEP: Given {} ← material()'.format(materialv...
true
bfba247e4038312f7d01b4dfe88c63d5cd4778aa
DaHuO/Supergraph
/codes/CodeJamCrawler/16_0_3_neat/16_0_3_El_Moatasem_C.py
UTF-8
2,897
2.890625
3
[]
no_license
''' Created on Mar 19, 2016 @author: elmoatasem ''' # import itertools # def findsubsets(S,m): # return set(itertools.combinations(S, m)) # # # def get_jim_coins(N,J): # for i in # # # # def get_all_cases(n,i,coinList,coinString): # if(i == n): # coinString. # ret # for i i...
true
6dfc425c44c9544c83a6c191eed9250bf9e94f07
carlmoore256/FingerprintDNN
/generate_fingerprints.py
UTF-8
5,891
2.609375
3
[]
no_license
import numpy as np import librosa import os from os import walk import fingerprint N = 2048; frameHop = 64; # this is the frame hop within a fingerprint printHop = 2048; # this is the hop between full multi-frame prints printDur = 20; # desired fingerprint length in milliseconds minFreq = 150; maxFreq = 18000; maxEx...
true
c66e995444b8fbb8ded07bb379b664b7854e82b9
deepnov/pyxssparser
/tests/mjsunit/parse_mjsunit.py
UTF-8
382
2.59375
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/python2.5 import sys, os sys.path.append(os.path.join(os.pardir, os.pardir)) import jsparser as js def main(argv): try: filename = argv[1] source = file(filename, "r").read() except: print "Usage: %s <source.js>" % argv[0] print str(js.parse(source, filename)) retu...
true
58f81b513c005ef2f023d9b9fff1d2b7f23bbf34
zcmail/NeuralLikelihoods0
/code/models/nn_pdf_common.py
UTF-8
5,695
2.5625
3
[]
no_license
import tensorflow as tf from models.utils import constrain_cdf, add_all_summary_stats, print_tensor, get_activation def create_weights(shape): w=tf.get_variable(name="weights", shape=shape, dtype=tf.float32) add_all_summary_stats(w) return w def create_bias(units=None, initializer=None, clip_min = None,...
true
87f13d12e4a5f616a0ed05a18ac816de5a43fa4f
ichimunemasa/python
/CollaborativeFiltering/treatMatrix.py
UTF-8
572
3.3125
3
[]
no_license
#-*- coding: utf-8 -*- #行列の転置 def transformMatrix(matrix): result = {} for row in matrix: for column in matrix[row]: result.setdefault(column,{}) result[column][row] = matrix[row][column] return result #行列の掛け算 def multiplication(matrixFirst,matrixSecond): result = {} for row in matrixFirst: re...
true