Skip to content

Instantly share code, notes, and snippets.

@GuokaiLiu
Last active October 21, 2020 02:57
Show Gist options
  • Save GuokaiLiu/14de796314701a2888841f1f401833bc to your computer and use it in GitHub Desktop.
Save GuokaiLiu/14de796314701a2888841f1f401833bc to your computer and use it in GitHub Desktop.
[特征雷达图] #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],
'Category': [
'virginica',
'virginica',
'setosa',
'virginica',
'virginica',
'versicolor',
'versicolor',
'setosa',
'virginica',
'setosa'
]
}
)
pd.plotting.radviz(df, 'Category')
# 2 Customer's data
X = pd.DataFrame(X_train,columns=[i for i in range(1024)]) # one feature / column
X['Label'] = np.argmax(Y_train,axis=1) # onehot to number
pd.plotting.radviz(X, 'Label') # visualization
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment