ergodicity package¶
Subpackages¶
- ergodicity.agents package
- Submodules
- ergodicity.agents.agent_pool module
AgentPool
AgentPool.process
AgentPool.n
AgentPool.initial_wealth
AgentPool.base_s
AgentPool.time
AgentPool.timestep
AgentPool.simulation_timestep
AgentPool.wealth
AgentPool.history
AgentPool.coefficient_of_variation()
AgentPool.gini_coefficient()
AgentPool.mean_logarithmic_deviation()
AgentPool.palma_ratio()
AgentPool.plot()
AgentPool.plot_inequality_measures()
AgentPool.save_and_plot_wealth_distribution()
AgentPool.save_data()
AgentPool.simulate()
plot_wealth_3d()
- ergodicity.agents.agents module
Agent_utility
Agent_utility.params
Agent_utility.wealth
Agent_utility.total_accumulated_wealth
Agent_utility.compare_numerical_and_symbolic_expected_utility()
Agent_utility.evolutionary_algorithm()
Agent_utility.evolutionary_algorithm_with_exchange()
Agent_utility.evolutionary_algorithm_with_multiple_processes()
Agent_utility.expected_utility()
Agent_utility.general_utility_function()
Agent_utility.general_utility_function_np()
Agent_utility.initialize_agents()
Agent_utility.mutate_params()
Agent_utility.numerical_expected_utility()
Agent_utility.params
Agent_utility.total_accumulated_wealth
Agent_utility.visualize_utility_function_evolution()
Agent_utility.wealth
analyze_utility_function_trends()
general_utility_function()
generate_processes()
process_to_dict()
recursive_flatten()
visualize_agent_evolution()
- ergodicity.agents.evaluation module
AgentEvaluation
MaxEntIRL
MaxEntIRL.n_features
MaxEntIRL.n_actions
MaxEntIRL.learning_rate
MaxEntIRL.n_iterations
MaxEntIRL.reward_weights
MaxEntIRL.compute_expected_svf()
MaxEntIRL.compute_gradient()
MaxEntIRL.compute_policy()
MaxEntIRL.compute_state_visitation_freq()
MaxEntIRL.feature_expectations()
MaxEntIRL.fit()
MaxEntIRL.optimize_reward()
MaxEntIRL.predict_reward()
UtilityFunction
UtilityFunctionInference
UtilityFunctionInference.model
UtilityFunctionInference.agent
UtilityFunctionInference.process_encoder
UtilityFunctionInference.utility_functions
UtilityFunctionInference.param_ranges
UtilityFunctionInference.mcmc_samples
UtilityFunctionInference.regression_model
UtilityFunctionInference.regression_history
UtilityFunctionInference.add_utility_function()
UtilityFunctionInference.analyze_feature_importance()
UtilityFunctionInference.analyze_feature_interactions()
UtilityFunctionInference.bayesian_fit_utility_functions()
UtilityFunctionInference.fit_utility_functions()
UtilityFunctionInference.generate_choices()
UtilityFunctionInference.generate_dataset()
UtilityFunctionInference.get_agent_choices()
UtilityFunctionInference.get_process_type()
UtilityFunctionInference.load_model()
UtilityFunctionInference.metropolis_hastings()
UtilityFunctionInference.negative_log_likelihood()
UtilityFunctionInference.perform_irl()
UtilityFunctionInference.plot_bayesian_results()
UtilityFunctionInference.plot_parameter_distributions()
UtilityFunctionInference.plot_partial_dependence()
UtilityFunctionInference.plot_preference_heatmap()
UtilityFunctionInference.plot_regression_results()
UtilityFunctionInference.plot_utility_functions()
UtilityFunctionInference.predict_preference()
UtilityFunctionInference.print_bayesian_results()
UtilityFunctionInference.print_results()
UtilityFunctionInference.regression_fit()
UtilityFunctionTester
UtilityFunctionTester.process_class
UtilityFunctionTester.param_ranges
UtilityFunctionTester.utility_functions
UtilityFunctionTester.results
UtilityFunctionTester.analyze_results()
UtilityFunctionTester.calculate_utility()
UtilityFunctionTester.generate_process_parameters()
UtilityFunctionTester.optimize_utility_function()
UtilityFunctionTester.plot_optimal_utility_vs_process_params()
UtilityFunctionTester.run_tests()
UtilityFunctionTester.simulate_process()
UtilityFunctionTester.test_utility_functions()
evaluate_utility_functions()
utility_arctan()
utility_cobb_douglas()
utility_exp()
utility_linear_threshold()
utility_log()
utility_power()
utility_prospect_theory()
utility_quadratic()
utility_sigmoid()
- ergodicity.agents.evolutionary_nn module
DynamicBatchNorm1d
EvolutionaryNeuralNetworkTrainer
EvolutionaryNeuralNetworkTrainer.population_size
EvolutionaryNeuralNetworkTrainer.input_size
EvolutionaryNeuralNetworkTrainer.hidden_sizes
EvolutionaryNeuralNetworkTrainer.output_size
EvolutionaryNeuralNetworkTrainer.processes
EvolutionaryNeuralNetworkTrainer.process_encoder
EvolutionaryNeuralNetworkTrainer.process_times
EvolutionaryNeuralNetworkTrainer.mutation_rate
EvolutionaryNeuralNetworkTrainer.mutation_scale
EvolutionaryNeuralNetworkTrainer.with_exchange
EvolutionaryNeuralNetworkTrainer.top_k
EvolutionaryNeuralNetworkTrainer.exchange_interval
EvolutionaryNeuralNetworkTrainer.initial_wealth
EvolutionaryNeuralNetworkTrainer.keep_top_n
EvolutionaryNeuralNetworkTrainer.removal_interval
EvolutionaryNeuralNetworkTrainer.process_selection_share
EvolutionaryNeuralNetworkTrainer.output_dir
EvolutionaryNeuralNetworkTrainer.initialize_population()
EvolutionaryNeuralNetworkTrainer.load_best_weights()
EvolutionaryNeuralNetworkTrainer.log()
EvolutionaryNeuralNetworkTrainer.reproduce_with_exchange()
EvolutionaryNeuralNetworkTrainer.reproduce_without_exchange()
EvolutionaryNeuralNetworkTrainer.save_best_weights()
EvolutionaryNeuralNetworkTrainer.save_performance_metrics()
EvolutionaryNeuralNetworkTrainer.select_top_agents()
EvolutionaryNeuralNetworkTrainer.train()
EvolutionaryNeuralNetworkTrainer.visualize_neural_network_evolution()
EvolutionaryNeuralNetworkTrainer.visualize_performance()
NeuralNetwork
NeuralNetwork.input_size
NeuralNetwork.hidden_sizes
NeuralNetwork.output_size
NeuralNetwork.dropout_rate
NeuralNetwork.batch_norm
NeuralNetwork.weight_init
NeuralNetwork.learning_rate
NeuralNetwork.optimizer_name
NeuralNetwork.model
NeuralNetwork.optimizer
NeuralNetwork.clone()
NeuralNetwork.forward()
NeuralNetwork.get_num_parameters()
NeuralNetwork.load()
NeuralNetwork.mutate()
NeuralNetwork.save()
NeuralNetworkAgent
NeuralNetworkAgent.network
NeuralNetworkAgent.wealth
NeuralNetworkAgent.accumulated_wealth
NeuralNetworkAgent.fitness
NeuralNetworkAgent.calculate_fitness()
NeuralNetworkAgent.clone()
NeuralNetworkAgent.load()
NeuralNetworkAgent.mutate()
NeuralNetworkAgent.reset_wealth()
NeuralNetworkAgent.save()
NeuralNetworkAgent.select_process()
NeuralNetworkAgent.update_wealth()
ReinforcementEvolutionaryTrainer
ReinforcementEvolutionaryTrainer.population_size
ReinforcementEvolutionaryTrainer.input_size
ReinforcementEvolutionaryTrainer.hidden_sizes
ReinforcementEvolutionaryTrainer.output_size
ReinforcementEvolutionaryTrainer.processes
ReinforcementEvolutionaryTrainer.process_encoder
ReinforcementEvolutionaryTrainer.process_times
ReinforcementEvolutionaryTrainer.learning_rate
ReinforcementEvolutionaryTrainer.mutation_rate
ReinforcementEvolutionaryTrainer.mutation_scale
ReinforcementEvolutionaryTrainer.rl_interval
ReinforcementEvolutionaryTrainer.elite_percentage
ReinforcementEvolutionaryTrainer.calculate_reward()
ReinforcementEvolutionaryTrainer.crossover()
ReinforcementEvolutionaryTrainer.initialize_population()
ReinforcementEvolutionaryTrainer.log()
ReinforcementEvolutionaryTrainer.mutate()
ReinforcementEvolutionaryTrainer.reinforce()
ReinforcementEvolutionaryTrainer.save_best_weights()
ReinforcementEvolutionaryTrainer.save_performance_metrics()
ReinforcementEvolutionaryTrainer.select_elite()
ReinforcementEvolutionaryTrainer.select_process()
ReinforcementEvolutionaryTrainer.simulate_process()
ReinforcementEvolutionaryTrainer.train()
ReinforcementEvolutionaryTrainer.visualize_neural_network_evolution()
ReinforcementEvolutionaryTrainer.visualize_performance()
- ergodicity.agents.portfolio module
- ergodicity.agents.probability_weighting module
- ergodicity.agents.sml module
- Module contents
- ergodicity.developer_tools package
- ergodicity.process package
- Submodules
- ergodicity.process.basic module
BrownianMotion
CauchyProcess
EmptyProcess
FractionalBrownianMotion
GammaProcess
GeneralizedHyperbolicProcess
GeneralizedHyperbolicProcess.a
GeneralizedHyperbolicProcess.alpha
GeneralizedHyperbolicProcess.apply_time_scaling()
GeneralizedHyperbolicProcess.b
GeneralizedHyperbolicProcess.beta
GeneralizedHyperbolicProcess.custom_increment()
GeneralizedHyperbolicProcess.delta
GeneralizedHyperbolicProcess.differential()
GeneralizedHyperbolicProcess.express_as_elementary()
GeneralizedHyperbolicProcess.loc
GeneralizedHyperbolicProcess.plambda
GeneralizedHyperbolicProcess.scale
GeneralizedHyperbolicProcess.t_scaling
InverseGaussianProcess
LevyStableProcess
LevyStableProcess.alpha
LevyStableProcess.beta
LevyStableProcess.characteristic_function()
LevyStableProcess.custom_increment()
LevyStableProcess.differential()
LevyStableProcess.express_as_elementary()
LevyStableProcess.loc
LevyStableProcess.scale
LevyStableProcess.scaled_scale
LevyStableProcess.tempered
LevyStableProcess.tempered_stable_rvs()
LevyStableProcess.tempering
LevyStableProcess.truncate()
LevyStableProcess.truncated
LevyStableProcess.truncation_level
LevyStableProcess.truncation_type
LevyStableStandardProcess
MultivariateBrownianMotion
MultivariateBrownianMotion.custom_increment()
MultivariateBrownianMotion.simulate()
MultivariateBrownianMotion.simulate_2d()
MultivariateBrownianMotion.simulate_3d()
MultivariateBrownianMotion.simulate_live()
MultivariateBrownianMotion.simulate_live_2d()
MultivariateBrownianMotion.simulate_live_2dt()
MultivariateBrownianMotion.simulate_live_3d()
MultivariateBrownianMotion.simulate_weights()
MultivariateLevy
MultivariateLevy.custom_increment()
MultivariateLevy.loc
MultivariateLevy.plot()
MultivariateLevy.plot_2d()
MultivariateLevy.plot_2dt()
MultivariateLevy.plot_3d()
MultivariateLevy.pseudocorrelation_matrix
MultivariateLevy.pseudovariances
MultivariateLevy.simulate()
MultivariateLevy.simulate_2d()
MultivariateLevy.simulate_3d()
MultivariateLevy.simulate_live()
MultivariateLevy.simulate_live_2d()
MultivariateLevy.simulate_live_2dt()
MultivariateLevy.simulate_live_3d()
ParetoProcess
PoissonProcess
SquaredBesselProcess
StandardBesselProcess
StandardBrownianBridge
StandardBrownianExcursion
StandardBrownianMeander
StandardFractionalBrownianMotion
StandardMultifractionalBrownianMotion
VarianceGammaProcess
WienerProcess
- ergodicity.process.constructor module
- ergodicity.process.custom_classes module
- ergodicity.process.default_values module
- ergodicity.process.definitions module
CustomProcess
ItoProcess
NonItoProcess
Process
Process.name
Process.multiplicative
Process.independent
Process.ito
Process.process_class
Process.types
Process.comments
Process.has_wrong_params
Process.custom
Process.simulate_with_differential
Process.output_dir
Process.increment_process
Process.memory
Process.add_type()
Process.always_present_keys
Process.closed_formula()
Process.comments
Process.correct_params()
Process.custom
Process.custom_increment()
Process.custom_simulate_raw()
Process.data_for_simulation()
Process.differential()
Process.empirical_properties()
Process.ensemble_average()
Process.eternal_simulator()
Process.get_comments()
Process.get_data_for_moments()
Process.get_params()
Process.growth_rate_ensemble_average()
Process.growth_rate_time_average()
Process.has_wrong_params
Process.increment()
Process.increment_intermediate()
Process.independent
Process.ito
Process.k_moments()
Process.memory_update()
Process.moments()
Process.moments_dict()
Process.multiplicative
Process.name
Process.output_dir
Process.p_measure()
Process.pdf_evolution()
Process.plot()
Process.plot_2d()
Process.plot_2dt()
Process.plot_3d()
Process.plot_growth_rate_of_average_3d()
Process.plot_moment()
Process.plot_weights()
Process.process_class
Process.relative_variance_pea()
Process.save_to_file()
Process.self_averaging_time()
Process.separate()
Process.simulate()
Process.simulate_2d()
Process.simulate_3d()
Process.simulate_distribution()
Process.simulate_ensembles()
Process.simulate_live()
Process.simulate_live_2d()
Process.simulate_live_2dt()
Process.simulate_live_3d()
Process.simulate_until()
Process.simulate_weights()
Process.simulate_with_differential
Process.time_average()
Process.time_average_expression()
Process.types
Process.visualize_moment()
Process.visualize_moments()
check_simulate_with_differential()
correlation_to_covariance()
create_correlation_matrix()
simulation_decorator()
- ergodicity.process.discrete module
- ergodicity.process.increments module
- ergodicity.process.lib module
CauchyOrnsteinUlehnbeckSimulation()
ConstantElasticityOfVarianceSimulation()
CoxIngersollRossSimulation()
DoubleExponentialJumpDiffusionSimulation()
FractionalBrownianMotionSimulation()
GeneralizedDiffusionSimulation()
GeometricBrownianMotionSimulation()
GeometricFractionalBrownianMotionSimulation()
GeometricOrnsteinUhlenbeckSimulation()
HestonSimulation()
HullWhiteSimulation()
JumpDiffusionSimulation()
KouJumpDiffusionSimulation()
Levy05OrnsteinUlehnbeckSimulation()
Levy15OrnsteinUlehnbeckSimulation()
LevyStableOrnsteinUlehnbeckSimulation()
LotkaVolterraSimulation()
MeanRevertingSquareRootDiffusionSimulation()
MertonJumpDiffusionSimulation()
OrnsteinUhlenbeckSimulation()
StochasticAlphaBetaRhoSimulation()
StochasticVolatilityModelSimulation()
SubordinatorSimulation()
TestSystemSimulation()
VarianceGammaSimulation()
VasicekSimulation()
custom_simulate()
custom_simulate_system()
- ergodicity.process.multiplicative module
GeometricBesselProcess
GeometricBrownianMotion
GeometricCauchyProcess
GeometricFractionalBrownianMotion
GeometricGeneralizedHyperbolicProcess
GeometricLevyProcess
GeometricSquaredBesselProcess
MultivariateGeometricBrownianMotion
MultivariateGeometricBrownianMotion.calculate_expected_log_growth_rate()
MultivariateGeometricBrownianMotion.custom_increment()
MultivariateGeometricBrownianMotion.plot_weights_and_growth_rate()
MultivariateGeometricBrownianMotion.simulate_ensemble()
MultivariateGeometricBrownianMotion.simulate_growth_rate()
MultivariateGeometricBrownianMotion.simulate_weights()
MultivariateGeometricLevy
comments_false()
comments_true()
estimate_sigma()
implied_levy_correction()
- ergodicity.process.with_memory module
BrownianMotionWithMeanMemory
GeometricBrownianMotionWithVolatilityMemory
LevyStableProcessWithAdaptiveSkewness
LevyStableProcessWithMemory
MultivariateGBMWithAdaptiveCorrelation
MultivariateGBMWithAdaptiveDrift
MultivariateGeometricLevyWithAdaptiveAlpha
MultivariateGeometricLevyWithAdaptiveBeta
MultivariateGeometricLevyWithAdaptiveCorrelation
MultivariateGeometricLevyWithAdaptiveScale
OrnsteinUhlenbeckWithAdaptiveRate
- Module contents
- ergodicity.tools package
- Submodules
- ergodicity.tools.automate module
- ergodicity.tools.compute module
average()
average_growth_rate()
average_growth_rate_vs_gbm()
compare_averages()
compare_distributions()
create_A_from_correlation_and_variances()
create_multivariate_gaussian_process()
demonstrate_alpha_stable_self_similarity()
generate_levy_process()
growth_rate_of_average()
growth_rate_of_average_per_time()
growth_rates()
mu_sigma()
random_variable_from_pdf()
relative_increments()
simulate_independent_gaussian_processes()
solve_fokker_planck_numerically()
validate_input_shape()
visualize_function()
- ergodicity.tools.evaluate module
- ergodicity.tools.fit module
- ergodicity.tools.helper module
ProcessEncoder
ProcessEncoder.process_types
ProcessEncoder.reverse_mapping
ProcessEncoder.next_id
ProcessEncoder.decode()
ProcessEncoder.encode()
ProcessEncoder.encode_process()
ProcessEncoder.encode_process_with_time()
ProcessEncoder.get_decoding()
ProcessEncoder.get_encoding()
ProcessEncoder.pad_encoded_process()
covariance_to_correlation()
plot()
plot_simulate_ensemble()
plot_system()
save_to_file()
separate()
- ergodicity.tools.multiprocessing module
Parallel
ParallelExecutionManager
create_task_key()
ensemble_vs_time_average_pipeline()
general_pipeline()
get_object_name()
growth_rate_of_average_pipeline()
growth_rate_wrapper()
initial_tasks_wrapper()
multi_growth_rate_ensemble_average()
multi_growth_rate_processor()
multi_growth_rate_time_average()
multi_simulations()
multi_visualize_moment()
multi_visualize_moments()
parallel()
parallel_example()
parallel_processor()
secondary_tasks_wrapper()
simulate_and_calculate_growth_rate()
task_wrapper()
visualize_growth_rates()
- ergodicity.tools.partial_sde module
PSDESimulator
PSDESimulator.drift
PSDESimulator.diffusion
PSDESimulator.initial_condition
PSDESimulator.x_range
PSDESimulator.t_range
PSDESimulator.nx
PSDESimulator.nt
PSDESimulator.boundary_type
PSDESimulator.boundary_func
PSDESimulator.x
PSDESimulator.t
PSDESimulator.dx
PSDESimulator.dt
PSDESimulator.u
PSDESimulator.apply_boundary_condition()
PSDESimulator.create_animation()
PSDESimulator.plot_3d()
PSDESimulator.plot_results()
PSDESimulator.simulate()
wiener_increment_function()
- ergodicity.tools.preasymptotics module
PreasymptoticBehaviorQuantification
PreasymptoticBehaviorQuantification.time_series
PreasymptoticBehaviorQuantification.time_values
PreasymptoticBehaviorQuantification.convergence_rate_estimation()
PreasymptoticBehaviorQuantification.plot_results()
PreasymptoticBehaviorQuantification.time_to_stationarity_estimation()
PreasymptoticBehaviorQuantification.transient_fluctuation_analysis()
PreasymptoticVisualizationTools
PreasymptoticVisualizationTools.time_series
PreasymptoticVisualizationTools.time_values
PreasymptoticVisualizationTools.plot_3d_multiscale_analysis()
PreasymptoticVisualizationTools.plot_distribution_evolution()
PreasymptoticVisualizationTools.plot_scaling_analysis()
PreasymptoticVisualizationTools.plot_time_dependent_heatmap()
PreasymptoticVisualizationTools.plot_time_series_windows()
ReportingAndExport
StatisticalTestingValidation
- ergodicity.tools.research module
AverageRateVsRateAveragePipeline_case()
FractionalGBMPipeline_case()
GBMPipeline_case()
GeometricLevyPipeline_case()
LevyMicro_case()
LevyPipeline_case()
TINstancesPipelineTest_case()
TINstancesPipeline_case()
TestingGeometricLevyPipeline_case()
live_3d_Brownian_pipeline_case()
live_3d_Levy_pipeline_case()
live_3d_geometricLevy_pipeline_case()
live_3d_meta_pipeline_case()
- ergodicity.tools.solve module
apply_girsanov()
asymptotic_approximation()
calculate_moment()
calculate_time_average_dynamics()
check_novikov_condition()
compare_averages()
compare_growth()
dynamic_from_utility()
ensemble_average()
ergodicity_transform()
ergodicity_transform_differential()
extract_ito_terms()
find_dx()
find_inverse()
find_substitution()
functions_convergence_rate()
integrate_with_substitution()
integration_check()
ito_differential()
ito_integrate()
mad_convergence_rate_alpha_stable()
mean_convergence_rate_alpha_stable()
replace_integration_constants()
solve()
time_average()
time_average_limit()
- Module contents
Submodules¶
ergodicity.cases module¶
cases Module Overview
The `cases` module showcases a selection of illustrative and practical examples that demonstrate how the library can be used in a variety of contexts. These examples highlight the key functionalities of the library and serve as a guide for users to explore different features in action. Whether you are a beginner seeking to understand the basic processes or an advanced user exploring complex models, this module provides valuable insights through real-world applications.
Key Purposes of this Module:
Demonstrate Library Capabilities:
The cases are designed to show the power and flexibility of the library by showcasing its application in different domains, such as stochastic processes, evolutionary neural networks, and utility function fitting.
Educational and Illustrative:
Each case walks through a specific feature or combination of features, offering a hands-on way to learn how the library can be applied to real-world problems.
Complete, Ready-to-Run Examples:
All cases are self-contained, meaning you can execute them as they are to explore various processes, agents, and tools provided by the library.
Broad Spectrum of Examples:
The examples cover simple simulations, advanced stochastic modeling, neural networks, agent-based modeling, utility function fitting, and more. These cases provide a broad perspective on how the library can be leveraged in different scenarios.
Structure of the Module:
`IntroCase`:
A basic introduction to using the library with the GeometricBrownianMotion process. The case involves simulating data, visualizing moments, and comparing averages.
`UtilityFitting_case`:
Demonstrates utility function fitting by showcasing how multiple utility functions can be fitted using agent choices and different stochastic processes.
`EvolutionaryNN_case`:
Explores the use of evolutionary neural networks with agents making decisions based on encoded processes. The case covers process generation, neural network mutation, cloning, and evolutionary training of agents.
`StochasticHeatEquation_case`:
Simulates a stochastic partial differential equation (PDE), specifically the stochastic heat equation, showcasing advanced simulation techniques and visualizations like 3D plotting and animations.
`BasicUtilityAgent_case`:
Illustrates the use of basic utility agents interacting with GeometricBrownianMotion, comparing symbolic and numerical expected utilities, and running evolutionary algorithms to optimize agent behavior.
`TimeAverageDynamicsGBM_case`:
Focuses on time-average dynamics in a Geometric Brownian Motion process and demonstrates the ergodicity transformation.
`GeometricLevyProcess_case`:
Simulates and visualizes the Geometric Levy Process, showcasing how ensemble and time averages can be computed and compared.
`VariousSimulations_case`:
A collection of simulations involving various stochastic processes such as the Bessel process, Brownian bridge, Cauchy process, and more, illustrating the library’s capabilities across multiple process types.
`MultivariateGeometricBrownianMotion_case`:
Demonstrates how to simulate and visualize multivariate Geometric Brownian Motion with a specified correlation matrix.
`GeometricBrownianMotion_case`:
Uses parallel execution to simulate the Geometric Brownian Motion process efficiently across multiple settings.
`ItoLemmaApplication`:
Applies Ito’s Lemma to a given stochastic differential equation (SDE), providing insight into how symbolic manipulation can be used for process analysis.
Use Cases:
Educational Use: The module provides learning materials for users who are new to stochastic processes, agent-based modeling, or neural networks.
Advanced Experimentation: For experienced users, the cases demonstrate advanced features such as process encoding, utility fitting, evolutionary strategies, and stochastic PDEs.
Library Exploration: Users can explore different parts of the library by running these cases and understanding how each component functions in practice.
## Important Notes:
Illustrative Nature: While these cases serve as valuable educational tools, they also illustrate how the library can be applied to complex scenarios in a meaningful way.
Self-Contained: Each case is self-contained and can be run independently to experiment with specific functionalities of the library.
Comprehensive Coverage: The examples in this module cover a wide range of topics, from basic stochastic processes to advanced neural networks, making it a versatile resource for learning.
- ergodicity.cases.BasicUtilityAgent_case()[source]¶
This case demonstrates the use of basic utility agents interacting with GeometricBrownianMotion processes.
- Returns:
final_agents: The final agents after the evolutionary training.
- Return type:
list
- ergodicity.cases.EvolutionaryNN_case()[source]¶
This case demonstrates the use of evolutionary neural networks for agent-based modeling with encoded processes. It covers process generation, neural network mutation, cloning, and evolutionary training of agents. The goal is to optimize agent behavior based on encoded processes and fitness evaluation.
- Returns:
final_agents: The final agents after the evolutionary training.
- Return type:
list
- ergodicity.cases.GBM_Properties_case()[source]¶
This case demonstrates how to access and modify properties of the GeometricBrownianMotion process.
- Returns:
None
- ergodicity.cases.GeometricBrownianMotion_case()[source]¶
This case uses parallel execution to simulate the Geometric Brownian Motion process efficiently across multiple settings. Geometric Brownian Motion is a fundamental process in stochastic calculus and financial mathematics.
- Returns:
results: The results of the parallel execution.
- Return type:
list
- ergodicity.cases.GeometricLevyProcess_case()[source]¶
This case simulates and visualizes the Geometric Levy Process, showcasing how ensemble and time averages can be computed and compared. It is a very general and frequently used process in many areas and the library puts a strong emphasis on it.
- return:
None
- ergodicity.cases.IntroCase()[source]¶
This is an introductory case that demonstrates the basic usage of the library with the GeometricBrownianMotion process.
- Returns:
simulated_data: The simulated data from the GeometricBrownianMotion process.
- Return type:
np.ndarray
- ergodicity.cases.ItoLemmaApplication()[source]¶
This case applies Ito’s Lemma to a given stochastic differential equation (SDE), providing insight into how symbolic manipulation can be used for process analysis.
- Returns:
result: The result of applying Ito’s Lemma to the given SDE.
- Return type:
sympy.Expr
- ergodicity.cases.MultivariateGeometricBrownianMotion_case()[source]¶
This case demonstrates how to simulate and visualize multivariate Geometric Brownian Motion with a specified correlation matrix.
- Returns:
None
- ergodicity.cases.StochasticHeatEquation_case()[source]¶
This case demonstrates the simulation of a stochastic partial differential equation (PDE), specifically the stochastic heat equation.
- Returns:
None
- ergodicity.cases.TimeAverageDynamicsGBM_case()[source]¶
This case focuses on time-average dynamics in a Geometric Brownian Motion process and demonstrates the ergodicity transformation.
- Returns:
None
ergodicity.conf module¶
ergodicity.configurations module¶
This file contains the main adjustable configurations for the Ergodicity Library. These are the most important global variables that can be changed by the user. The user can change the values of these variables to customize the behavior of the package. Initially, the parameters are set to enable explanatory command line outputs and conduct analysis pipelines with parameters optimized for Levy processes and computational power of a personal computer.
ergodicity.custom_warnings module¶
Custom Warnings Module Overview
The `custom_warnings` module defines a set of custom warning classes that are specifically tailored for the development and use of the library. These warnings are meant to inform users and developers about the status, reliability, and recommended usage of certain features or parameters within the library.
Purpose:
This module is primarily used to alert users when they are interacting with:
Features that are still under development.
Functions or parameters that require careful attention.
Code that has not been thoroughly tested or validated.
By providing specific, tailored warnings, the module enhances the transparency and robustness of the library, ensuring that users are aware of potential issues or limitations when using experimental or edge-case features.
Key Warnings Defined:
InDevelopmentWarning:
Purpose: Indicates that a feature is still in development and may not work as intended.
Usage: Used to alert users when they are interacting with a feature that is under active development and may have limited functionality or unexpected behavior.
Message: “This feature is still in development and may not function as intended. Please use with caution.”
KnowWhatYouDoWarning:
Purpose: Warns users that they must understand what they are doing, as the function may not raise an error but could behave unexpectedly with invalid inputs.
Usage: Useful in cases where the function’s behavior depends heavily on correct inputs, and failure to provide valid input could lead to silent failures.
Message: “Make sure you know what you are doing. This function may not work properly if you do not provide a valid input but will not raise an error.”
NotTestedWarning:
Purpose: Indicates that a feature has not been thoroughly tested and may have unverified behavior.
Usage: Warns users that they are using a feature that could behave unpredictably due to a lack of testing or validation.
Message: “This feature has not been tested and may not function as intended. Please use with caution.”
NotRecommendedWarning:
Purpose: Alerts users that a specific feature or set of parameters is not recommended for use.
Usage: Applied when certain configurations or uses of the library are discouraged, even though they might technically work, to prevent misuse or suboptimal performance.
Message: “This feature or set of parameters is not recommended for use. Please use with caution.”
When to Use These Warnings:
These custom warnings should be invoked when:
Users are interacting with experimental features.
Developers are working on a function that hasn’t yet been validated or widely tested.
A certain set of inputs or parameters might lead to suboptimal or incorrect behavior without explicitly raising an error.
By using these warnings, both developers and users are encouraged to carefully consider the use of certain features, promoting a more stable and reliable interaction with the library.
Module contents¶
Ergodicity Library: A Python toolkit for stochastic processes and ergodicity economics.
The Ergodicity Library is a comprehensive Python package designed for analyzing stochastic processes, with a particular focus on ergodicity economics. It provides tools for:
Simulating and visualizing various stochastic processes, including Brownian motion, Lévy processes, and custom processes. It is focused on:
Analyzing time averages and ensemble averages of stochastic processes.
Implementing ergodic transformations and other key concepts from ergodicity economics.
Fitting stochastic models to empirical data and estimating process parameters.
Creating and training artificial agents for decision-making under uncertainty.
Performing multi-core computations for efficient large-scale simulations.
Key features:
Object-oriented design with a flexible class hierarchy for stochastic processes
Integration with popular scientific Python libraries (NumPy, SciPy, SymPy, Matplotlib)
Symbolic computation capabilities for stochastic calculus
Tools for analyzing non-ergodic and heavy-tailed processes
Support for both Itô and non-Itô processes
Customizable configurations and default parameters
The library is suitable for researchers, students, and practitioners in fields such as economics, finance, physics, and applied mathematics. It aims to bridge the gap between theoretical concepts in ergodicity economics and practical computational tools. For more information, visit: www.ergodicitylibrary.com Version: 0.3.0