<jupyter_start><jupyter_text>FastGradRidgeLogit Demo on Simulated Dataset  About DataA simulated data set with two classes. Each class has 30 observations and 50 variables. Class 1 is denoted by 1, class 2 is denoted by 0. Data Process Before Model Training<jupyter_code>import pandas as pd
import numpy as np
import sklearn.preprocessing

# Generate simulated dataset
np.random.seed(123)
cls1 = np.random.normal(0,2,(30,50))
cls2 = np.random.normal(1,2,(30,50))
x_train = np.concatenate((cls1,cls2), axis = 0)

y1 = np.ones(30)
y2 = np.zeros(30)
y_train = np.concatenate((y1,y2))
y_train = y_train*2 - 1  # Convert to +/- 1

# Standardize the data. 
scaler = sklearn.preprocessing.StandardScaler()
scaler.fit(x_train)
x_train = scaler.transform(x_train)<jupyter_output><empty_output><jupyter_text>Train Model Using FastGradRidgeLogit<jupyter_code>from fgrlogit import FastGradRidgeLogit

fg = FastGradRidgeLogit()<jupyter_output><empty_output><jupyter_text>**FastGradRidgeLogit.fit(lambduh, x, y, maxiter = 300)**Fit the model with x_train dataset and y_train dataset.<jupyter_code>fg.fit(lambduh = 0.1,x = x_train,y = y_train)<jupyter_output>Start fast gradient descent:
Fast gradient iteration 100
Fast gradient iteration 200
Fast gradient iteration 300<jupyter_text>**FastGradRidgeLogit.plot_objective( )**After fitting the model, we can visualize the objective value change through the iteration by calling plot_objective().<jupyter_code>fg.plot_objective()<jupyter_output><empty_output><jupyter_text>**FastGradRidgeLogit.plot_misclassification_error( )**After fitting the model, we can also visualize the model performance through the iteration by calling plot_misclassification_error().<jupyter_code>fg.plot_misclassification_error()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09491525423728814, 'fraction_numerical': 0.029943502824858758, 'mean_word_length': 7.433333333333334, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '9883', 'license': 'MIT', 'n_tokens_mistral': 640, 'n_tokens_neox': 590, 'n_words': 151, 'path': 'demo on simulated dataset.ipynb', 'repo_name': 'wangbeiqi199159/fast-gradient-logit', 'size': '1770'}