Skip to content

Instantly share code, notes, and snippets.

View GuokaiLiu's full-sized avatar

Guokai Liu GuokaiLiu

View GitHub Profile
@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 / 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 / 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 / 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:
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@GuokaiLiu
GuokaiLiu / hellogist.py
Created September 29, 2020 01:43
[hello] gist #test
import os
print('Hello gist.')