Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- from tensorflow.keras import Sequential
- from tensorflow.keras.layers import Dense
- from tensorflow.keras.optimizers import SGD
- x_file = "X.csv"
- y_file = "Y.csv"
- X = pd.read_csv(x_file, sep=",", header=None)
- X = X.values.T
- normalized_X = (X - X.mean()) / X.std()
- Y = pd.read_csv(y_file, sep=",", header=None)
- Y = Y.values
- # %%
- model = Sequential()
- model.add(Dense(units=1024, activation="relu", input_dim=20530))
- model.add(Dense(units=50, activation="relu"))
- model.add(Dense(units=1, activation="sigmoid"))
- sgd = SGD(learning_rate=0.001)
- model.compile(loss="binary_crossentropy", optimizer=sgd, metrics=["accuracy"])
- model.fit(normalized_X, Y, batch_size=1, epochs=50)
- Y_pred = model.predict(normalized_X)
- sum(Y_pred > .5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement