<jupyter_start><jupyter_text>ee627 midterm> I pledge my Honor that I have abided by the Stevens Honor System. - <NAME> 3/27/21<jupyter_code>import numpy as np
import pandas as pd
from sklearn.metrics import roc_curve, roc_auc_score
import matplotlib.pyplot as plt
from statsmodels.graphics.tsaplots import plot_acf, plot_pacf<jupyter_output><empty_output><jupyter_text>quesion 2<jupyter_code>num_samples = 1000

samples_1 = np.random.normal(scale=1, size=num_samples)
samples_2 = np.random.normal(scale=9**.5, size=num_samples)
data_1 = np.array([], dtype=np.float)
data_2 = np.array([], dtype=np.float)

for i in range(num_samples):
    curr_1 = samples_1[i]
    curr_2 = samples_2[i]
    if i > 0:
        curr_1 += 5 / 2. * samples_1[i - 1]
        curr_2 += 1 / 6. * samples_2[i - 1]
    if i > 1:
        curr_1 += 3 / 2. * samples_1[i - 2]
        curr_2 += 1 / 6. * samples_2[i - 2]
    data_1 = np.append(data_1, curr_1)
    data_2 = np.append(data_2, curr_2)
plot_acf(data_1)
plt.title('ACF time series 1')
plt.show()
plot_pacf(data_1)
plt.title('PACF time series 1')
plt.show()
plot_acf(data_2)
plt.title('ACF time series 2')
plt.show()
plot_pacf(data_2)
plt.title('PACF time series 2')
plt.show()<jupyter_output><empty_output><jupyter_text>question 3<jupyter_code>start, end, precision = -1000, 1000, 1000
x = np.linspace(start, end, precision)
y = np.linspace(start, end, precision)
X, Y = np.meshgrid(x, y)
B = 3*X + 5*Y + 15

plt.contourf(X, Y, B, 0)
plt.title('decision boundary', fontsize=20)
plt.xlabel('X_1', fontsize=16)
plt.ylabel('X_2', fontsize=16)
ax = plt.gca()
ax.text(500, 500, 'Y = 1', fontsize=15)
ax.text(-500, -500, 'Y = 0', fontsize=15)
plt.show()<jupyter_output><empty_output><jupyter_text>question 4<jupyter_code>data = pd.DataFrame({
    'student': [1, 2, 3, 4, 5, 6],
    'decision': [1, 0, 1, 1, 0, 0],
    'method1': [.99, .9, .9, .86, .85, .7],
    'method2': [.85, .7, .73, .65, .78, .55]
})
m1_x, m1_y, _ = roc_curve(data['decision'], data['method1'])
plt.plot(m1_x, m1_y)
plt.show()
auc = roc_auc_score(data['decision'], data['method1'])
print(f'auc: {auc:.2f}')
m2_x, m2_y, _ = roc_curve(data['decision'], data['method2'])
plt.plot(m2_x, m2_y)
plt.show()
auc = roc_auc_score(data['decision'], data['method2'])
print(f'auc: {auc:.2f}')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17779705117085862, 'fraction_numerical': 0.0663486556808326, 'mean_word_length': 4.640586797066015, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 21, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '521075', 'license': 'MIT', 'n_tokens_mistral': 1105, 'n_tokens_neox': 999, 'n_words': 216, 'path': 'assignments/midterm/midterm.ipynb', 'repo_name': 'jschmidtnj/ee627', 'size': '2314'}