Skip to main content

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)

image

print(x)

image

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)

image

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)

image

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

image

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)

image

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))

image

Project details


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.5.tar.gz (20.7 kB view details)

Uploaded Source

File details

Details for the file perpy-0.2.5.tar.gz.

File metadata

  • Download URL: perpy-0.2.5.tar.gz
  • Upload date:
  • Size: 20.7 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

Hashes for perpy-0.2.5.tar.gz
Algorithm Hash digest
SHA256 b3cbc5d1ecddba6fd20ced49a06c069336da0e7c93f452747da58fa3dc5c4d60
MD5 fe3ca93ae2ee1425967082b581ee995a
BLAKE2b-256 e9cf71ce322aeafc96fb12092f855110978b7e6477eba36804c608c20baaac87

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page