<jupyter_start><jupyter_text>``Evaluation``<jupyter_code>from sklearn.metrics import r2_score

test_rank = np.asanyarray(test[['LOG_RANK']])
test_freq = np.asanyarray(test[['LOG_FREQUENCY_RATIO']])

test_freq_predicted = reg.predict(test_rank)

# We'll compare our test results using three metrices, as follows:

print("Mean absolute error: %.2f" % np.mean(np.absolute(test_freq_predicted - test_freq)))    # Mean absolute Error
print("Residual sum of squares (MSE): %.2f" % np.mean((test_freq_predicted - test_freq) ** 2))    # Mean squared Error
print("R2-score: %.2f" % r2_score(test_freq , test_freq_predicted))    # Root mean squared error<jupyter_output>Mean absolute error: 0.05
Residual sum of squares (MSE): 0.01
R2-score: 0.99
{'fraction_non_alphanumeric': 0.1331521739130435, 'fraction_numerical': 0.02309782608695652, 'mean_word_length': 6.086538461538462, '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': '366850', 'license': 'MIT', 'n_tokens_mistral': 285, 'n_tokens_neox': 269, 'n_words': 60, 'path': 'Assignment 2/New_code.ipynb', 'repo_name': 'Vaibhav9119/MBA749A-Assignments', 'size': '736'}