Skip to content

Commit

Permalink
v3.8.6
Browse files Browse the repository at this point in the history
  • Loading branch information
dkundih committed Jul 20, 2022
1 parent 79dd3e2 commit ce1f82b
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 20 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -498,3 +498,7 @@ CHANGELOG

3.8.5 (13/06/2022)
- requirements upgrade.

3.8.6 (20/07/2022)
- MonteCarlo logic redefined.
- limits of MonteCarlo exponential increase removed.
4 changes: 1 addition & 3 deletions _testenv/FUTURE
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Upcoming features regarding duality package implementation to run the package as a CLI app.

Import of kundih package particles.

MonteCarlo x * (1 + x.std) change to x + (x * x.std).
Import of kundih package particles.
4 changes: 2 additions & 2 deletions _testenv/F_montecarlo.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


# stores menu options over functions and class methods for listing.
class Record(metaclass = Meta):
class DualityRecord(metaclass = Meta):

# initializes the object and function it is decorating.
def __init__(
Expand Down Expand Up @@ -461,7 +461,7 @@ def queue_handler(
# imports all data types.
from logistics.plugins.types import *

app = Record()
app = DualityRecord()

# object that contains the simulation data.
class MonteCarlo:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
duality >= 4.7.2
duality >= 4.8.1
logistics >= 0.0.7
colorama
pandas >= 1.2.3
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
keywords = 'data science, machine learning, data manipulation, artificial intelligence, AI, unin, duality, duality-py, duality.py, vandal, vandal-py, vandal.py',
packages = find_packages(),
install_requires = [
'duality >= 4.7.2',
'duality >= 4.8.1',
'logistics >= 0.0.7',
'colorama',
'pandas >= 1.2.3',
Expand Down
4 changes: 2 additions & 2 deletions vandal/misc/_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

]
__license__ = 'Copyright © 2021-2022 David Kundih. All rights reserved. Licensed under the Apache License, Version 2.0 | For more details about the license and terms of use visit the official vandal documentation linked at https://github.com/dkundih/vandal and https://pypi.org/project/vandal'
__version__ = '3.8.5'
__version__ = '3.8.6'
__documentation__ = 'https://github.com/dkundih/vandal | https://pypi.org/project/vandal'
__contact__ = 'dakundih@unin.hr | kundihdavid@gmail.com'
__donate__ = 'https://patreon.com/dkundih | https://buymeacoffee.com/dkundih'
__APPversion__ = 'v 1.4.3'
__APPversion__ = 'v 1.4.4'
16 changes: 5 additions & 11 deletions vandal/objects/montecarlo.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def execute(
print(Fore.GREEN + f'Monte Carlo has been set up for {self.num_sims} simulations in a period of {self.time_seq} time measurement units and executed.' + Fore.RESET)
print(Fore.RED + 'NOTE: Use data with reasonable standard deviation in order to prevent exponential growth of the function that cannot be plotted properly, recognize such abnormal values by a + sign anywhere in the data executed below.' + Fore.RESET)

from vandal.hub.toolkit import random_value
import numpy as np
import pandas as pd

# this removes pandas warning of highly fragmented DataFrame for newer pandas versions.
Expand All @@ -166,24 +166,18 @@ def execute(
loading = 0

for num_sim in range(self.num_sims):
rand_change = random_value(self.list_of_values.pct_change().mean(), self.list_of_values.pct_change().std())
rand_change = self.list_of_values.pct_change().std()
count = 0
index_array = []
index_array += [today_value * (1 + rand_change)]

if index_array[count] > (index_array[-1] * 3):
raise Exception('Variation between data is too big, due to detection of exponentional increase of values or non-sequential data Monte Carlo simulation cannot be executed properly.')
index_array += [today_value + (today_value * np.random.normal(0, rand_change))]

for num_day in range(self.time_seq):
rand_change = random_value(self.list_of_values.pct_change().mean(), self.list_of_values.pct_change().std())
rand_change = self.list_of_values.pct_change().std()
if count == self.time_seq:
break
index_array += [index_array[count] * (1 + rand_change)]
index_array += [index_array[count] + (today_value * np.random.normal(0, rand_change))]
count += 1

if index_array[count] > (index_array[-1] * 3):
raise Exception('Variation between data is too big, due to detection of exponentional increase of values or non-sequential data Monte Carlo simulation function cannot be executed properly.')

loading += 1
print(end = '\r')
print(loading, 'iterations out of', self.num_sims, 'executed so far', end = '')
Expand Down

0 comments on commit ce1f82b

Please sign in to comment.