Closed yasiemir closed 8 years ago
I was trying to use neural net with following settings
settings = {
"n_inputs":784,
"layers":[(25,'sigmoid_function'),(25,'sigmoid_function'),(10,'sigmoid_function') ]
}
new_network = NeuralNet(settings)
cost_function = 'sigmoid_function'
network = NeuralNet(settings)
I want to train this data from a csv file which i have imported as follows
training_data = pd.read_csv('train.csv')
X = training_data.iloc[:,1:].values
y = training_data.iloc[:,0].values
where X is 28000x784 feature matrix and y is 28000x10 label matrix
Now I can't figure out how to use it with preprocessing function
This dosn't seem to work
dataset = [Instance(X,y)]
#preprocessor = construct_preprocessor( dataset, [replace_nan, standarize] )
#training_data = preprocessor( dataset )
How can I train the neural network on X and y?
I'm guessing pd.read_csv
is a method from the pandas
library? And further that
input_matrix = pd.read_csv('train.csv').iloc[:,1:].values
#input_matrix has shape (n_samples, n_features)
The issue arises where you initalize a single training instance with the entire training set:
dataset = [ Instance( input_matrix, y )] # input_matrix = pd.read_csv('train.csv').iloc[:,1:].values
You have to loop over the instances in the input_matrix
and initialize one Instance
for each input vector. The correct syntax is: Instance( input_vector, target_vector )
Let me know if it didn't work out
If you provide an example piece of code, I'll help you modify it. Untill then, maybe you answer will be resolved through a quick scroll on this page: nimblenet?