Now we have our best theta’s, lets reshape back into 2 sets of theta’s so we can check for accuracy. % Run cost function to find lowest cost thetas options = optimset(‘MaxIter’, 50) lambda = 1 costFunction = m圜ostFunction(p, input_layer_size, hidden_layer_size, output_layer_size, X, y, lambda) = fminunc(costFunction, initial_nn_params, options) Now, we can run our fminunc cost optimisation to find the best theta’s. Lets discuss these one by one clear % open csv file tbl = readtable(‘test.csv’) % replace strings fields with labels and create dataset matrix ds(:,1) = grp2idx(tbl) % remove rows with NaN in any field values ds = rmmissing(ds) = size(ds) % Create X and y matrix X = ds(:,) y = ds(:,n) Īfter running this step, you should see the following results in X and Y matrix’s. Use our best theta for a prediction to calculate our training set accuracy.Cost optimisation to find the best theta. Label our string fields to numeric values.Lets discuss first the main program which will have the following steps: We will have a few utility functions, but those will be covered seperatly.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |