| @@ 287-303 (lines=17) @@ | ||
| 284 | return a_val |
|
| 285 | ||
| 286 | ||
| 287 | def linear_coeff(vec_x, vec_y): |
|
| 288 | """ |
|
| 289 | This function returns the inclination coeffecient and y axis interception coeffecient m and b. |
|
| 290 | ---------- |
|
| 291 | Parameters |
|
| 292 | ---------- |
|
| 293 | x : Output of the split vector function. |
|
| 294 | y : Output of the split vector function. |
|
| 295 | ------- |
|
| 296 | Returns |
|
| 297 | ------- |
|
| 298 | float number of m and b. |
|
| 299 | """ |
|
| 300 | m_val = ((multiplica(vec_x, vec_y) - sum_mean(vec_x)[0] * sum_mean(vec_y)[1])/ |
|
| 301 | (multiplica(vec_x, vec_x) - sum_mean(vec_x)[0] * sum_mean(vec_x)[1])) |
|
| 302 | b_val = sum_mean(vec_y)[1] - m_val * sum_mean(vec_x)[1] |
|
| 303 | return m_val, b_val |
|
| 304 | ||
| 305 | ||
| 306 | def y_fitted_line(m_val, b_val, vec_x): |
|
| @@ 128-144 (lines=17) @@ | ||
| 125 | a_val = a_val + (vec_x * vec_y) |
|
| 126 | return a_val |
|
| 127 | ||
| 128 | def linear_coeff(vec_x, vec_y): |
|
| 129 | """ |
|
| 130 | This function returns the inclination coeffecient and y axis interception coeffecient m and b. |
|
| 131 | ---------- |
|
| 132 | Parameters |
|
| 133 | ---------- |
|
| 134 | x : Output of the split vector function. |
|
| 135 | y : Output of the split vector function. |
|
| 136 | ------- |
|
| 137 | Returns |
|
| 138 | ------- |
|
| 139 | float number of m and b. |
|
| 140 | """ |
|
| 141 | m_val = ((multiplica(vec_x, vec_y) - sum_mean(vec_x)[0] * sum_mean(vec_y)[1])/ |
|
| 142 | (multiplica(vec_x, vec_x) - sum_mean(vec_x)[0] * sum_mean(vec_x)[1])) |
|
| 143 | b_val = sum_mean(vec_y)[1] - m_val * sum_mean(vec_x)[1] |
|
| 144 | return m_val, b_val |
|
| 145 | ||
| 146 | ||
| 147 | def y_fitted_line(m_val, b_val, vec_x): |
|