/images/avatar.png

数据加载器

sklearn的库 划分训练集,测试集,验证集 1 2 3 4 5 6 7 8 9 10 11 from sklearn.model_selection import train_test_split def train_test_val_split(x,y, train_ratio = 0.8,validation_ratio = 0.1,test_ratio = 0.1,random_state=0): # random_state for reproduction # shuffle must be 'True' [x_train, x_test, y_train, y_test] = train_test_split( x, y, test_size=validation_ratio+test_ratio, random_state=random_state, shuffle=True) [x_val, x_test, y_val, y_test]

数据库池子Python

Python 数据库池子 引言 假设网站一天有很大的访问量,数据库服务器就需要为每次连接创建一次数据库连接,极大的浪费数据库的资源,并且极易造成数据库服务器

数字图像处理

数字图像处理 本博客主要涉及算法方面。需要堆图形由一定了解 预处理,加载,存储 使用pillow进行加载 1 2 from PIL import Image im = Image.open('./../image/lena.png') 存储 1 2 # 把图像用png

算法比赛套路

算法比赛套路 leetcode得进阶套路 如何判断出当前是第多少个case 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 import math math.a=0 class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: math.a+=1 print(math.a) n = len(nums) for i