Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -54,11 +54,21 @@ st.write(coeff_df)
|
|
54 |
|
55 |
|
56 |
coefficients = [i for i in regressor.coef_]
|
57 |
-
|
58 |
|
59 |
-
|
60 |
-
|
61 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
st.write("### Polynomial Equation")
|
64 |
st.latex(latex_equation)
|
|
|
54 |
|
55 |
|
56 |
coefficients = [i for i in regressor.coef_]
|
57 |
+
formatted_coefficients = [f'{coeff:.2e}' for coeff in coefficients if coeff != 0]
|
58 |
|
59 |
+
terms = [f'{formatted_coefficients[i]}X^{i+1}' for i in range(len(formatted_coefficients))]
|
60 |
+
|
61 |
+
formatted_intercept = f'{regressor.intercept_:.2e}'
|
62 |
+
|
63 |
+
formatted_equation = ' + '.join(terms)
|
64 |
+
if formatted_equation:
|
65 |
+
formatted_equation = formatted_intercept + ' + ' + formatted_equation
|
66 |
+
else:
|
67 |
+
formatted_equation = formatted_intercept
|
68 |
+
|
69 |
+
latex_equation = f'''
|
70 |
+
Our Equation: {formatted_equation}
|
71 |
+
'''
|
72 |
|
73 |
st.write("### Polynomial Equation")
|
74 |
st.latex(latex_equation)
|