This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://stackoverflow.com/questions/3337301/numpy-matrix-to-array | |
b = a.A # raw dimension | |
c = a.A1 # 1D dimension |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
a = np.ones(1) | |
print(a) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
print(np.zeros) |
OlderNewer