<jupyter_start><jupyter_text><jupyter_code>#Describtion: This program attempts to predict the future price of Dogecoin
#Import the libraries
import numpy as np
import pandas as pd
#Load the data
from google.colab import files
files.upload()
#Store the data
df = pd.read_csv('Doge1.csv')
#Set the index to be the date 
df = df.set_index(pd.DatetimeIndex(df['Date'].values))
#Show the data
df
#Get the close price
df = df[['Close']]
#Show the data
df
#Create a variable to store the number of days into the future that we want to predict
prediction_days = 1
#Create a new column called Prediction 
df['Prediction'] = df[['Close']].shift(-prediction_days)
#Show the data
df
#Creat the independent data set (X)
X = np.array(df.drop(['Prediction'], 1))
#Remove the last n+1 rows of data where n is the prediction_days 
X = X[:len(df) -prediction_days -1]
#Print the data
print(X)
#Create a dependent data set (y)
y = np.array(df['Prediction'])
#Get all of the y values except the last n+1 rows
y = y[:-prediction_days - 1]
#Show the data
print(y)
#Split the data into training data set and a 20% testing data set
from sklearn.model_selection import train_test_split
x_train, x_test, y_train, y_test = train_test_split(X, y, test_size = 0.2)
#Use the RandomForestRegressor for the model
from sklearn.ensemble import RandomForestRegressor
forest = RandomForestRegressor(n_estimators = 2, random_state = 587)
forest.fit(x_train, y_train)
print(forest.score(x_test, y_test))
#Show how close the predicted values and the actual values are 
prediction = forest.predict(x_test)
#Print the predicted test values
print(prediction)
print()
#Print the actual values 
print(y_test)
#Get the validation data for the model 
#Create a variable to store all of the rows in the data set except the last n rows
temp_df = df[:-prediction_days]
#Create a variable to store the independent price value
x_val = temp_df.tail(1)['Close'][0]
#Show the data
print(x_val)
prediction = forest.predict([[x_val]])
#Print the price of Dogecoin for the next n days
print('The price of Dogecoin in', prediction_days, 'day(s) is predicted to be', prediction)
#Print the actual value for the next n days
print('The actual price was', temp_df.tail(1)['Prediction'][0])<jupyter_output>The price of Dogecoin in 1 day(s) is predicted to be [0.294671]
The actual price was 0.412812
{'fraction_non_alphanumeric': 0.09503424657534247, 'fraction_numerical': 0.014554794520547944, 'mean_word_length': 5.455801104972376, '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': '138631', 'license': 'MIT', 'n_tokens_mistral': 784, 'n_tokens_neox': 759, 'n_words': 309, 'path': 'Dogecoin_Price_Prediction.ipynb', 'repo_name': 'SuperGeekBrain/coal-exploration', 'size': '2336'}