<jupyter_start><jupyter_text>Travel distance Optimization<jupyter_code>import pyforest
sns.set_style('darkgrid')
x = np.linspace(0.1,300,300)
fatigue = x*0.01
fun = np.log(x+1)
plt.figure(figsize=(8,5))
happiness = -fatigue
sns.lineplot(x,happiness)
plt.axvline(x[(np.argmax(happiness))],alpha = 0.5,color = 'red')
plt.ylabel('Happiness')
plt.xlabel('Distance')
plt.savefig('../img/optimization_only_fat.png')
plt.figure(figsize=(8,5))
happiness = fun
sns.lineplot(x,happiness)
plt.axvline(x[(np.argmax(happiness))],alpha = 0.5,color = 'red')
plt.ylabel('Happiness')
plt.xlabel('Distance')
plt.savefig('../img/optimization_only_hap.png')
plt.figure(figsize=(8,5))
happiness = fun - fatigue
sns.lineplot(x,happiness)
plt.ylabel('Happiness')
plt.xlabel('Distance')
plt.axvline(x[(np.argmax(happiness))],alpha = 0.5,color = 'red')
plt.savefig('../img/optimization_moderate.png')
plt.figure(figsize=(8,5))
happiness = 1.1*fun - 0.9*fatigue
sns.lineplot(x,happiness)
plt.ylabel('Happiness')
plt.xlabel('Distance')
plt.axvline(x[(np.argmax(happiness))],alpha = 0.5,color = 'red')
plt.savefig('../img/optimization_moderate_1.png')
x[(np.argmax(happiness))]<jupyter_output><empty_output><jupyter_text>Machine Learning<jupyter_code>from sklearn.linear_model import LinearRegression
x = np.linspace(0,5)
X = x.reshape(-1,1)
y = x+ np.random.normal(0,0.5,50)
plt.figure(figsize = (8,5))
sns.scatterplot(x,y)
plt.savefig('../img/optimization_linearRegression')
plt.figure(figsize = (8,5))

sns.scatterplot(x,y)
for i in range(10):
    y_line = np.random.uniform(0.1,2)*(x - 2.5 + np.random.uniform(-0.5,0.5)) +3
    sns.lineplot(x,y_line)
plt.ylim(0,6)    
plt.savefig('../img/optimization_random')
reg = LinearRegression()
reg.fit(X,y)
y_pred = reg.coef_ * x + reg.intercept_
plt.figure(figsize = (8,5))
sns.scatterplot(x,y)
sns.lineplot(x,y_pred,color = 'r')
plt.savefig('../img/optimization_linearRegression_w_pred')
reg.coef_
reg.intercept_<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.19571865443425077, 'fraction_numerical': 0.03160040774719674, 'mean_word_length': 6.7896825396825395, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '644366', 'license': 'MIT', 'n_tokens_mistral': 905, 'n_tokens_neox': 838, 'n_words': 99, 'path': 'assets/examples/Optimization_explained.ipynb', 'repo_name': 'hyeonchan523/hyeonchan523.github.io', 'size': '1962'}