emminath asked . 2021-04-13

What is the data "YTrain" in the Matlab CNN Regression example?

I've been following through this Matlab regression example where the network is trained to recognise the varying rotations in handwritten digits. I wanted to explore the results further and so found the root files in the program directory - inside, there are 10 subfolders (0-9) containing a total of 10,000 images and 2 excel sheets, "digitTest" and "digitTrain". These excel sheets are each 5000 rows of 3 columns for image file name, digit and rotated angle respectively. After running the code in the example myself and comparing the results, I can see that the response YTrain is the same as the excel file "digitTrain" and the response YValidation is the same as the excel file "digitTest". Later on in the post-processing of the data, a YPrediction and hence prediction error is calculated as so:

 

YPredicted = predict(net,XValidation);
predictionError = YValidation - YPredicted;

These 3 seperate responses have confused me and I'm looking for some clarification. From my understanding, validation data consists of the true values that are used to compare against the responses during training, in order to gain a rough estimation of how accurate a given network is. This makes sense as prediction error is the difference between the true and predicted values. I am not altogether sure what YTrain is; if this is meant to respresent the training responses, then why is there an excel sheet with pre-defined responses within the program directory already? What is YTrain representing, and if I were to train my own network would I need to generate a similar YTrain alongside my YValidation? 

deep learning , matlab , simulink , cnn , regression, matlab example , responses , ai

Expert Answer

Kshitij Singh answered . 2024-12-22 01:43:27

As you have mentioned already, the images in the subfolders (0-9) contain the Input images of both Training (XTrain) and Validation (XValidation) images, similarly the Excel sheet contains the Response/Target data which the network is supposed to predict. The functions digitTrain4DArrayData and digitTest4DArrayData returns the images and their corresponding rotated angles as X and Y data respectively. Then XTrain and YTrain are used to train the network. During training phase the network performs forward pass on the XTrain data and the network produces some response data, then the loss is computed between the predicted response and YTrain followed by gradients, backward pass etc. Whereas XValidation and YValidation are used to validate the network while training and after the trianing is completed.
 
 
In order to train your own network with the same dataset then you can directly use the existing dataset by referring to the Load Data section of the example. If you have to train your own network on different images other than what is used in the example then, yes you have to generate the corresponding Y data (YTrain and YValidation) accordingly.


Not satisfied with the answer ?? ASK NOW

Frequently Asked Questions

MATLAB offers tools for real-time AI applications, including Simulink for modeling and simulation. It can be used for developing algorithms and control systems for autonomous vehicles, robots, and other real-time AI systems.

MATLAB Online™ provides access to MATLAB® from your web browser. With MATLAB Online, your files are stored on MATLAB Drive™ and are available wherever you go. MATLAB Drive Connector synchronizes your files between your computers and MATLAB Online, providing offline access and eliminating the need to manually upload or download files. You can also run your files from the convenience of your smartphone or tablet by connecting to MathWorks® Cloud through the MATLAB Mobile™ app.

Yes, MATLAB provides tools and frameworks for deep learning, including the Deep Learning Toolbox. You can use MATLAB for tasks like building and training neural networks, image classification, and natural language processing.

MATLAB and Python are both popular choices for AI development. MATLAB is known for its ease of use in mathematical computations and its extensive toolbox for AI and machine learning. Python, on the other hand, has a vast ecosystem of libraries like TensorFlow and PyTorch. The choice depends on your preferences and project requirements.

You can find support, discussion forums, and a community of MATLAB users on the MATLAB website, Matlansolutions forums, and other AI-related online communities. Remember that MATLAB's capabilities in AI and machine learning continue to evolve, so staying updated with the latest features and resources is essential for effective AI development using MATLAB.

Without any hesitation the answer to this question is NO. The service we offer is 100% legal, legitimate and won't make you a cheater. Read and discover exactly what an essay writing service is and how when used correctly, is a valuable teaching aid and no more akin to cheating than a tutor's 'model essay' or the many published essay guides available from your local book shop. You should use the work as a reference and should not hand over the exact copy of it.

Matlabsolutions.com provides guaranteed satisfaction with a commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been empanelled after extensive research and quality check.

Matlabsolutions.com provides undivided attention to each Matlab assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work done at the best price in industry.