blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
133
path
stringlengths
2
333
src_encoding
stringclasses
30 values
length_bytes
int64
18
5.47M
score
float64
2.52
5.81
int_score
int64
3
5
detected_licenses
listlengths
0
67
license_type
stringclasses
2 values
text
stringlengths
12
5.47M
download_success
bool
1 class
7b62691a1c877d01e69fc89db89745678495039e
Python
ankan17/popper
/cli/popper/commands/cmd_parameters.py
UTF-8
2,491
2.5625
3
[ "MIT" ]
permissive
import click import popper.utils as pu import sys from popper.cli import pass_context from popper.exceptions import UsageError @click.command('parameters', short_help='Parametrize a pipeline pipeline.') @click.argument('pipeline', required=False) @click.option( '--add', multiple=True, help='Add a set of ...
true
c4571a920987e85e13fba28e7a3eaf9d5c119662
Python
wolfdale/10MinutesEmailWrapper
/tinker.py
UTF-8
157
2.625
3
[ "MIT" ]
permissive
//USe this to copy to clipboard from Tkinter import Tk r = Tk() r.withdraw() r.clipboard_clear() r.clipboard_append('i can copy to clipboardz?') r.destroy()
true
33a2b73840a156308c375037b36e3e07bbd52218
Python
zuzinmeko/Python_lessons
/Chapter1/numError.py
UTF-8
231
3.125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Sep 3 12:16:58 2021 @author: hp """ from math import sinh, exp, e, pi x = 2*pi r1 = sinh(x) r2 = 0.5*(exp(x) - exp(-x)) r3 = 0.5*(e**x - e**(-x)) print('%.16f %.16f %.16f' % (r1,r2,r3))
true
900dcfbea1790d43f3c68324dcf3df3afa194321
Python
WalLee2/holbertonschool-higher_level_programming
/0x04-python-more_data_structures/10-best_score.py
UTF-8
145
2.71875
3
[]
no_license
#!/usr/bin/python3 def best_score(my_dict): if not my_dict: return None winner = max(my_dict, key=my_dict.get) return winner
true
1da265d06ef1143bdeefcc36b22892e52c39b6f0
Python
leekyeongm727/pythonProject
/chapter4/4-4.py
UTF-8
132
2.921875
3
[]
no_license
n,m = map(int, input().split()) x,y,d = map(int, input().split()) #캐릭터가 서 있는 위치 (x,y), 바라보고 있는 방향
true
26938f2bd4d9e5b010bffa0251d4041bf6639f72
Python
MellaLee/hello-vue-django
/backend/algorithm/step/preprocessing.py
UTF-8
525
2.734375
3
[ "Unlicense" ]
permissive
#暂时无需对数据进行预处理,此文件不需要运行 import pandas as pd import os date = '2018.06.04' csv_file_path = r'D:\GraduationThesis\graduation-code\hello-vue-django\backend/algorithm/download/originData/' + date def startRun(): os.chdir(csv_file_path) files = os.listdir(csv_file_path) for filename in files: print (f...
true
1dfe1b4973d6a482a4ccc9583213e7b494e3a9c8
Python
basaima/-----------
/定义函数.py
UTF-8
803
3.8125
4
[]
no_license
'''def mya(x): # x=int(input(':>')) if not isinstance(x,(int,float)):#对参数类型做检查,只允许整数和浮点数类型的参数数据类型检查可以用内置函数isinstance()实现 raise TypeError('bad op type') #if not isinstance(x, (int, float)): # raise TypeError('bad operand type')# if x>=0: print (x) return x else: p...
true
3e638d3e84875ece33777569bdcb102d9173e217
Python
tiqwab/atcoder
/abc214/c/main.py
UTF-8
561
2.53125
3
[]
no_license
def main(): N = int(input()) ss = [int(x) for x in input().split(' ')] ts = [int(x) for x in input().split(' ')] min_idx = -1 min_t = 1000 * 1000 * 1000 + 10 for i, t in enumerate(ts): if t < min_t: min_idx = i min_t = t acc = min_t i = min_idx ans =...
true
7f4e29b658017688565963c06b3b2880ca11c58d
Python
ronnyandersson/zignal
/examples/ex_chunks.py
UTF-8
2,547
3.40625
3
[ "MIT" ]
permissive
''' Created on 12 Apr 2020 @author: Ronny Andersson (ronny@andersson.tk) @copyright: (c) 2020 Ronny Andersson @license: MIT Demo of how to iterate over an instance of the Audio class, for chunk-based processing. Typically the chunks have a size that is a power of two, for example 256, 1024 or 4096. In this example th...
true
e418f6cc0874131a6f6354e7b847fde0281ed10e
Python
lumc-python/functions-bdmvantol
/Functions_Exercise 1.py
UTF-8
233
3.4375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Nov 27 10:37:28 2019 @author: Bianca """ def max(number1, number2): if number1 > number2: return(number1) else: return(number2) print(max(13,16)) print(max(25,3))
true
424c0377c193a830799020c8a43b8879ad397bc0
Python
fernandaassi/minicurso-python
/minicurso-Python/aula-2/listas/ex-6.py
UTF-8
420
4.5
4
[]
no_license
''' ***** Exercício 6 ***** Dada a seguinte lista: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] imprima somente os números pares dessa lista. ''' # Cria a lista lista = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] # Armazena os números pares na lista "pares" # Para isso é usado a indexação, começando no index 0, indo até o index 10 e pulando ...
true
3f6ff09a8bd21d80a95ad5474b8cd6bf76c0cf9b
Python
luisa-brueser/OSESM_1st-Homework
/function.py
UTF-8
1,034
2.828125
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- """ Created on Wed May 6 09:32:28 2020 @author: zwickl-nb """ # function from the lecture for testing def add(a, b): return a + b # check whether enough capacities are available # note: yet not able to include a panda framework to test_validate # that is why data type int ...
true
ffd70d93a5121222a71190938f4a85b88f8cd8a1
Python
shengng325/LeetCode.py
/subsetSum.py
UTF-8
470
3.125
3
[]
no_license
def allSubsetSum(array): subsetSumArray = [] allSubsetSumHelper(array, 0, subsetSumArray, 0) return subsetSumArray def allSubsetSumHelper(array, idx, subsetSumArray, curSum): if idx >= len(array): subsetSumArray.append(curSum) return allSubsetSumHelper(array, idx + 1, subsetSumArra...
true
cf9f6e3dc97b16a0136d233d5597e0f7583ef4cc
Python
littlebai3618/bspider
/bspider/master/controller/node.py
UTF-8
2,750
2.828125
3
[ "BSD-3-Clause" ]
permissive
""" 所有和 Agent 进行交互的操作收缩到 node 蓝图下 1. 提供注册接口用于注册新 node 2. 删除接口删除节点 node 停止节点下所有work => 删除worker 表中节点对应的所有信息 => 停止Agent进程(supervisor) 4. 查询接口查询 节点信息 返回节点和节点下已经注册的所有worker信息 5. 停止节点 6. 启动节点 5. 在节点下启动并在master注册一个worker 启动进程 => 成功后注册进表单 6. 在节点下停止一个 worker 停止进程 status 设置为0 7. 在节点下重启一个 worker 停止进程、启动进程 8. 删除一个 worker 停止进程并删除...
true
249876f932451357a66c1a97efe3eccf161e3124
Python
drewvlaz/CODE2RACE
/SOLUTIONS/yP_ASCIIProduct.py
UTF-8
92
3.375
3
[]
no_license
var= input() lvar= list(var) x=1 for a in range(0, len(lvar)): x= x*ord(lvar[a]) print(x)
true
92989873a31ff82a1f6b57c7f5fa369b7c63e5b0
Python
HitanshuSoni/Python_practice
/DemoTupleToList.py
UTF-8
265
3.109375
3
[]
no_license
tup1=(32,43,65,67,[54,89],98,76,(65,94,92)); lst1=list(tup1) lst2=[] i=0 for val in lst1: if isinstance(val,tuple): lst2=list(val) lst2[0]=99 tup2=tuple(lst2) lst1[i]=tup2 i+=1 tup1=tuple(lst1) print(tup1)
true
884ad78ec019f27a3121d8740188285fbf3de707
Python
13scoobie/advent-of-code
/2020/day3/problem_3_part_1.py
UTF-8
1,381
3.796875
4
[]
no_license
# Turns out you get greeted with this message: # Puzzle inputs differ by user. Please log in to get your puzzle input. # which is pretty cool :) # might look later at cookie or something, just use browser and copy for now """ import requests def get_puzzle(): resp = requests.get("https://adventofcode.com/2020/day...
true
a2cac84658f3fb38615671f19a9e1f88d8d8f531
Python
anarkia7115/g4g
/coin_change/sol.py
UTF-8
2,477
3.0625
3
[]
no_license
MAX_COIN_SIZE = 399 class CoinChange(object): def __init__(self): self.methods_limited_by_coin = dict() pass def save_and_return(self, big_money, coin_change, methods_count): if big_money not in self.methods_limited_by_coin: self.methods_limited_by_coin[big_money] = dict()...
true
805f46ee69b508241c5e28de4433519e6348c581
Python
raghuu14/Scrambling-of-text
/scrambled.py
UTF-8
506
2.921875
3
[]
no_license
import random f = open("C:\\Users\\Admin\\Documents\\my doc\\sample.txt","r") f1 = open("C:\\Users\\Admin\\Documents\\my doc\\samplescrambled.txt","w") newone = f.read() word1 = newone.split() for i in word1 : if len(i) <= 3 : f1.write(i) f1.write(" ") else : data = i[1:-1] ...
true
d2445d8fafc27fcfc18924064f1699409fd9345c
Python
ADExxxxxx/local_libary
/机器学习相关/SupportVector.py
UTF-8
2,761
2.921875
3
[]
no_license
""" item: 支持向量机相关算法实现 author by WIT_lyp timestamp: 2019/11/6 18:14 """ from sklearn.metrics import classification_report, confusion_matrix from sklearn.svm import SVC from datetime import datetime from sklearn.metrics import accuracy_score, \ precision_score, recall_score, f1_score, cohen_kappa_score im...
true
c948c898e0ba49e1bccdcba614a972737164319f
Python
cepGH1/dfesw3cep
/pyth5.py
UTF-8
331
3.6875
4
[]
no_license
colNum = int(input("how many columns would you like? ")) rowNum = int(input("how many rows would you like? ")) print(colNum*rowNum) my2DArray = [[0 for col in range(colNum)] for row in range(rowNum)] print(my2DArray) for row in range(rowNum): for col in range(colNum): my2DArray[row][col] = row*col print(m...
true
6cf1b5e30d10795ee616e33e8073e3841fee6946
Python
rlandesman/CS103-pythonDataStructures
/Huffman Project/huffman.py
UTF-8
13,889
3.78125
4
[]
no_license
# ----------------< Module Imports >----------------- import unittest import os.path import array_list from linked_list import * from huffman_bits_io import * # ----------------< Class for Leaf >----------------- class Leaf: def __init__(self,ordinal,count): self.ordinal = ordinal self.count = coun...
true
58c454f4780bebc8d05fbbbb449c2c2b582471d7
Python
williamfhe/advent-of-code-2017
/Day 25/turing_part1.py
UTF-8
1,103
3.109375
3
[]
no_license
from collections import defaultdict state_actions = { 'A': { 0: { "write": 1, "move": +1, "next": 'B' }, 1: { "write": 0, "move": -1, "next": 'B' } }, 'B': { 0: { "write": 1, "move": -1, "next": 'C' }, 1: { "write": 0, "move": +1, "next": 'E' } }, 'C': { 0...
true
2dc4841435f5df54dd74d094b59050d0355bf065
Python
nimiq-community/python-client
/example/example.py
UTF-8
685
2.671875
3
[ "Apache-2.0" ]
permissive
from nimiqclient import * # Create Nimiq RPC client client = NimiqClient( scheme="http", user="luna", password="moon", host="127.0.0.1", port=8648 ) try: # Get consensus consensus = client.consensus() print("Consensus: {0}".format(consensus)) if consensus == ConsensusState.ESTABLISHED: # ...
true
b84ce12ac90eb740f40d1816fd4a27b2c6abb351
Python
Aasthaengg/IBMdataset
/Python_codes/p02850/s676832975.py
UTF-8
744
2.640625
3
[]
no_license
n=int(input()) kotaezyun=[] renketu=[[] for i in range(n+1)] ans_dict={} for i in range(n-1): a,b=map(int, input().split()) renketu[a].append(b) kotaezyun.append([a,b]) from collections import deque que=deque() que.append(1) iro=[-1]*(n+1) iro[1]=0 irokazu=0 tansaku_moto=[1] while que: tansaku_moto...
true
14c3f8918577b40f06aa60ac1bb9b7c7e3b4abec
Python
hicdnh/Adong_Chen_GitProject
/Auto_UI_Test/main.py
UTF-8
976
2.59375
3
[]
no_license
#!usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/5/23 15:03 # @Author : Adong_Chen # @Email : hicdnh@163.com import settings from selenium import webdriver import cases import time def get_func_names(__driver): cases_lst = [] for i in settings.SMOKE_TEST_CASES: case = getattr(cases.smoketest.Smo...
true
0ec4b53467e922d70597374ed4b3cdaf948c9a9a
Python
Aasthaengg/IBMdataset
/Python_codes/p03239/s101251567.py
UTF-8
217
2.59375
3
[]
no_license
N, T = map(int, input().split()) l = [] for _ in range(N): l.append(tuple(map(int, input().split()))) di = dict(l) keys = [k for k, v in di.items() if v <=T] if keys: print(min(keys)) else: print("TLE")
true
cc05afe64f2b2bc80343b70741513fc24229dba4
Python
ZhaoQian888/try
/try.py
UTF-8
890
3.640625
4
[]
no_license
class employee: def __init__(self, *args, **kwargs): self.name=args[0] self.position=args[1] print("I am employee") pass def funcion1(self,*args): print(args) pass class employer: def __init__(self, *args, **kwargs): print("my name is ",args[0]) pass x...
true
486b23ce39f551793d587b2fcf061f6e97aa8c2b
Python
Kawser-nerd/CLCDSA
/Source Codes/AtCoder/abc057/B/4881622.py
UTF-8
261
2.578125
3
[]
no_license
N,M=map(int,input().split()) X=[list(map(int,input().split())) for i in range(N)] check=[list(map(int,input().split())) for i in range(M)] for x,y in X: dist=[abs(x-c[0])+abs(y-c[1]) for c in check] MIN=min(dist) print(dist.index(MIN)+1)
true
6d385c812a4babd165040d17f7c5ffe3f12184e7
Python
praneethreddypanyam/DataStructures-Algorithms
/Graphs/MinimumCostPath.py
UTF-8
1,561
2.6875
3
[]
no_license
from collections import deque import sys row = [-1,1,0,0] col = [0,0,1,-1] def valid(i,j,m,n,visited): return i >=0 and i < m and j >=0 and j < n and visited[i][j] == False def shortestPath(srcI,srcJ,posI,posJ,n,m,a): global row, col if posI == srcI and posJ == srcJ: return a[posI][posJ] visi...
true
5acf7bafbdb2b96842549d8c34a086c6e59987d3
Python
AlexanderLazarev/emc-game
/python/log_functions.py
UTF-8
977
2.921875
3
[]
no_license
# -*- coding: utf-8 -*- # Модуль с функциями для логирования import datetime from constants import LOG_DIR def log(message, prefix = 'Main'): prefix = '[' + prefix + ']' now = datetime.datetime.today() date = now.strftime("%m.%d.%Y") time = now.strftime("%H:%M:%S") log_file = open(LOG_DIR + 'log_'...
true
32006dfceb4c6d3ce013c2aeda3d1de8b451a72c
Python
NandakrishnanR/intermediate-programming
/Desktop/opencv/leap.py
UTF-8
689
4.28125
4
[]
no_license
year = 2000 # To get year (integer input) from the user # year = int(input("Enter a year: ")) if (year % 4) == 0: if (year % 100) == 0: if (year % 400) == 0: print("{0} is a leap year".format(year)) else: print("{0} is not a leap year".format(year)) else: print("{0} is a...
true
b5f3743448d2ad35595dac571ff72e65d4d65a64
Python
srik1040/hackerrank-py-solutions
/Introduction/py-if-else.py
UTF-8
230
3.34375
3
[]
no_license
N = int(raw_input().strip()) if N % 2 != 0: print "Weird" elif N % 2 == 0: if N>=2 and N<=5: print "Not Weird" elif N >=6 and N <= 20: print "Weird" elif N > 20: print "Not Weird"
true
f4d5ff9145aaef162bd2d157bd598d3443908659
Python
shlokabhardwaj/housing_eda
/life cycle of project part 1.py
UTF-8
830
3.1875
3
[]
no_license
## ...............................LIFE CYCLE OF PROJECT.................................. ## 1. Data Analysis ## 2.Feature Engineering ## 3. Feature Selection ## 4. Model Building ## 5. Model Deployment ##..................................Data Analysis................................... import pandas as pd im...
true
16067f3f643be904d5756ad3568a43accf1a223f
Python
iang12/grafo_labirinto_binario
/grafo.py
UTF-8
2,524
3.203125
3
[]
no_license
from random import * matriz_grafo = [] matriz_visitas = [] lista_de_posicoes = [] posicao_inicial = [] posicao_final = [] lista_de_passos = [] passo = 1 #matriz de visitas #print(matriz_visitas) f = open("entrada.txt", "r") dim = f.readline().replace("\n","").split(" ") n = int(dim[0]) #numero de linh...
true
e6ace0a0e8f736935ae5f4b074e68aa98f6338a5
Python
rohbot/Singing-Plants-python
/PdConnection.py
UTF-8
768
3.0625
3
[]
no_license
import socket class PdConnection: def __init__(self, address, port): self.__address = address self.__port = port self.__socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.__connect() def __enter__(self): return self def __exit__(self, type, value, tra...
true
1766b5e7dc60da51f4c630776b5cb9769f1c190f
Python
jchenluo/Src-Assert-Collection
/core/util.py
UTF-8
1,389
2.5625
3
[]
no_license
# -*- coding: utf-8 -*- # @Time : 2020/5/27 11:47 # @Author : huha import os,re,urllib3 from selenium import webdriver urllib3.disable_warnings() # 正则匹配获取一级域名 def get_one_level_domain(path): key_list = [] with open (path,'r',encoding='utf-8') as f: url = f.readline() while url: url_...
true
8cc6cf370c2e35f1624181f4c143d5b8bc05a49a
Python
Aasthaengg/IBMdataset
/Python_codes/p02616/s988680128.py
UTF-8
1,360
2.875
3
[]
no_license
def make_set_list(array,valid): new_array = [] for i in range(len(array)//2): new_array.append(array[2*i]*array[2*i+1]) if len(array)%2 == 1 and valid == 1: new_array.append(array[len(array)-1]) return new_array N, K = list(map(int,input().split())) As = list(map(int,input().split())) p...
true
6c1332178f8ceb620f5782e5f7dc86c94aa48c64
Python
JuanPabloGonzalezA/Analytics
/16x32/16x32_meses.py
UTF-8
1,892
2.96875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as anm dias=["Lunes","Martes","Miercoles","Jueves","Viernes","Sabado","Domingo","Festivo","Antes Festivo"] cdias=[42,52,47,49,51,52,42,15,15] n=9 datos=np.loadtxt('choques3.txt').reshape((31,14,n))#y,x,d print datos.shape print datos[7,6,0]...
true
f07c1274273afa1a8887600189a0ba9001861ae9
Python
raushan007/InstaAutomation
/unfollow.py
UTF-8
2,034
2.953125
3
[]
no_license
#importing all library from selenium import webdriver from selenium.webdriver.common.keys import Keys from time import sleep from selenium.common.exceptions import TimeoutException from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support.ui import Select from selenium.webdriver.c...
true
8a41037dab86e01a3c6a390483f7733084cb4c68
Python
nopasanadamindy/Algorithms
/01. List 1/02. List1 실습/전기버스_1.py
UTF-8
1,389
3.234375
3
[]
no_license
def find(power): last = 0 + K # 0 다음부터 시작 cnt = 0 while last < N: # 도착보다 작은 동안에 # 충전소 있으면 cnt 증가 if power[last]: cnt += 1 # 충전소 없으면 충전기를 찾을 때 까지 이동 위치를 K-1, K-2처럼 하나씩 줄여감 # 만약 K=0이 되면 종점에 도착할 수 없는 경우임 else: i = 0 flag = 0 # 0...
true
a0ba7c94e1a24729f1c4e35015200035a6159f8b
Python
britig/Document-Summerization
/TextRank.py
UTF-8
6,790
3.296875
3
[]
no_license
# program for implementation of TextRank for summarization of a given text document import os #importing nltk package for preprocessing steps from nltk.tokenize import sent_tokenize, word_tokenize from nltk.tokenize import word_tokenize from nltk.corpus import stopwords from operator import itemgetter import...
true
0de35fa3441ef0f26aef4fd8cf388b07d2b24762
Python
mrtwon/ShopScript
/DatabaseLogicJobs.py
UTF-8
1,732
3.0625
3
[]
no_license
import sqlite3 import DatabaseQuery class DBJobClass: db = DatabaseQuery.MainDatabaseQuery() queryCreate = "CREATE TABLE job(id integer primary key, summery text)" queryUpdateJob = "INSERT INTO job(summery) VALUES('{}')" queryGetData = "SELECT summery FROM job ORDER BY id DESC LIMIT 1" queryGetID...
true
e4a29b11f6b9b53acecdc85ece9225d4fca9379f
Python
plahteenlahti/tiras20
/fliptwo.py
UTF-8
271
3.25
3
[]
no_license
from collections import deque def solve(n,k): l = deque(range(1,n+1)) for i in range(k): l.append(l[1]) l.append(l[0]) l.popleft() l.popleft() return l[0] if __name__ == "__main__": print(solve(4,3)) # 4 print(solve(12,5)) # 11 print(solve(99,555)) # 11
true
1e4dfd5976b2642e94fb56beee9c408637927318
Python
BahaNordi/TicTacPillClassification
/data_loader/tictac_loader.py
UTF-8
1,763
2.5625
3
[]
no_license
import os import numpy as np # import scipy.misc as misc import torch from torch.utils import data from train_utils.train_config import config from PIL import Image class TicTacLoader(data.Dataset): def __init__(self, root_dir, tictac_file_list, augmentations=None, transform_image=None): self.augmentati...
true
eb04c695161e0acf7dbc54505c1384735742fb6a
Python
weishengteo/storage
/FIT1045/w11labtasks/w11t1.py
UTF-8
2,534
3.46875
3
[]
no_license
#Name = Teo Wei Sheng #Student ID = 29800668 #Date = 28 May 2019 #Workshop 11 #Task 1 heap = [1,3,2,7,4,8] def min_child(v, heap): left = 2*v + 1 right = 2*v + 2 if right>len(heap)-1 and left<=len(heap)-1: return left elif heap[right]> heap[left]: return left elif he...
true
e60843e589078155424101371ae1d596e3107d15
Python
CraigLangford/Python-Mini-Projects
/Phone-Book/phonebook_project/phonebook_project/phonebook/tests.py
UTF-8
1,325
2.71875
3
[ "MIT" ]
permissive
from django.test import TestCase from django.core.urlresolvers import resolve from .models import Book, Contact class TableAndItemsModelTest(TestCase): def test_saving_and_retrieving_items(self): book = Book() book.save() first_contact = Contact() first_contact.first_name = "Char...
true
d91a644ba53fca954d79a453b908f5bfefa4952a
Python
cosmonautd/STSIM
/vehicle.py
UTF-8
685
3.109375
3
[]
no_license
class Vehicle: def __init__(self, G, initial, terminal): self.map = G self.initial = initial self.terminal = terminal self.current = initial self.path = None self.next = None def set_path(self, path): self.path = path self.next = 1 def get_...
true
d8687c506503dfd70bc816802646b7f8d4f30fe4
Python
Sandylin520/Python_Learning
/L08_OOP/8.1_oop.py
UTF-8
1,695
4.59375
5
[]
no_license
#EX_1 class Sample(): pass my_sample = Sample() print(type(my_sample))#<class '__main__.Sample'> #EX_2 class Dog(): def __init__(self,breed): self.breed = breed my_dog = Dog(breed='Lab') print(type(my_dog)) print(my_dog.breed)#Lab #EX_3 class Cat: #Class object attribute #Same for any instan...
true
b950f3a4a9af892d13596394f88816c03c6b35d0
Python
Robin-Wujw/leetcode_py
/005.py
UTF-8
1,980
3.8125
4
[]
no_license
# class Solution: # def __init__(self): # self.longestSize = 0 # self.longestStart = 0 # def longestPalindrome(self, s): # """ # :type s: str # :rtype: str # """ # for index, value in enumerate(s): # self.checkOddPalindrome(s, index) # ...
true
248f681b381123bd16c2dbf3900fda01d9f8d1eb
Python
bsolisduran/MyLogbookApp
/StatisticsFrame.py
UTF-8
7,692
3.109375
3
[]
no_license
import datetime as dt import tkinter as tk from globals import * from models.HeaderFrame import HeaderFrame from models.LogbookDataFrame import LogbookDataFrame class StatisticsFrame(tk.Frame): def __init__(self, parent, *args, **kwargs): tk.Frame.__init__(self, parent, *args, **kwargs) self.par...
true
1b4599299049c790ba1a7d87c8925af80b2645e5
Python
YiSoJeong/Algorithm_Python
/SW/List/4837_부분집합의 합.py
UTF-8
655
3.140625
3
[]
no_license
import sys sys.stdin = open('../String/sample_input.txt', 'r') # 분류 : Greedy # 발상 : 전체 부분집합 중에서 n개인 것 골라야 해서 # 변형 : 전체를 탐색하되 조건이 맞는 경우의 수만 비교 # 조합 : 비트 연산자 -> 모든 부분 집합 구할 때 T = int(input()) for t in range(1, T+1): n, k = map(int, input().split()) arr = [i for i in range(1, 13)] cnt = 0 for i in range(...
true
9eec159e7b30cbb87cb7d7f69fbe7d4d40e1377f
Python
ChipoXD/ProjectEuler
/Problems/Problem1-20/Problem17.py
UTF-8
2,214
3.640625
4
[]
no_license
# ProblemURL: https://projecteuler.net/problem=17 def numberspelled(argin): onesDigitSpell = {0: "", 1: "one", 2: "two", 3: "three", 4: "four", 5: "five", 6: "six", 7: "seven", 8: "eight", 9: "nine"} tensDigitSpell = {0: "", 1: "teen", 2: "twenty", 3: "thirty", 4: "forty", 5: "fifty", 6: "...
true
95df91b656f51211f1870cc16f0f8474ff84990b
Python
giriprasad23/Cloud-Projects
/Cloud_Assignment_1/src/project1/all_stuff.py
UTF-8
3,340
2.625
3
[]
no_license
''' Created on Feb 9, 2015 @author: Puneeth U Bharadwaj ''' import gnupg from pprint import pprint def exportkeys(): gpg = gnupg.GPG() ascii_armored_public_keys = gpg.export_keys('66C8F2C8') ascii_armored_private_keys = gpg.export_keys('66C8F2C8', True) with open('pub_keys.asc', 'w') as f: f....
true
bf52369bb71e84dbc644e3ca11f30d2cd8adc171
Python
gabriellaec/desoft-analise-exercicios
/backup/user_337/ch2_2020_03_07_22_57_31_327752.py
UTF-8
103
2.6875
3
[]
no_license
def calcula_velocidade_media (distancia, tempo): velocidade = distancia/tempo return velocidade
true
309fb9fb149db56143147d2376f71699f3e071e0
Python
ac998/Machine_failure_prediction
/models/lstm_utils.py
UTF-8
8,449
2.671875
3
[]
no_license
import pandas as pd import numpy as np import sklearn from sklearn import metrics from sklearn.metrics import mean_absolute_error from sklearn.metrics import r2_score from sklearn.metrics import mean_squared_error from sklearn.preprocessing import MinMaxScaler from sklearn.model_selection import train_test_split, cross...
true
8edf4c62c7c3011bd047b3048da0794524b9f357
Python
eliasanzoategui/Estudo039
/progamas/teste de progamação02.py
UTF-8
6,522
2.8125
3
[]
no_license
import random def ativar(neuronios,entrada,limiar): x = 0 for i in neuronios: x += entrada*i['peso']+i['bias'] if x <= limiar: return 0 else: return x def ajustes(neuronios,taxa_de_erro): x = 0 for i in neuronios: x += 1 return taxa_de_erro/x n...
true
3d3d34da9d188e9106b0880858ceddf3cb010c23
Python
anyezhihu/Python2.7
/project/Crawl_Linux_Cmd/crawl/Crawl_Linux_CMD_V2.py
UTF-8
8,042
2.875
3
[]
no_license
#coding=utf-8 """ 相比于版本1的函数式做法,第2版采用了面向对象的方法。 """ import chardet import time import re import urllib2 import sqlite3 import sys import os #定义程序运行起始时间 Process_Begin_Time=time.time() #设置系统默认字符集 reload(sys) sys.setdefaultencoding('utf-8') print "当前IDE环境默认字符集:%s" % sys.getdefaultencoding() #定义数据库模块 class DB(object): ...
true
b722ec0aafb246944128840596932ba08eda31d6
Python
resource-watch/cartosql.py
/cartosql/cli.py
UTF-8
2,933
3.125
3
[ "MIT" ]
permissive
''' Utility library for interacting with CARTO via the SQL API Usage: csql (post|get) [options] <sql> csql select [options] <fields> <table> [-w <where>] [-o <order>] [-l <limit>] csql ls [options] csql exists [options] <table> csql drop [options] [--confirm] <table> Options: -h --help Print this text -u <u...
true
b2c916e28dcd41fb63110272c20501bce649ae6f
Python
zaxhutchinson/leylines
/ley_debug.py
UTF-8
405
3.21875
3
[]
no_license
############################################ # ley_debugger.py # # Print messages to console, if debugging is on. # ########################################### class Debugger: def __init__(self, is_active=False): self.is_active = is_active def makeActive(self): self.is_active = True def makeInactive(self): s...
true
79ad3c8aad3a4cbff77eef19ea9edffa1e93ad37
Python
btannenw/CMS_machineLearning
/diHiggsMLProject/higgsReconstruction/plotterClass.py
UTF-8
2,431
2.640625
3
[]
no_license
## Author: Ben Tannenwald ## Date: April 3, 2019 ## Purpose: Class to hold functions for plotting stuff import os import matplotlib.pyplot as plt class hepPlotter: def __init__ (self, _subdirectoryName): # Class Defaults self.transparency = 0.5 # transparency of plots self.subdirec...
true
43f74e26baea3691cd6902670181ba70aebfc70e
Python
Kose-i/python_test
/BaseKnowledge/iterator/iterator.py
UTF-8
523
3.59375
4
[ "Unlicense" ]
permissive
#! /usr/bin/env python3 def func1(): x = iter([1,2,3,21,43,4]) print(x) print(next(x)) def func2(): def generator(): yield 1 yield 2 yield 3 yield 4 for e in generator(): print(e) def func3(): def func3_inner(): receive = 0 receive = (yield receive) print("receive =", rec...
true
b5a6b5804bf877240a8e7ba5771ff3cd789042d3
Python
pratiksan45/Python3.7
/fibonacci.py
UTF-8
252
3.921875
4
[]
no_license
def fibonacci_seq(n): a=0 b=1 print(a, end=' ') print(b, end=' ') for i in range(1,n-1): c=a+b a=b b=c print(c, end=' ') num=int(input("Enter any Number\n")) fibonacci_seq(num)
true
26b9b9b62c5b31b158f9241eb05cbe2678634605
Python
gauravshilpakar/WhatsThatGenre-DeployedModel
/models/model_app.py
UTF-8
3,510
2.890625
3
[]
no_license
import os import sys import argparse from joblib import load from tensorflow.keras.models import load_model from models.make_dataset import make_dataset_dl import numpy as np import matplotlib.pyplot as plt class AppManager: def __init__(self, args, model, genres): self.args = args self.genres = ...
true
c42631a29e2da6dbf13c2c947c398c637d97bdf7
Python
JazimLatif/Bubble-chamber-image-analysis
/CleanupCode.py
UTF-8
1,581
3.265625
3
[]
no_license
import PIL from PIL import Image import requests from io import BytesIO from PIL import ImageFilter from PIL import ImageEnhance from IPython.display import display import numpy as np import imageio import matplotlib.pyplot as plt #add path to the image file filename = R'C:\Users\clarkj5\Documents\Python Scr...
true
c838a60d0718f41f1942cd4316e8df6b2edfc481
Python
YLyeliang/MSI_FCN
/core/metrics.py
UTF-8
6,222
2.703125
3
[]
no_license
import os import tensorflow as tf import numpy as np from PIL import Image def fast_hist(a, b, n): k = (a >= 0) & (a < n) return tf.math.bincount(n * a[k].astype(int) + b[k], minlength=n ** 2).reshape(n, n) def get_hist(predictions, labels): """ This is for multi-classes metric calculation by calcul...
true
4f5f4aadfeabb13790b417b334c5f73c6d0345a7
Python
KomorebiL/OJ
/stack_from_queue.py
UTF-8
896
3.859375
4
[]
no_license
from queue import Queue class Stack: def __init__(self): self.q1 = Queue() self.q2 = Queue() def empty(self): return self.q1.empty() def push(self, element): if self.empty(): self.q1.enqueue(element) else: self.q2.enqueue(element) ...
true
d14b0e7748d04a61a8faaeb3ae035c39b39456de
Python
TurtleZhong/Particle_Filter_Demo
/particle_filter_demo.py
UTF-8
7,274
3.5
4
[]
no_license
""" This project is an implement of particle filter. * Author: ZhongXinliang * Email: xinliangzhong@foxmail.com * Date: 2018.01.17 """ from math import * import random import cv2 import numpy as np landmarks = [[20.0, 20.0], [80.0, 80.0], [20.0, 80.0], [80.0, 20.0]] world_size = 100.0 class Robot: """ This c...
true
8fa8256e07cb9811b891de414f14a3e111968cee
Python
zhou-jia-ming/leetcode-py
/interview_04_04.py
UTF-8
1,553
3.453125
3
[]
no_license
# coding:utf-8 # Created by: Jiaming # Created at: 2020-04-29 from typing import * from utils import TreeNode, generate_tree, null class Solution: def isBalanced(self, root: TreeNode) -> bool: # 遍历每个节点的深度比较,总复杂度为O(nlogn) if not root: return True if not root.left and not root....
true
876ad37f67416ae4925f9752d5cec876d7bc5f6b
Python
Isaivargas/neuronalNetwork
/artificialNeuron.py
UTF-8
3,149
2.796875
3
[]
no_license
#Single Artificial Neuron. #created by Isaí vargas Chávez-Age 19 All rigths reserved /Users/Isai/eclipse-workspace/Perceptron/src/NeuronalNetworks/ArtificialNeuron.java@ # Compilador Clang 6.0 (clang-600.0.57)] on darwin. # version 1.0. # 03/02/2018 in Mexico City. import random class Neuron : #Atributes ...
true
7542c60d21a4224c8ab498821f562327660ddf30
Python
MengyingGIRL/python-100-days-learning
/Day07/set2.py
UTF-8
508
3.234375
3
[]
no_license
''' 集合的常用操作 - 交集 - 并集 - 差集 - 子集 - 超集 @Time : 2020/1/14 9:57 @Author : wangmengying @File : set2.py ''' def main(): set1 = set(range(1,7)) print(set1) set2 = set(range(2,11,2)) print(set2) set3 = set(range(1,5)) print(set3) print(set1 & set2) print(set1 | set2) print(set1 ^ set2) ...
true
195d0d700dd7c3690b9ca6c8ff44e133fcb0d88d
Python
oskar404/aoc
/aoc2020/day09.py
UTF-8
1,795
3.515625
4
[]
no_license
#!/usr/bin/env python3 import sys def get_xmas_weakness(data, preamble, verbose=False): index = None value = None assert preamble < len(data), f"Not enough data for preamble: {preamble}" for i in range(preamble, len(data)): v = data[i] window = data[i - preamble : i] if verbos...
true
b400761e381a92c31028b05657434617563002dc
Python
matthewnorman/geosearch
/tests/test_geosearch.py
UTF-8
3,601
3
3
[ "MIT" ]
permissive
import pytest import random import geohash from haversine import haversine from unittest import mock from geosearch import geolocate def test_encoding_decoding(): """ Let's see if we can locate the Palace of Westminster. :return: """ ID = 1 geolocator = geolocate.LatLonGeolocator() geolo...
true
9233c2e1eb62c1a58241a30c89fcdf74db63c719
Python
python-practice-b02-006/PhilippK
/Lab_3/task1_from_Sinitsa.py
UTF-8
2,735
3.40625
3
[]
no_license
import pygame import numpy as np from pygame.draw import * pygame.init() FPS = 30 screen = pygame.display.set_mode((400, 400)) YELLOW = (255, 255, 0) BLACK = (0, 0, 0) RED = (255, 0, 0) WHITE = (255, 255, 255) def main(): pygame.display.update() clock = pygame.time.Clock() finished = False ...
true
90cd45178baf6d355676d5bc92d3a681483f2d5c
Python
stubird/micStudy
/leetcode/SubsConc.py
UTF-8
1,046
2.78125
3
[]
no_license
""" Copyright 2018 (c) Jinxin Xie Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in...
true
491d66647320943e147e84dd3f7089b8f6e77e9a
Python
bethewind/pylite
/tests/range/next.py
UTF-8
119
3.1875
3
[]
no_license
range_object = range(10) iterator = range_object.__iter__() while True: item = iterator.__next__() print(item)
true
2012382ba2ae3caed4b22425cc1537ed1cd6d2c6
Python
portobello-boy/Pokemon-Data-Visualization
/mpltest.py
UTF-8
7,497
3.109375
3
[]
no_license
import numpy as np import seaborn as sns import matplotlib.pyplot as plt import pandas as pd import itertools from chord import Chord from math import pi data = pd.read_csv("Pokemon.csv") # Associate a color with each type: colors = { "Grass": "#7AC74C", "Fire": "#EE8130", "Water": "#6390F0", "Bug": "...
true
c23c21616ef7af5d63b0c57178fc9cd8509973c2
Python
dbreddyAI/ml-deploy
/pred.py
UTF-8
1,019
2.890625
3
[]
no_license
""" Script for sending data to the server to make predictions """ import pandas as pd import json import requests # Run gunicorn from the terminal: # gunicorn --bind 0.0.0.0:8000 server:app header = {'Content-Type': 'application/json', \ 'Accept': 'application/json'} test_x = pd.read_csv("pr...
true
de0f98ebe77ffef07c8a0bc0df90906139e54d1a
Python
shyzik93/dna_simulator
/dnasim/enzyme/dna_methyltransferase.py
UTF-8
438
2.625
3
[]
no_license
from dnasim.enzyme.enzyme import Enzyme class DNAMethyltransferase(Enzyme): def __init__(self, can_restrict=False, can_methylate=True): """ Объект фермента Метилтрансфераза https://en.wikipedia.org/wiki/DNA_methyltransferase """ ec_number = None # TODO: Указать Шифр КФ для...
true
d6445c04d394b6aecac89051e77d501f9528d5c0
Python
celord/PythonGreencore
/ExamenFinal/ej7.py
UTF-8
441
3.578125
4
[]
no_license
""" Modo sólo escritura posicionándose al final del archivo (a). En este caso se crea el archivo, si no existe, pero en caso de que exista se posiciona al final, manteniendo el contenido original. Y agregar texto a su criterio """ def prepararArchivo(a): try: f = open(a,'a+') return f except: print('Error') de...
true
38479e3a31d252665a8cf395686806960755afc4
Python
mrallc/retro
/extensions/sqlite/sqlite.py
UTF-8
1,408
2.609375
3
[ "ISC" ]
permissive
# rxSQL ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Copyright (c) 2010 - 2011, Charles Childers # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Filesystem based interface to sqlite3 # # Usage # - Write SQL query to file named 'sql' # - Create a file name...
true
51467d60c52f0dc84ce1b218219eb60bcf456027
Python
ytangjf/CS498_AppliedMachineLearning
/HW1/prob1/main.py
UTF-8
4,266
3.328125
3
[]
no_license
# Example of Naive Bayes implemented from Scratch in Python import csv import random import math def loadCsv(filename): lines = csv.reader(open(filename, "r")) dataset = list(lines) for i in range(len(dataset)): temp = [float(x) for x in dataset[i]] # values = [None if x == 0 else...
true
79164f880b3e724b02f45bb7f00e046bad2a70d7
Python
49257620/reboot
/studysrc/mytest/re/retest003.py
UTF-8
1,836
3.59375
4
[]
no_license
# encoding: utf-8 # Author: LW import re """ \A 匹配字符串开始位置 等于 ^ \Z 匹配字符串结束位置 等于 $ """ print(' \A 匹配字符串开始位置 等于 ^') print(' \Z 匹配字符串结束位置 等于 $') print('-' * 50) """ \b 匹配单词边界 """ print(' \\b 匹配单词边界 ') print("re.findall(r'\\babc\\b','abc.com')",re.findall(r'\babc\b','abc.com')) print("re.findall(r'\\babc\\b','(abc)....
true
87b96df02437f4e2e965a12136fab7bcd8a90429
Python
aoeu/DWIM
/tests/rules/test_git_bisect_usage.py
UTF-8
1,030
2.5625
3
[ "MIT" ]
permissive
import pytest from tests.utils import Command from dwim.rules.git_bisect_usage import match, get_new_command @pytest.fixture def stderr(): return ("usage: git bisect [help|start|bad|good|new|old" "|terms|skip|next|reset|visualize|replay|log|run]") @pytest.mark.parametrize('script', [ 'git bisect...
true
ed4932a7d405f63ba8c42181f5ef544a5e6e4cab
Python
VanillaHellen/VanillaBot
/vanilla_bot.py
UTF-8
8,148
2.71875
3
[]
no_license
from pathlib import Path from discord.ext import commands import discord import random import json import mysql.connector import datetime import os import requests import io import aiohttp script_location = Path(__file__).absolute().parent db_data = {} db_data['user']=os.environ['DB_USER'] db_data['password']=os.envi...
true
3b9693f0f4a95406cf24e8861180a7911b07c6e5
Python
ManosB435/PythonPorgramms
/Python Programms/OPAP.py
UTF-8
1,096
3.15625
3
[]
no_license
import requests import json import datetime from collections import Counter d = datetime.datetime.now() M = d.strftime("%m") if d.hour < 9: D = d.day-1 else: D = d.day Numbers = [] for i in range(1, D+1): number_str = str(i) A = number_str.zfill(2) x = requests.get('https://api.o...
true
489ca1e5d88a19c208504e36e5f7f096a862d03b
Python
IanSMoyes/SpiderPi
/Lights/adafruit-circuitpython-bundle-6.x-mpy-20210310/examples/rfm9x_transmit.py
UTF-8
2,032
3.015625
3
[ "Apache-2.0" ]
permissive
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # SPDX-License-Identifier: MIT # Example to send a packet periodically # Author: Jerry Needell # import time import board import busio import digitalio import adafruit_rfm9x # set the time interval (seconds) for sending packets transmit_inter...
true
a8bd6b6abd4836b810b82d265e73b4a059f0870f
Python
idleyui/ml-in-action
/02-knn/knn_letter_recognition.py
UTF-8
1,216
3.078125
3
[]
no_license
# -*- coding: UTF-8 -*- import numpy as np from collections import Counter def classify0(test_data, data_set, labels, k): diff = np.tile(test_data, (data_set.shape[0], 1)) - data_set distances = (diff ** 2).sum(axis=1) ** 0.5 k_labels = labels[distances.argsort()[:k]] return Counter(k_labels).most_com...
true
b474ad1b9d2976ad9a0ac056d74fc6ee04b1c2f2
Python
MichaelSchmidt82/sound-count
/utils.py
UTF-8
2,613
2.609375
3
[ "MIT" ]
permissive
""" MIT License Copyright (c) 2018 Michael Schmidt Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publis...
true
0a5ccca3ff94d21e588ad4663ee2ba7d7aa768cd
Python
smartnova/sgvis
/src/stream_graph.py
UTF-8
3,172
3.078125
3
[]
no_license
import time from z3 import * import functools from render.render_stream_graph import render_stream_graph from random import randint import sys def optimize_stream_graph(nodes, edges): s = Optimize() L = len(nodes) # Index index = [Int('i_%s' % i) for i in range(L)] index_choices = [And(index[i...
true
ce5d58c76c9a11829d6c45ad108c4f0952282f1b
Python
PetKimQA/Practice_1
/radioButton-validationfailed.py
UTF-8
4,095
2.796875
3
[]
no_license
from selenium import webdriver driver = webdriver.Chrome("C:/Users/PetruKim/Desktop/Automation/chromedriver.exe") driver.get("https://www.seleniumeasy.com/test/basic-radiobutton-demo.html") #locators maleRadioIndv = driver.find_element_by_xpath('//*[@id="easycont"]/div/div[2]/div[1]/div[2]/label[1]/input') fem...
true
6b22158574c7f2eeae4ac042a3f11edd64f52781
Python
danluna/TourMap
/crawl.py
UTF-8
2,119
2.765625
3
[]
no_license
import requests from bs4 import BeautifulSoup unicode_Error_Counter = 0 def tour_spider(max_year): year = 1982 page = 1 fw = open('metallica_data.txt', 'w') while year <= max_year: url = 'http://www.metallica.com/tour_date_list.asp?year=' + str(year) + '&page=' + str(page) source_code = requests.get(url) p...
true
6c6157dd9fb61dabfd5d407d4becda7386a70698
Python
Techercise/Nobel_Peace_Lecture_Analyis_with_NLP
/htmlparser.py
UTF-8
605
2.6875
3
[]
no_license
# This function comes from StackOverflow user Eloff at: # https://stackoverflow.com/questions/753052/strip-html-from-strings-in-python/925630#925630 And improved for Python # 3.2+ by another StackOverflow user Thomas K. here: # https://stackoverflow.com/questions/11061058/using-htmlparser-in-python-3-2 from abc impor...
true
7c32796d89262f80b831676d77656daf25b03b85
Python
Priyanka9496/Whether_app
/The_whether/whether/views.py
UTF-8
950
2.71875
3
[]
no_license
from django.shortcuts import render from django.http import HttpResponse import requests from .models import City from .forms import City_Form # Create your views here. def weather(request): cities=City.objects.all() url = 'http://api.openweathermap.org/data/2.5/weather?q=kochi&units=imperial&appid=YOUR-API-KE...
true
c698b47d561d136fe348922338a4d5e18283a540
Python
taizilinger123/pythonjichu
/04-系统编程-1/12-join子进程.py
UTF-8
370
2.875
3
[]
no_license
#!/usr/bin/env python # -*- coding:utf-8 -*- from multiprocessing import Process import time import random def test(): for i in range(random.randint(1,5)): print("-----%d-----"%i) time.sleep(1) p = Process(target=test) p.start() p.join(1)#堵塞 print("------main-----") # import time ...
true
6170abca954e845cef92e28961f508d4010cab25
Python
bstacy0015/Integration
/POGIL12.py
UTF-8
1,513
4.53125
5
[]
no_license
""" A calculator that calculates the area of a circle with radius inputted by the user. Test of functions. __author__ = Benton Stacy """ def circle_area(): """ The top-level function run in Main.py. Controls all user input, calculation, and output. """ import math # To use pi def number_form...
true
41faf4b1e4b3ba74cd3e776203c54b1d6a211980
Python
FabioCastle5/wil-auiproject
/python_plot/dispersion_evaluation.py
UTF-8
2,388
3.03125
3
[]
no_license
import string import re import math def low_pass_filter (a, a0, factor): return (a * factor + (1 - factor) * a0) filename = "./../arduino/will_measurement_sketch/measure2_ypos.txt" # open file with data and plot them in_file = open(filename,"r") x_list = [] filt_x_list = [] y_list = [] filt_y_list = [] threshold...
true
c21c5be66d0453b9c4d02b3ebab551b09451d2bb
Python
rmodi6/sentence-representations
/loss.py
UTF-8
401
2.53125
3
[ "MIT" ]
permissive
import tensorflow as tf from tensorflow import math def cross_entropy_loss(logits: tf.Tensor, labels: tf.Tensor) -> tf.Tensor: # import pdb; pdb.set_trace() # why is loss 0 sometimes!? one_hot_labels = tf.one_hot(labels, logits.shape[1]) batch_loss = tf.nn.softmax_cross_entropy_with_logits(one_hot_lab...
true
c3e3218ec16fa5bbf414ede048d43c3ff138841b
Python
Egemenatilla/Machine-Learning-Essentials
/2)Classification/3) SVM (Support Vector Machine)/2)/Svm2.py
UTF-8
1,295
3.359375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Apr 1 20:42:24 2021 @author: egeme """ # Libraries import pandas as pd import matplotlib.pyplot as plt import numpy as np # Read data from csv file data = pd.read_csv('data.csv') # Drop the columns we cannot use data.drop(["id","Unnamed: 32"],axis=1,inplace=...
true
6b4f6fd067bc1b0787d34a9cd4b4f08c32d1e412
Python
markosolopenko/python
/data_structures/singly_linked_list.py
UTF-8
2,966
3.953125
4
[]
no_license
class Node(object): def __init__(self, data=None): self.data = data self.next = next # def get_data(self): # """ # This method like -> @property # :return: # """ # return self.data # # # def get_next(self): # """ # getter #...
true