Skip to Main Content
Машинное обучение с PyTorch и Scikit-Learn
book

Машинное обучение с PyTorch и Scikit-Learn

by Sebastian Raschka, Yuxi (Hayden) Liu, Vahid Mirjalili
May 2024
Beginner to intermediate content levelBeginner to intermediate
688 pages
26h
Russian
Foliant
Content preview from Машинное обучение с PyTorch и Scikit-Learn
430 Глава 13
self.log("valid_acc", self.valid_acc.compute(), prog_bar=True)
return loss
def test_step(self, batch, batch_idx):
x, y = batch
logits = self(x)
loss = nn.functional.cross_entropy(self(x), y)
preds = torch.argmax(logits, dim=1)
self.test_acc.update(preds, y)
self.log("test_loss", loss, prog_bar=True)
self.log("test_acc", self.test_acc.compute(), prog_bar=True)
return loss
def configure_optimizers(self):
optimizer = torch.optim.Adam(self.parameters(), lr=0.001)
return optimizer
Рассмотрим все эти методы по порядку. Как можно видеть, конструктор
__init__
со-
держит тот же код модели, который мы использовали ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

CompTIA Network+ -- Vorbereitung auf die Prüfung N10-009

CompTIA Network+ -- Vorbereitung auf die Prüfung N10-009

Markus Kammermann

Publisher Resources

ISBN: 9786011100342