Spaces:
Runtime error
Runtime error
import streamlit as st | |
from page_config import APP_PAGE_HEADER | |
from ml_algorithms.linear_regression_gradient_descent import app as lrgd_app | |
APP_PAGE_HEADER() | |
with st.expander("Linear Regression using Gradient Descent"): | |
lrgd_app() | |
def app2(): | |
import streamlit as st | |
import numpy as np | |
import matplotlib.pyplot as plt | |
st.write("*** Program Started ***") | |
n = 50 | |
x = np.arange(-n / 2, n / 2, 1, dtype=np.float64) | |
m = np.random.uniform(0.3, 0.5, (n,)) | |
b = np.random.uniform(5, 10, (n,)) | |
y = x * m + b | |
print("x", x, type(x[0])) | |
print("y", y, type(y[0])) | |
plt.scatter( | |
x, | |
y, | |
s=None, | |
marker="o", | |
color="g", | |
edgecolors="g", | |
alpha=0.9, | |
label="Linear Relation", | |
) | |
plt.grid(color="black", linestyle="--", linewidth=0.5, markevery=int) | |
plt.legend(loc=2) | |
plt.axis("scaled") | |
st.pyplot(plt.show()) | |
# app2() | |