<jupyter_start><jupyter_text>Using Linear Regerssion Modelhttps://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html<jupyter_code>from sklearn.linear_model import LinearRegression
LinReg = LinearRegression() # initializig Linear Regression
LinearRegression()
# training dataset
X = data_frame[past_columns][:-1] # the dataset consists of all the values except the last day
y = data_frame[future_columns][:-1]
# test dataset 
X_test = data_frame[past_columns][-1:] # the dataset consists of all the value of the last day
y_test = data_frame[future_columns][-1:]
LinReg.fit(X,y) # applying Linear Regression to the test dataset
prediction = LinReg.predict(X_test) # calling a prediction using Linear Regression model to Rubble
prediction # predicted values of $ Exchange Rate to Rubble 
y_test # actual values of $ Exchange Rates
print("NP.Linalg.Norm:", np.linalg.norm(y_test - prediction)) # calling a vector normalisation 
print("Mean Absolute Error:", mean_absolute_error(y_test, prediction)) # calling a mean absolute error in Rubble
"""Creating a function which will take the values from the dataset"""

plt.plot(prediction[0], label = "prediction") 
# prediction = "0", because the list (data massive) consisting from one element
plt.plot(y_test.iloc[0], label = "real")
# y_test is using a dateframe through "iloc" method
plt.legend()
values[-28:] # values for the last 28 days
LinReg.predict([values[-28:]]) # prediction for a week ahead (7days)<jupyter_output><empty_output><jupyter_text>Using MLP Regressor Neural Network (Multi-layer Perceptron regressor).https://scikit-learn.org/stable/modules/generated/sklearn.neural_network.MLPRegressor.html<jupyter_code>""" Using MLP Regressor (Multi-layer Perceptron regressor) from Sckit-learn to make prediction"""
from sklearn.neural_network import MLPRegressor
MLP = MLPRegressor(random_state=42, max_iter = 2000, hidden_layer_sizes=(90,130), 
                  alpha=0.0001, solver = "lbfgs")
MLP.fit(X,y)
prediction = MLP.predict(X_test) # prediction using Neural Network 
print("Results using  MLPRegressor Model")
print("NP.Linalg.Norm:", np.linalg.norm(y_test - prediction))
print("Mean Absolute Error:", mean_absolute_error(y_test, prediction))
"""Creating a function which will take the values from the dataset"""

plt.plot(prediction[0], label = "prediction") 
# prediction = "0", because the list (data massive) consisting from one element
plt.plot(y_test.iloc[0], label = "real")
# y_test is using a dateframe through "iloc" method
plt.legend()<jupyter_output><empty_output><jupyter_text>Using Lasso Linear Modelhttps://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Lasso.html<jupyter_code>from sklearn.linear_model import Lasso
# training dataset
X = data_frame[past_columns][:-1]
y = data_frame[future_columns][:-1]
# test dataset 
X_test = data_frame[past_columns][-1:]
y_test = data_frame[future_columns][-1:]
model = Lasso(random_state=42, max_iter = 5000)
model.fit(X,y)
prediction = model.predict(X_test) # calling a prediction using Lasso model to Rubble
print("Results using Lasso Model")
print("NP.Linalg.Norm:", np.linalg.norm(y_test - prediction))
print("Mean Absolute Error:", mean_absolute_error(y_test, prediction))
"""Creating a function which will take the values from the dataset"""

plt.plot(prediction[0], label = "prediction") 
# prediction = "0", because the list (data massive) consisting from one element
plt.plot(y_test.iloc[0], label = "real")
# y_test is using a dateframe through "iloc" method
plt.legend()<jupyter_output><empty_output><jupyter_text>Using KNeighborsRegressorhttps://scikit-learn.org/stable/modules/generated/sklearn.neighbors.KNeighborsRegressor.html<jupyter_code>from sklearn.neighbors import KNeighborsRegressor
# training dataset
X = data_frame[past_columns][:-1]
y = data_frame[future_columns][:-1]
# test dataset 
X_test = data_frame[past_columns][-1:]
y_test = data_frame[future_columns][-1:]
KNReg = KNeighborsRegressor(leaf_size=40, n_neighbors=7, weights='distance')
KNReg.fit(X,y)
prediction = KNReg.predict(X_test) # calling a prediction using KNeighborsRegressor model to Rubble
print("Results using KNeighborsRegressor Model")
print("NP.Linalg.Norm:", np.linalg.norm(y_test - prediction))
print("Mean Absolute Error:", mean_absolute_error(y_test, prediction))
"""Creating a function which will take the values from the dataset"""

plt.plot(prediction[0], label = "prediction") 
# prediction = "0", because the list (data massive) consisting from one element
plt.plot(y_test.iloc[0], label = "real")
# y_test is using a dateframe through "iloc" method
plt.legend()<jupyter_output><empty_output><jupyter_text>MultiTaskElasticNet Modelhttps://scikit-learn.org/stable/modules/generated/sklearn.linear_model.MultiTaskElasticNet.htmlsklearn.linear_model.MultiTaskElasticNet<jupyter_code>from sklearn.linear_model import MultiTaskElasticNet
# training dataset
X = data_frame[past_columns][:-1]
y = data_frame[future_columns][:-1]
# test dataset 
X_test = data_frame[past_columns][-1:]
y_test = data_frame[future_columns][-1:]
MTEN = MultiTaskElasticNet(random_state = 42, max_iter=2500, selection='random', tol=0.0003, l1_ratio=0.2)
MTEN.fit(X,y)
prediction = MTEN.predict(X_test) # calling a prediction using MultiTaskElasticNet model to Rubble
print("Results using MultiTaskElasticNet Model")
print("NP.Linalg.Norm:", np.linalg.norm(y_test - prediction))
print("Mean Absolute Error:", mean_absolute_error(y_test, prediction))
"""Creating a function which will take the values from the dataset"""

plt.plot(prediction[0], label = "prediction") 
# prediction = "0", because the list (data massive) consisting from one element
plt.plot(y_test.iloc[0], label = "real")
# y_test is using a dateframe through "iloc" method
plt.legend()<jupyter_output><empty_output><jupyter_text>ElasticNet Modelhttps://scikit-learn.org/stable/modules/generated/sklearn.linear_model.ElasticNet.htmlsklearn.linear_model.ElasticNet<jupyter_code>from sklearn.linear_model import ElasticNet
# training dataset
X = data_frame[past_columns][:-1]
y = data_frame[future_columns][:-1]
# test dataset 
X_test = data_frame[past_columns][-1:]
y_test = data_frame[future_columns][-1:]
EN = ElasticNet(random_state = 42, max_iter=3000, l1_ratio=0.2, selection="cyclic")
EN.fit(X,y)
prediction = EN.predict(X_test) # calling a prediction using ElasticNet model to Rubble
print("Results using ElasticNet Model")
print("NP.Linalg.Norm:", np.linalg.norm(y_test - prediction))
print("Mean Absolute Error:", mean_absolute_error(y_test, prediction))
"""Creating a function which will take the values from the dataset"""

plt.plot(prediction[0], label = "prediction") 
# prediction = "0", because the list (data massive) consisting from one element
plt.plot(y_test.iloc[0], label = "real")
# y_test is using a dateframe through "iloc" method
plt.legend()<jupyter_output><empty_output><jupyter_text>Ensemble BaggingRegressor Modelhttps://scikit-learn.org/stable/modules/generated/sklearn.ensemble.BaggingRegressor.htmlsklearn.ensemble.BaggingRegressor<jupyter_code>from sklearn.ensemble import BaggingRegressor
# training dataset
X = data_frame[past_columns][:-1]
y = data_frame[future_columns][:-1]
# test dataset 
X_test = data_frame[past_columns][-1:]
y_test = data_frame[future_columns][-1:]
BG = BaggingRegressor(random_state=42)
BG.fit(X,y)
prediction = BG.predict(X_test) # calling a prediction using Ensemble Bagging Regressor Model to Rubble
print("Results using Bagging Regressor Model")
print("NP.Linalg.Norm:", np.linalg.norm(y_test - prediction))
print("Mean Absolute Error:", mean_absolute_error(y_test, prediction))
"""Creating a function which will take the values from the dataset"""

plt.plot(prediction[0], label = "prediction") 
# prediction = "0", because the list (data massive) consisting from one element
plt.plot(y_test.iloc[0], label = "real")
# y_test is using a dateframe through "iloc" method
plt.legend()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11956930011268312, 'fraction_numerical': 0.012770752472768248, 'mean_word_length': 6.940357852882704, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 7, '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': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '606204', 'license': 'MIT', 'n_tokens_mistral': 2725, 'n_tokens_neox': 2565, 'n_words': 645, 'path': 'skillbox_ds_2.ipynb', 'repo_name': 'bormaley999/The_third_ML_project', 'size': '7987'}