Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed May 7, 2026
commit 8fd53296f0d86661dd9b319c4b74d8ffae858507
12 changes: 4 additions & 8 deletions machine_learning/linear_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
# ]
# ///

import httpx
import numpy as np
import matplotlib.pyplot as plt

Check failure on line 22 in machine_learning/linear_regression.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (I001)

machine_learning/linear_regression.py:20:1: I001 Import block is un-sorted or un-formatted help: Organize imports

Check failure on line 22 in machine_learning/linear_regression.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (I001)

machine_learning/linear_regression.py:20:1: I001 Import block is un-sorted or un-formatted help: Organize imports


def collect_dataset():
"""Collect dataset of CSGO
The dataset contains ADR vs Rating of a Player
Expand Down Expand Up @@ -109,7 +110,7 @@
theta = run_steep_gradient_descent(data_x, data_y, len_data, alpha, theta)
error = sum_of_square_error(data_x, data_y, len_data, theta)
err.append(error)

if i % 1000 == 0:
print(f"At Iteration {i + 1} - Error is {error:.5f}")

Expand All @@ -131,8 +132,7 @@
return total / len(original_y)



# visulization
# visulization
def plot_regression(data_x, data_y, theta):
"""
Plot regression line with dataset points
Expand Down Expand Up @@ -178,10 +178,10 @@
data_x = np.c_[np.ones(len_data), data[:, :-1]].astype(float)
data_y = data[:, -1].astype(float)

theta,err = run_linear_regression(data_x, data_y)
theta, err = run_linear_regression(data_x, data_y)

plot_regression(data_x, data_y, theta)
plt_loss(err)

Check failure on line 184 in machine_learning/linear_regression.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (F821)

machine_learning/linear_regression.py:184:5: F821 Undefined name `plt_loss`

Check failure on line 184 in machine_learning/linear_regression.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (F821)

machine_learning/linear_regression.py:184:5: F821 Undefined name `plt_loss`

len_result = theta.shape[1]
print("Resultant Feature vector : ")
Expand All @@ -194,7 +194,3 @@

doctest.testmod()
main()




Loading