Can it compute y=sin x?
> First, this doesn't mean that a network can be used to exactly compute any function. Rather, we can get an approximation that is as good as we want. By increasing the number of hidden neurons we can improve the approximation.
A visual proof that neural nets can approximate any function
11–20 of 138 posts
Re: A visual proof that neural nets can approximate any function
#12Any orthonormal ~set~ basis of functions can represent any function. So what?
Re: A visual proof that neural nets can approximate any function
#13*any continuous function
Re: A visual proof that neural nets can approximate any function
#14Any deeplearning expert here. Why Neural network can't compute a linear function Celsius to Fahrenheit 100% accurately. Is it data or is it something can be optimised. ``` celsius_q = np.array([-40, -10, 0, 8, 15, 22, 38], dtype=float) fahrenheit_a = np.array([-40, 14, 32, 46, 59, 72, 100], dtype=float) for i,c in enumerate(celsius_q): print("{} degrees Celsius = {} degrees Fahrenheit".format(c, fahrenheit_a[i])) l0…
* Tune the hyperparameters. In particular, tune the learning rate. To quote the Deep Learning Book [0]:
> The learning rate is perhaps the most important hyperparameter. If you have time to tune only one hyperparameter, tune the learning rate. It controls the effective capacity of the model in a more complicated way than other hyperparameters—the effective capacity of the model is highest when the learning rate is correct for the optimization problem, not when the learning rate is especially large or especially small.
The following code will yield exactly 212 almost every run (using fixed data and a different choice of learning rate):
```
celsius_q = np.array([-40, -10, 0, 8, 15, 22, 38], dtype=float)
fahrenheit_a = np.array([x * 1.8 + 32 for x in celsius_q], dtype=float)
for i, c in enumerate(celsius_q):
print("{} degrees Celsius = {} degrees Fahrenheit".format(c, fahrenheit_a[i]))
l0 = tf.keras.layers.Dense(units=1, input_shape=[1])model = tf.keras.Sequential([l0])
model.compile(loss='mean_squared_error', optimizer=tf.keras.optimizers.Adam(lr=1.0))
history = model.fit(celsius_q, fahrenheit_a, epochs=500, verbose=False)
print("Finished training the model")
print(model.predict([100.0]))
```
[0] https://www.deeplearningbook.org/contents/guidelines.html
Re: A visual proof that neural nets can approximate any function
#15Any deeplearning expert here. Why Neural network can't compute a linear function Celsius to Fahrenheit 100% accurately. Is it data or is it something can be optimised. ``` celsius_q = np.array([-40, -10, 0, 8, 15, 22, 38], dtype=float) fahrenheit_a = np.array([-40, 14, 32, 46, 59, 72, 100], dtype=float) for i,c in enumerate(celsius_q): print("{} degrees Celsius = {} degrees Fahrenheit".format(c, fahrenheit_a[i])) l0…
Your data is suspiciously rounded off. Just doing linear regression on that data isn't going to give you a perfect fit either.
And also what I learned in school which is doing linear regression using a function with more degrees of freedom than the data tends to generate garbage. It can match the data points exactly and then be wildly off between them.
Re: A visual proof that neural nets can approximate any function
#16*any continuous function
If you are using gradient descent, then you'll need the desired loss function to be differentiable with respect to the parameters, but that's a totally different matter.
Re: A visual proof that neural nets can approximate any function
#17Re: A visual proof that neural nets can approximate any function
#18Re: A visual proof that neural nets can approximate any function
#19I'd like to see a neural network that can compute a hash function.
Re: A visual proof that neural nets can approximate any function
#20I'd like to see a neural network that can compute a hash function.