Functions commonly used in computer paper writing and scientific research.
Project description
PERPY——Functions commonly used in computer paper writing and scientific research.
INSTALL
pip install perpy
IMPORT
import perpy as py
LOAD——load dataset from file
TEST FILE——test1.txt
1 5 0
2 4 0
3 3 0
4 2 1
5 1 1
CASE 1——Non label & No max min scaling
path = r'D:\perpy' # file directory
col_labels = None # non label
scaling = False # no max min scaling
x= py.load(path, col_labels, scaling)
print(x)
CASE 2——The labels is in the first column & To max min scaling
path = r'D:\perpy' # file directory
col_labels = 0 # the labels is in the first column
scaling = True # to max min scaling
x, r = py.load(path, col_labels, scaling)
print(x, '\n', r)
CASE 3——The labels is in the last column & No max min scaling
path = r'D:\perpy' # file directory
col_labels = 2 # the labels is in the last column. non-zero number
scaling = False # no max min scaling
x, r = py.load(path, col_labels, scaling)
print(x, '\n', r)
DIST——Calculate the euclidean distance between point A and point B
A = np.mat([1,2,3,4]) # point A
B = np.mat([4,3,2,1]) # point B
dist = py.dist(A, B)
print(dist)
4.47213595499958
PLT_SCATTER——Drawing scatter plot
path = r'D:\perpy' # file directory
col_labels = 2 # the labels is in the last column. non-zero number
scaling = False # no max min scaling
x, r = py.load(path, col_labels, scaling)
py.plt_scatter(x=x, labels=r, fig_label=['X——label','Y——label'], fig_legend=['Cluster','01']) # 00-upper left, 01-upper right, 10-down left, 11-down right
PLT_RUNTIME——Drawing runtime plot
times = [[1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0], # Runtime list, times[0] is A times, times[1] is B times.
[1,1.1,1.2,1.3,1.4,1.5,1.6,1.7]]
instances = [1,2,3,4,5,6,7,8] # x
labels = ['$A$','$B$'] # labels
py.plt_runtime(times, instances, labels)
PLT_RADAR——Drawing radar plot
TEST FILE——test2.txt
1.0 0.8 0.6 0.5 0.9
0.6 0.9 0.7 0.7 0.3
0.4 0.1 1.0 0.8 0.5
data = np.loadtxt(r'D:\perpy\test2.txt')
algorithm = ['a', 'b','c']
labels = np.array(['A','B','C','D','E'])
py.plt_radar(labels, data, algorithm, legend=(1.7,0.68))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
perpy-0.2.7.tar.gz
(37.2 kB
view details)
File details
Details for the file perpy-0.2.7.tar.gz.
File metadata
- Download URL: perpy-0.2.7.tar.gz
- Upload date:
- Size: 37.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0659dfcb6750ba260e186666732b7e5c67d3ea97465079a600e8bf29c4ea3dbb
|
|
| MD5 |
c82c5a209f6bb9e31f11c4de46476779
|
|
| BLAKE2b-256 |
045d170ce4239f0b6bdc9fc0f2a893545b5a70700601858b098d169a6530a297
|