In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Today, I will talk to you about Pytorch dataset segmentation and momentum example analysis. Many people may not know much about it. In order to let you know more, Xiaobian summarizes the following contents for you. I hope you can gain something according to this article.
1. data set is segmented
The training set and the test set can be obtained directly through datasets.
Usually we split the training set using the torch.utils.data.random_split method.
All data needs to be loaded through torch.util.data.DataLoader to get a usable dataset.
The specific codes are as follows:
2.
2. regularization
Regularization in PyTorch is the same as in machine learning, but set up differently.
Set weight_decay directly in the optimizer. In optimizers, the default is L2, so the parameter filled in is lambda. To use the L1 paradigm, you need to write code manually.
3. momentum and learning rate decay
The momentum settings can be done directly in the optimizer. Set by moment parameter.
The learning rate is adjusted by ReduceLROnPlateau,StepLR in torch.optim.lr_scheduler.
ReduceLROnPlateau is an automatic detection loss value and attenuates the learning rate.
StepLR requires manual setting of parameters for attenuation.
After reading the above, do you have any further understanding of Pytorch dataset segmentation and momentum example analysis? If you still want to know more knowledge or related content, please pay attention to the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.