Spaces:
Runtime error
Runtime error
Fix .np by .jnp
Browse files
app.py
CHANGED
@@ -23,8 +23,8 @@ cost_function = st.sidebar.radio('What cost function you want to use for the fit
|
|
23 |
# Generate random data
|
24 |
X = np.column_stack((jnp.ones(number_of_observations),
|
25 |
jax.random.uniform(key, shape=(number_of_observations,), minval=0., maxval=1.))
|
26 |
-
w =
|
27 |
-
X =
|
28 |
additional_noise = 8 * jax.random.bernoulli(key, p=0.08, shape=[number_of_observations,])
|
29 |
y = jnp.dot(X, w) + noise_standard_deviation * jax.random.normal(key, shape=[number_of_observations,]) \
|
30 |
+ additional_noise
|
|
|
23 |
# Generate random data
|
24 |
X = np.column_stack((jnp.ones(number_of_observations),
|
25 |
jax.random.uniform(key, shape=(number_of_observations,), minval=0., maxval=1.))
|
26 |
+
w = jnp.array([3.0, -20.0, 32.0]) # coefficients
|
27 |
+
X = jnp.column_stack((X, X[:,1] ** 2)) # add x**2 column
|
28 |
additional_noise = 8 * jax.random.bernoulli(key, p=0.08, shape=[number_of_observations,])
|
29 |
y = jnp.dot(X, w) + noise_standard_deviation * jax.random.normal(key, shape=[number_of_observations,]) \
|
30 |
+ additional_noise
|