Skip to content

Instantly share code, notes, and snippets.

View GuokaiLiu's full-sized avatar

Guokai Liu GuokaiLiu

View GitHub Profile
@GuokaiLiu
GuokaiLiu / hellogist.py
Created September 29, 2020 01:43
[hello] gist #test
import os
print('Hello gist.')
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@GuokaiLiu
GuokaiLiu / imbalance_index.py
Last active October 21, 2020 02:58
[失衡索引] #imbalance
# Make imbalanced training samples
print(X_train.shape)
print(Y_train.shape)
a = []
for i in range(10):
for j in range(100):
if i!=4:
a.append(i*100+j)
elif j<10:
@GuokaiLiu
GuokaiLiu / radvis.py
Last active October 21, 2020 02:57
[特征雷达图] #visualization
# https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.plotting.radviz.html
import pandas as pd
# 1 Demo
df = pd.DataFrame(
{
'SepalLength': [6.5, 7.7, 5.1, 5.8, 7.6, 5.0, 5.4, 4.6, 6.7, 4.6],
'SepalWidth': [3.0, 3.8, 3.8, 2.7, 3.0, 2.3, 3.0, 3.2, 3.3, 3.6],
'PetalLength': [5.5, 6.7, 1.9, 5.1, 6.6, 3.3, 4.5, 1.4, 5.7, 1.0],
'PetalWidth': [1.8, 2.2, 0.4, 1.9, 2.1, 1.0, 1.5, 0.2, 2.1, 0.2],
@GuokaiLiu
GuokaiLiu / make_imbalance_phm.py
Last active October 21, 2020 02:58
[构造失衡数据集] #data #imbalance
from ServerUtils import loadcwru
from imblearn.datasets import make_imbalance
from imblearn.over_sampling import BorderlineSMOTE, SMOTE, ADASYN, SVMSMOTE, RandomOverSampler
# Set parameters
datast = 'DataPre_CWRU_Demo'
outdim = 10
source = 'D'
Inshape = '1D'
resample = 'SMOTE'
@GuokaiLiu
GuokaiLiu / matrix2array.py
Last active October 21, 2020 02:58
[矩阵转数组] #numpy
https://stackoverflow.com/questions/3337301/numpy-matrix-to-array
b = a.A # raw dimension
c = a.A1 # 1D dimension
@GuokaiLiu
GuokaiLiu / matrix_divide.md
Last active October 21, 2020 02:56
[矩阵除法] #math
  • 1 numpy.linalg.lstsq这个是什么意思啊?Link

  • 2 Is there a function for solving xA=b in opencv? Link

  • 3 MATLAB 之 \(左除) /(右除)Link

  • 4 Scipy教程 - 线性代数库scipy.linalg Link

  • 5 数值分析,四舍五入带来的误差错误 Link

@GuokaiLiu
GuokaiLiu / test.py
Created October 21, 2020 15:12
test|-|{"files":{"test.py":{"env":"python"}},"tag":"GROUP"}
import numpy as np
a = np.ones(1)
print(a)
@GuokaiLiu
GuokaiLiu / snippetslab
Last active November 24, 2020 21:07
This is a welcome test.|-|{"files":{"snippetslab":{"env":"python"}},"tag":"Uncategorized"}
file_name = 'N09_M07_F10_K001_1.mat'
kat = sio.loadmat(file_name)[[i for i in kat.keys() if 'N' in i][0]]
sensor = 6 # force:0, current1:1, current2:2, speed:3, torque:4, temperature:5, vibration:6
a = kat['Y'][0, 0][0,sensor][2]
@GuokaiLiu
GuokaiLiu / test3
Created October 21, 2020 15:51
This is a welcome test.
import numpy as np
print(np.zeros)