<jupyter_start><jupyter_text>Activity 9 - Gradient DescentImplement the same model as Activity 2 using gradient descent<jupyter_code>import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.linear_model import SGDRegressor
    
# Loading the data from activity 1
df = pd.read_csv('activity2_measurements.csv')
df_first_year = pd.read_csv('activity_first_year.csv')
rolling = pd.read_csv('activity2_rolling.csv')
window = 20

# Trendline values
trend_x = np.array([
    1,
    182.5,
    365
])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08363636363636363, 'fraction_numerical': 0.02727272727272727, 'mean_word_length': 5.333333333333333, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '237292', 'license': 'MIT', 'n_tokens_mistral': 197, 'n_tokens_neox': 186, 'n_words': 50, 'path': 'Chapter 3 - Regression Analysis/Activity 9 - Gradient Descent.ipynb', 'repo_name': 'doc-E-brown/Applied-Supervised-Learning-with-Python', 'size': '550'}