<jupyter_start><jupyter_text>R-Squared
It is important to know how well the relationship between the values of the x- and y-axis is, if there are no relationship the polynomial regression can not be used to predict anything.

The relationship is measured with a value called the r-squared.

The r-squared value ranges from 0 to 1, where 0 means no relationship, and 1 means 100% related.

Python and the Sklearn module will compute this value for you, all you have to do is feed it with the x and y arrays:<jupyter_code># How well does my data fit in a polynomial regression?
import numpy as np
from sklearn.metrics import r2_score

x = [1,2,3,5,6,7,8,9,10,12,13,14,15,16,18,19,21,22]
y = [100,90,80,60,60,55,60,65,70,70,75,76,78,79,90,99,99,100]

mymodel = np.poly1d(np.polyfit(x, y, 3))

print(r2_score(y, mymodel(x))) 
# The result 0.94 shows that there is a very good relationship, 
# and we can use polynomial regression in future predictions

# Predict the speed of a car passing at 17 P.M:
speed = mymodel(17)
speed<jupyter_output>0.9432150416451026
{'fraction_non_alphanumeric': 0.08590102707749767, 'fraction_numerical': 0.09430438842203548, 'mean_word_length': 4.55440414507772, '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': '639654', 'license': 'MIT', 'n_tokens_mistral': 426, 'n_tokens_neox': 363, 'n_words': 148, 'path': 'polynomial_regression.ipynb', 'repo_name': 'gokhangemici/VeriBilimi101', 'size': '1071'}