<jupyter_start><jupyter_text><jupyter_code>right_w1, right_w2 = gradient_regressor(0)
right_w1_l2, right_w2_l2 = gradient_regressor(10)
def prediction_regr(w1, w2, xi):
    probability = 1 / (1 + exp(-w1*xi[0]-w2*xi[1]))
    return probability
# x_new = data.drop(['target'], axis = 1)
scores = x_new.apply(lambda xi: prediction_regr(right_w1, right_w2, xi), axis = 1)
scores = np.array(scores)
scores_l2 = x_new.apply(lambda xi: prediction_regr(right_w1_l2, right_w2_l2, xi), axis = 1)
y = np.array(data.target)
roc_auc_score(y, scores), roc_auc_score(y, scores_l2)


import scikitplot as skplt
import matplotlib.pyplot as plt

plt.plot(scores,y)
plt.legend(loc=4)
plt.show()
target = pd.DataFrame(data=data.target)
w1, w2 = gradient_regressor(0.)
l2w1, l2w2 = gradient_regressor(10.)

print(w1, w2, l2w1, l2w2)

scores = x.apply(lambda xi: sigma(xi, w1, w2), axis=1)
l2scores = x.apply(lambda xi: sigma(xi, l2w1, l2w2), axis=1)
auc_score = roc_auc_score(y, scores)
l2_auc_score = roc_auc_score(y, l2scores)

print(auc_score)
print(l2_auc_score)

f = open('submission.txt', 'w')
f.write(str(auc_score) + ' ' + str(l2_auc_score))
f.close()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1514114627887083, 'fraction_numerical': 0.04875962360992301, 'mean_word_length': 6.405063291139241, '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': '288339', 'license': 'MIT', 'n_tokens_mistral': 553, 'n_tokens_neox': 527, 'n_words': 95, 'path': 'Logistic_regression.ipynb', 'repo_name': 'matveymex/DS', 'size': '1169'}