0
I am now starting programming in Python language and I am studying data mining with artificial neural network.
What should I do to make predictions from a . csv file? Then how to save the results in another table?
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
Loading table
dataset = pd.read_csv('teste2.txt')
X = dataset.iloc[:, 1:20].values
y = dataset.iloc[:, 20].values
Separating Data from Training
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state = 0)
Pre-processing
from sklearn.preprocessing import StandardScaler
sc = StandardScaler()
X_train = sc.fit_transform(X_train)
X_test = sc.transform(X_test)
Creating RNA
import keras
from keras.models import Sequential
from keras.layers import Dense
classifier = Sequential()
classifier.add(Dense(units = 3, kernel_initializer = 'uniform', activation = 'relu', input_dim = 7))
classifier.add(Dense(units = 3, kernel_initializer = 'uniform', activation = 'relu'))
classifier.add(Dense(units = 1, kernel_initializer = 'uniform', activation = 'sigmoid'))
classifier.compile(optimizer = 'adam', loss = 'binary_crossentropy', metrics = ['accuracy'])
Training
classifier.fit(X_train, y_train, batch_size = 10, epochs = 100)
Predictions
Here I don’t know what to do. I need to read another csv, make predictions and save to another file