- 博客(23)
- 收藏
- 关注
原创 【Python学习】 - Matplotlib二维绘图 - plt.matshow()和plt.imshow()区别对比
给定一个8*8的数据,用两种方式分别进行输出。xx = np.zeros((8,8),dtype = np.uint8)xx[0,0] = 13im = Image.fromarray(xx)plt.imshow(im)plt.matshow(xx)plt.show()输出:得出结论:首先我不知道为啥两个窗口是不一样大的。其次发现图片显示的都是正着...
2020-02-21 20:32:57 2871 1
原创 【Python学习】 - sklearn - 用于生成数据的make_blobs模块
函数原型:sklearn.datasets.make_blobs(n_samples=100, n_features=2, centers=3, cluster_std=1.0, center_box=(-10.0, 10.0), shuffle=True, random_state=None)参数含义:n_samples: int, optional (default=100)...
2020-02-21 18:14:59 3310
原创 【Python学习】 - sklearn - PCA降维相关
意义:PCA算法中所要保留的主成分个数n,也即保留下来的特征个数n类型:int 或者 string,缺省时默认为None,所有成分被保留。赋值为int,比如n_components=1,将把原始数据降到一个维度。赋值为string,比如n_components='mle',将自动选取特征个数n,使得满足所要求的方差百分比。
2020-02-21 18:09:19 1047
原创 【Python学习】 - sklearn学习 - 数据集分割方法 - 随机划分与K折交叉划分与StratifiedKFold与StratifiedShuffleSplit
一、随机划分import numpy as npfrom sklearn import datasetsiris = datasets.load_iris()X = iris.datay = iris.target# 1)归一化前,将原始数据分割from sklearn.model_selection import train_test_splitX_train,X_tes...
2020-02-20 18:09:28 10570
原创 【Python学习】 - sklearn学习 - 评估指标precision_score的参数说明
函数声明:precision_score(y_true, y_pred, labels=None, pos_label=1, average='binary', sample_weight=None)其中较为常用的参数解释如下:y_true:真实标签y_pred:预测标签average:评价值的平均值的计算方式。可以接收[None, 'binary' (default), 'm...
2020-02-20 18:00:53 22108
原创 【最小费用可行流模板】
可能再也用不到了吧,今天整理电脑文件看到的,作为图论选手,留个纪念,//原图: 对于pi,拆点xi,yi s->S,[m,m],0 S->xi,[0,inf],0 yi->t,[0,inf],0 xi->yi,[vi,vi],0 对于有航线的pi和pj,yi->xj,[0,inf],cost//这样就建好了原图 那么有源汇有上下界的费用流的改造方法: 首先...
2020-02-19 21:12:57 360
原创 【Python学习】 - - 链表推导式[ 2*x for x in X ]、匿名函数、并行迭代
列表推导式[x for x in range(n)]问题:请计算出1~9间的整数的平方常规方法for i in range(1,10): print(i*i)链表推导式:print([x*x for x in range(1,10)])匿名函数方法:匿名函数语法形式:lambda [arg1, arg2, arg3, ... , argn]...
2020-02-19 20:45:29 1096
原创 【PAT甲级 - 1028】List Sorting (25分)(模拟,排序)
题干:Excel can sort records according to any column. Now you are supposed to imitate this function.Input Specification:Each input file contains one test case. For each case, the first line contain...
2020-02-07 16:14:08 209
原创 【PAT - 甲级1024】Palindromic Number (25分)(大数,模拟)
题干:A number that will be the same when it is written forwards or backwards is known as aPalindromic Number. For example, 1234321 is a palindromic number. All single digit numbers are palindromic nu...
2020-02-06 23:11:21 186
原创 【PAT - 甲级1021】Deepest Root (25分)(并查集,暴力枚举)
题干:A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the root that results in a highest tree. Such a ...
2020-02-05 23:25:04 4183
原创 【PAT - 甲级1020】Tree Traversals (25分)(树的遍历,给定中序后序,求层次遍历)
题干:Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order traversal sequence of th...
2020-02-05 23:03:04 198
原创 【PAT - 甲级1017】Queueing at Bank (25分)(优先队列,模拟)
题干:Suppose a bank hasKwindows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. All the customers have to wait in line behind the yell...
2020-02-05 17:56:41 223
原创 【PAT甲级 - 1013】Battle Over Cities (25分)(并查集)
题干:It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that city are closed. We must know immediately if w...
2020-02-05 16:21:12 223
原创 【PAT - 甲级1012】The Best Rank (25分)
题干:To evaluate the performance of our first year CS majored students, we consider their grades of three courses only:C- C Programming Language,M- Mathematics (Calculus or Linear Algrbra), andE...
2020-02-05 15:49:31 188
原创 【PAT - 甲级1010】Radix (25分)(二分,进制转化)
题干:Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer isyes, if 6 is a decimal number and 110 is a binary number.Now for any pair of positive...
2020-02-05 12:35:56 328
原创 【PAT - 甲级1009】Product of Polynomials (25分)(模拟,细节)
题干:This time, you are supposed to findA×BwhereAandBare two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines, and each line contains the in...
2020-02-04 14:48:10 268
原创 【PAT - 甲级1006】Sign In and Sign Out (25分)(STLmap)
题干:At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the records of signing in's and out's...
2020-02-03 22:49:38 204
原创 【PAT - 甲级1003】Emergency (25分)(Dijkstra,最短路条数,双权值最短路)
题干:As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some roads. Amount of rescue teams in each city and ...
2020-02-03 22:41:21 270
原创 【PAT - 甲级1155】Heap Paths (30分)(栈,dfs,二叉树)
题干:In computer science, aheapis a specialized tree-based data structure that satisfies the heap property: if P is a parent node of C, then the key (the value) of P is either greater than or equal ...
2020-02-03 11:59:33 163
原创 【PAT - 甲级1095】Cars on Campus (30分)(模拟)
题干:Zhejiang University has 8 campuses and a lot of gates. From each gate we can collect the in/out times and the plate numbers of the cars crossing the gate. Now with all the information available, ...
2020-02-02 16:48:22 250
原创 【PAT - 甲级1007】Maximum Subsequence Sum (25分)(前缀和)
题干:Given a sequence ofKintegers {N1,N2, ...,NK}. A continuous subsequence is defined to be {Ni,Ni+1, ...,Nj} where1≤i≤j≤K. The Maximum Subsequence is the continuous subs...
2020-02-02 12:29:55 259
原创 【PAT - 甲级1094】The Largest Generation (25分)(dfs建树)
题干:A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same generation. Your task is to find the generation with the largest population.I...
2020-02-01 20:59:06 6027
原创 【PAT - 甲级1034】Head of a Gang (30分)(并查集)
题干:One way that the police finds the head of a gang is to check people's phone calls. If there is a phone call betweenAandB, we say thatAandBis related. The weight of a relation is defined to...
2020-02-01 16:57:48 294
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人