Skip to content

Commit 4db85f5

Browse files
Refactor imports and improve README formatting in linear regression scripts
1 parent 2e6804d commit 4db85f5

2 files changed

Lines changed: 14 additions & 12 deletions

File tree

machine_learning/linear_regression_naive.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import httpx
2+
import numpy as np
3+
14
"""README, Author - Somrita Banerjee(mailto:somritabanerjee126@gmail.com)
25
Requirements:
36
- Python >= 3.13
@@ -11,7 +14,8 @@
1114
Usage:
1215
- Run this script directly:
1316
python linear_regression_naive.py
14-
- The script will fetch the dataset, run linear regression using gradient descent, and print the learned feature vector (theta) and error at each iteration.
17+
- The script will fetch the dataset, run linear regression using gradient descent,
18+
and print the learned feature vector (theta) and error at each iteration.
1519
1620
"""
1721

@@ -27,7 +31,6 @@
2731
References:
2832
https://en.wikipedia.org/wiki/Linear_regression
2933
"""
30-
3134
# /// script
3235
# requires-python = ">=3.13"
3336
# dependencies = [
@@ -36,9 +39,6 @@
3639
# ]
3740
# ///
3841

39-
import httpx
40-
import numpy as np
41-
4242

4343
def collect_dataset() -> np.ndarray:
4444
"""Collect dataset of CSGO (ADR vs Rating)

machine_learning/linear_regression_vectorized.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
1+
import httpx
2+
import numpy as np
3+
14
"""README, Author - Somrita Banerjee(mailto:somritabanerjee126@gmail.com)
25
Requirements:
36
- Python >= 3.13
47
- httpx
58
- numpy
69
710
Inputs:
8-
- The script automatically downloads a CSV dataset (ADR vs Rating) from a public GitHub URL.
9-
- The dataset must have features in all columns except the last, which is the label (rating).
11+
- The script automatically downloads a CSV dataset (ADR vs Rating)
12+
from a public GitHub URL.
13+
- The dataset must have features in all columns except the last, which is the label
14+
(rating).
1015
1116
Usage:
1217
- Run this script directly:
1318
python linear_regression_vectorized.py
14-
- The script will fetch the dataset, run linear regression using gradient descent, and print the learned feature vector (theta) and error at intervals.
19+
- The script will fetch the dataset, run linear regression using gradient descent,
20+
and print the learned feature vector (theta) and error at intervals.
1521
1622
"""
1723

@@ -27,7 +33,6 @@
2733
References:
2834
https://en.wikipedia.org/wiki/Linear_regression
2935
"""
30-
3136
# /// script
3237
# requires-python = ">=3.13"
3338
# dependencies = [
@@ -36,9 +41,6 @@
3641
# ]
3742
# ///
3843

39-
import httpx
40-
import numpy as np
41-
4244

4345
def collect_dataset() -> np.ndarray:
4446
"""Collect dataset of CSGO (ADR vs Rating).

0 commit comments

Comments
 (0)