Nifdi01 commited on
Commit
a4422ba
1 Parent(s): 5f39eb5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -4
app.py CHANGED
@@ -54,11 +54,21 @@ st.write(coeff_df)
54
 
55
 
56
  coefficients = [i for i in regressor.coef_]
57
- terms = [f'{coeff:.3f}X^{i}' for i, coeff in enumerate(coefficients) if coeff != 0]
58
 
59
- latex_equation = r'''
60
- Our Equation: {:.3f} + {}
61
- '''.format(regressor.intercept_, ' + '.join(terms))
 
 
 
 
 
 
 
 
 
 
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)