勾配降下法
Published:
By nobCategory: Posts
P.102 例題 関数 \(z=x^2+y^2\) について、その最小値を与える \(x, y\) の値を勾配降下法で求めましょう。
$$
勾配 \left(\frac{\partial z}{\partial x}, \frac …
Published:
By nobCategory: Posts
Published:
By nobCategory: Posts
Tags: 機械学習 ニューラルネットワーク Python
import numpy as np
class SimplePerceptron:
def __init__(self, epochs=20, learning_rate=0.1, persistence=2):
self.epochs = epochs
self.learning_rate = learning_rate
self.persistence = persistence
def step(self, z):
return np.where(z >= 0, 1, 0)
def activate(self, z):
return self.step(z)
def _predict(self …
Published:
By nobCategory: Posts
Tags: Python BeautifulSoup
software | version |
---|---|
Python | 3.11.5 |
BeautifulSoup | 4.12.2 |
>>> from bs4 import BeautifulSoup
>>> def my_tag(tag):
... return (tag.attrs.get("data-urlRoot") == "/json")
...
>>> data = "<div data-urlRoot='/json'></div>"
>>> soup = BeautifulSoup(data, "html.parser")
>>> tags = soup.find_all(my_tag)
>>> tags
[]
BeautifulSoupでは読み込んだHTMLのタグ/属性を小文 …