Skip to content

Instantly share code, notes, and snippets.

@ahmadmustafaanis
Created August 17, 2020 01:10
Show Gist options
  • Save ahmadmustafaanis/e18afae3325bad03a8b2e68dbc025e47 to your computer and use it in GitHub Desktop.
Save ahmadmustafaanis/e18afae3325bad03a8b2e68dbc025e47 to your computer and use it in GitHub Desktop.
from sklearn.datasets import load_iris
from tensorflow.keras.models import Sequential
from tensorflow.keras.utils import to_categorical
from tensorflow.keras.layers import Dense
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
iris = load_iris()
X = iris.data
y = iris.target
y = to_categorical(y) #converting output to one-hot vector
ss = StandardScaler() #standardizing the data
X = ss.fit_transform(X)
X_train, X_test, y_train, y_test = train_test_split(X,y) #splitting dataset into 2 halves
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment