In [1]:
import pandas as pd
import numpy as np
In [2]:
# 털, 날개, 기타, 포유류, 조류
col_list = ["hair", "wing", "etc", "mammals", "bird"]
classification_ex = pd.DataFrame({
"hair": [0, 1, 1, 0, 0, 0],
"wing": [0, 0, 1, 0 ,0 ,1],
"bird": [1, 0, 0, 1, 1, 0],
"etc" : [0, 1, 0, 0, 0, 0],
"mammals": [0, 0, 1 ,0 ,0 ,1]
}, columns=col_list)
classification_ex.to_csv("./datas/classification_ex1.csv",
encoding="utf-8",
index=False) # header=False
In [3]:
## iris_data
from sklearn.datasets import load_iris
iris = load_iris()
iris_values = np.hstack([iris.data, iris.target.reshape(-1, 1)])
col_names = ["sepal_length", "sepal_width", "petal_length", "petal_width", "species"]
iris_data = pd.DataFrame(data=iris_values, columns=col_names)
iris_data["species"].replace(to_replace=0.0, value="setosa", inplace=True)
iris_data["species"].replace(to_replace=1.0, value="versicolor", inplace=True)
iris_data["species"].replace(to_replace=2.0, value="virginica", inplace=True)
iris_data.to_csv("./datas/iris.csv", encoding="utf-8", index=False)
In [4]:
## breast_cancer
from sklearn.datasets import load_breast_cancer
cancer = load_breast_cancer()
cancer_values = np.hstack([cancer.data, cancer.target.reshape(-1, 1)])
col_names = np.hstack([cancer.feature_names, "result"])
cancer_data = pd.DataFrame(data=cancer_values, columns=col_names)
cancer_data["result"].replace(to_replace=0, value="malignant", inplace=True)
cancer_data["result"].replace(to_replace=1, value="benign", inplace=True)
cancer_data.to_csv("./datas/cancer.csv", encoding="utf-8", index=False)
In [5]:
from IPython.core.display import display, HTML
display(HTML("<style> .container{width:100% !important;}</style>"))
'Deep_Learning' 카테고리의 다른 글
11.mnist_matplotlib_dropout_tensorgraph (0) | 2018.12.10 |
---|---|
10.mnist_dropout (0) | 2018.12.10 |
09.mnist_01_minibatch (0) | 2018.12.09 |
08.tensorboard03_example (0) | 2018.12.09 |
07.tensorboard02_example (0) | 2018.12.09 |