<jupyter_start><jupyter_text>Call Expected timefraction<jupyter_code>url = 'https://165.227.232.84:8000/predict/'
lower_bound = 1.1
upper_bound = 1.3
time_horizon = 100

inp = {
    "prediction_type": "Expected_timefraction",  
    "lower_bound": lower_bound,
    "upper_bound": upper_bound,
    "time_fraction": 0.5, 
    "time_horizon": time_horizon
}

res = requests.post(url, headers = {'Content-type': 'application/json'}, json=inp)
#print(res)
print(json.loads(res.json()))<jupyter_output>{'Expected_timefraction': 0.18147494361086594}<jupyter_text>Call Best range<jupyter_code>lower_bound = 1.1
upper_bound = 1.3
time_horizon = 100

inp = {
    "prediction_type": "best_range",  
    "lower_bound": lower_bound,
    "upper_bound": upper_bound,
    "time_fraction": 0.5, 
    "time_horizon": time_horizon
}
res = requests.post(url, headers = {'Content-type': 'application/json'}, json=inp)
#print(res)
print(json.loads(res.json()))
### Call Best range for timefraction 0,5 and 0.25  and plot some visuals
from src.models.import_ethereum_timeseries import ethereum_data
from matplotlib import pylab as plt
import matplotlib
f, ax = plt.subplots(1,1,figsize=(40,20))
time, eth_value = ethereum_data()
today = time[-1]
dt = time[-1] - time[-2]

inp["time_fraction"] = 0.5
inp['time_horizon'] = 30


res = requests.post(url, headers = {'Content-type': 'application/json'}, json=inp)
lower_range50, upper_range50 = json.loads(res.json())['Best range']
inp["time_fraction"] = 0.25
res = requests.post(url, headers = {'Content-type': 'application/json'}, json=inp)
lower_range25, upper_range25 = json.loads(res.json())['Best range']


font = {'family' : 'normal',
        'weight' : 'normal',
        'size'   : 30}

matplotlib.rc('font', **font)

ax.plot(time, eth_value)
ax.plot([today, today + dt*time_horizon], [eth_value[-1], eth_value[-1]], 
        c='black', ls='--')
ax.plot([today, today + dt*time_horizon], [eth_value[-1]*lower_range50, eth_value[-1]*lower_range50], 
        c='orange', lw='3', label='50%')
ax.plot([today, today + dt*time_horizon], [eth_value[-1]*upper_range50, eth_value[-1]*upper_range50], 
        c='orange', lw='3', label='50%')

ax.plot([today, today + dt*time_horizon], [eth_value[-1]*lower_range25, eth_value[-1]*lower_range25], 
        c='green', lw='3', label='25%')
ax.plot([today, today + dt*time_horizon], [eth_value[-1]*upper_range25, eth_value[-1]*upper_range25], 
        c='green', lw='3', label='25%')
ax.legend()
ax.set_title("Time horizon " + str(dt*inp['time_horizon']) + "days",fontsize=30)
import datetime
import numpy as np
historic_point = np.argmin(abs(time - datetime.datetime(2020,12,23)))
cut_point = np.argmin(abs(time - datetime.datetime(2020,12,23)))
#metadata = {"cut_date": eth_value[cut_point]}
eth_value = eth_value[:cut_point+1]
f, ax = plt.subplots(1,1,figsize=(12,12))
time, eth_value = ethereum_data()
cut_point = np.argmin(abs(time - datetime.datetime(2020,12,23)))
#metadata = {"cut_date": eth_value[cut_point]}
eth_value = eth_value[:cut_point+1]
today = time[-1]
ax.plot(eth_value)
ax.plot()
inp = {}
inp['historic_point'] = 100
if hasattr(inp, "historic_point"):
        print(inp["historic_point"])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18071161048689138, 'fraction_numerical': 0.04931335830212235, 'mean_word_length': 5.663201663201663, 'pattern_counts': {'":': 12, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '39437', 'license': 'Apache-2.0', 'n_tokens_mistral': 1318, 'n_tokens_neox': 1207, 'n_words': 214, 'path': 'modelrequestdemo.ipynb', 'repo_name': 'unicast-project/unicast', 'size': '3204'}