<jupyter_start><jupyter_text>Duke ML Workshop  Based on housing numbers address from google (link was provided to continue and exxplore on our own)<jupyter_code>#common imports for notebook to work (learned this in class as well)
import os
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import scipy.io
import pandas as pd
np.random.seed(42)
originialData = scipy.io.loadmat('train_32x32.mat') #we chose the smaller dataset because of storage reasons
X = originialData['X']
y = originialData['y']
imageID = 25
plt.imshow(X[:, :, :, imageID])
plt.show()
print(y[imageID]) #expected 63
from sklearn.utils import shuffle
X = X.reshape(X.shape[0] * X.shape[1] * X.shape[2], X.shape[3]).T
y = y.reshape(y.shape[0], )
X, y = shuffle(X, y, random_state = 42)
from sklearn.ensemble import RandomForestClassifier #Type of classifier in ML (we learned this in class as well)
dataRandomClass = RandomForestClassifier()
print(dataRandomClass)
RandomForestClassifier(bootstrap = True, class_weight = None, criterion = 'gini', #Gini! earned last week as well with impurity (Gini)
           max_depth = None, max_features = 'auto', max_leaf_nodes = None,
           min_impurity_split = 1e-07, min_samples_leaf = 1,
           min_samples_split = 2, min_weight_fraction_leaf = 0.0,
           n_estimators = 10, n_jobs = 1, oob_score = False, random_state = None,
           verbose = 0, warm_start = False)
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state = 42)
dataRandomClass.fit(X_train, y_train)
from sklearn.metrics import accuracy_score
finalPredictions = dataRandomClass.predict(X_test)
print("Accuracy Score:", accuracy_score(y_test, finalPredictions))<jupyter_output>Accuracy Score: 0.5575348075348076
{'fraction_non_alphanumeric': 0.09884041965764771, 'fraction_numerical': 0.027056874654886803, 'mean_word_length': 5.142372881355932, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '169221', 'license': 'Apache-2.0', 'n_tokens_mistral': 646, 'n_tokens_neox': 601, 'n_words': 178, 'path': 'House Addresses.ipynb', 'repo_name': 'advaitk13/DukeML', 'size': '1811'}