Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7866087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:17:17+00:00 2026-06-03T00:17:17+00:00

Using the neural network takes longer than training it. Am I doing something horribly

  • 0

Using the neural network takes longer than training it. Am I doing something horribly wrong? 2 minutes to use vs 14 seconds to train.

load building_dataset % 4208 examples

inputs = buildingInputs; 
targets = buildingTargets;

% Create a Fitting Network
hiddenLayerSize = 10;
net = fitnet(hiddenLayerSize);

% Setup Division of Data for Training, Validation, Testing
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;

% Train the Network
tic
[net,tr] = train(net,inputs,targets);
training_time = toc % ~= 14 seconds

% use the neural network
time = 0;
for i = 1:4208
  test_input = buildingInputs(:,i);
  tic
  test_output = net(test_input);
  time = time + toc;
end

time % ~= 117 seconds
average_time = time / 4208 % ~= 0.028 seconds
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T00:17:18+00:00Added an answer on June 3, 2026 at 12:17 am

    You have to vectorize the input. Replace the for loop with this:

      test_input = buildingInputs(:,:);
      tic
      test_output = net(test_input);
      time = time + toc;
    

    the output will be a matrix of results

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm training a XOR neural network via back-propagation using stochastic gradient descent. The weights
When training a multi-layer neural network, using a sigmoidal activation function is necessary for
I'm considering using a neural network to power my enemies in a space shooter
I'm creating a neural network using the backpropagation technique for learning. I understand we
i am working on Neural network in java using the code here But when
I am implementing a feed-forward Neural Network which trains using backpropagation. When I output
I'm using ruby's ai4r gem, building a neural network. Version 1.1 of the gem
I am wondering how to go about training a neural network without providing it
The output layer of my neural network (3 layered) is using sigmoid as activation
Hy everybody, I'm trying to implement a neural network with matlab using nntool. Does

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.