Davout 0.1.1.dev169__tar.gz → 0.1.1.dev171__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {davout-0.1.1.dev169/source/Davout.egg-info → davout-0.1.1.dev171}/PKG-INFO +1 -1
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/pyproject.toml +1 -1
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/aa_tests/mecsol_2026_quotient_space/neural_network_trainer.py +17 -7
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/tool_box/loss_assembler_classes.py +160 -2
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/tool_box/training_tools.py +161 -14
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/PythonicUtilities/function_tools.py +3 -2
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/PythonicUtilities/programming_tools.py +91 -7
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/PythonicUtilities/user_interaction_tools.py +6 -7
- {davout-0.1.1.dev169 → davout-0.1.1.dev171/source/Davout.egg-info}/PKG-INFO +1 -1
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/LICENSE +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/README.md +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/setup.cfg +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/setup.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/aa_tests/RVEs/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/aa_tests/RVEs/non_transfinite/RVE_artery.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/aa_tests/RVEs/non_transfinite/RVE_matrix_with_fiber.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/aa_tests/RVEs/non_transfinite/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/aa_tests/RVEs/non_transfinite/elastin_fiber_creator.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/aa_tests/RVEs/transfinite/RVE_artery_transfinite.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/aa_tests/RVEs/transfinite/RVE_matrix_with_fiber_transfinite.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/aa_tests/RVEs/transfinite/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/aa_tests/RVEs/transfinite/elastin_fiber_creator.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/aa_tests/RVEs/transfinite/spherical_RVE.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/aa_tests/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/aa_tests/artery/artery_macroscale.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/aa_tests/artery/artery_macroscale_ellipsoid.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/aa_tests/micropolar_meshes/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/aa_tests/micropolar_meshes/beam_micropolar_case_1.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/aa_tests/periodic_meshes/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/aa_tests/periodic_meshes/artery_parameters.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/aa_tests/periodic_meshes/fiber_matrix_parameters.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/aa_tests/periodic_meshes/periodic_structure.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/aa_tests/solids/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/aa_tests/solids/intervertebral_disc.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/aa_tests/solids/whole_ensemble_of_geometries.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/solids/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/solids/cuboid_cylinders.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/solids/cuboid_ellipsoids.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/solids/cuboid_generator.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/solids/cuboid_helicoids.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/solids/cuboid_prisms.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/tool_box/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/tool_box/geometric_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/tool_box/mesh_data_retriever.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/tool_box/meshing_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/tool_box/region_finder.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/CuboidGmsh/tool_box/verification_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/PINNs/Physics/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/PINNs/Physics/elasticity_equation.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/PINNs/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/aa_tests/SVD_framework/box_with_imposed_displacement_gradient.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/aa_tests/SVD_framework/box_with_young_modulus_field.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/aa_tests/SVD_framework/dataset_generator.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/aa_tests/SVD_framework/input_data_filler.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/aa_tests/SVD_framework/kinematics_surrogate_model.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/aa_tests/SVD_framework/young_modulus_field_generator.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/aa_tests/heat_equation.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/aa_tests/mecsol_2026_quotient_space/box_with_imposed_displacement_gradient.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/aa_tests/mecsol_2026_quotient_space/box_with_young_modulus_field.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/aa_tests/mecsol_2026_quotient_space/dataset_generator.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/aa_tests/mecsol_2026_quotient_space/input_data_filler.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/aa_tests/mecsol_2026_quotient_space/young_modulus_field_generator.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/aa_tests/tests_tool_box/test_ANN_optimization.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/aa_tests/tests_tool_box/test_ANN_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/aa_tests/tests_tool_box/test_SVD_based_NNs.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/aa_tests/tests_tool_box/test_SVD_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/aa_tests/tests_tool_box/test_convex_and_partially_convex_input_NNs.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/aa_tests/tests_tool_box/test_math_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/aa_tests/tests_tool_box/test_quotient_space_NNs.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/aa_tests/tests_tool_box/test_tensor_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/custom_architectures/SVD_quotient_space.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/custom_architectures/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/custom_architectures/convexity_concerned_NNs.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/custom_architectures/gated_quotient_space.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/custom_architectures/generic_feed_forward.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/tool_box/ANN_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/tool_box/SVD_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/tool_box/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/tool_box/activation_function_utilities.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/tool_box/custom_activation_functions.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/tool_box/differentiation_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/tool_box/loss_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/tool_box/math_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/tool_box/numerical_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/tool_box/parameters_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/tool_box/tensor_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/aa_tests/REPL_experiments.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/aa_tests/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/aa_tests/optimization/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/aa_tests/optimization/tests_optimization_methods.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/aa_tests/tests_batching.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/aa_tests/tests_finite_elements.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/aa_tests/tests_loss_function.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/aa_tests/tests_physics.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/aa_tests/unidimensional/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/aa_tests/unidimensional/bar_fea.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/aa_tests/unidimensional/hyperelastic_1D_energies.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/aa_tests/unidimensional/variational_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/assembly/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/assembly/body_forces_work.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/assembly/dirichlet_boundary_conditions_enforcer.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/assembly/hyperelastic_internal_work.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/assembly/surface_forces_work.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/constitutive_models/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/constitutive_models/hyperelastic_isotropic_models.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/finite_elements/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/finite_elements/elements_manager.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/finite_elements/finite_element_dispatcher.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/finite_elements/surface_elements/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/finite_elements/surface_elements/triangles.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/finite_elements/volume_elements/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/finite_elements/volume_elements/tetrahedrons.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/optimization/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/optimization/conditioning_matrices.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/optimization/loss_functions.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/optimization/neural_network_assembler.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/optimization/objective_function.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/physics/compressible_cauchy_hyperelasticy.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/tool_box/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/tool_box/constitutive_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/tool_box/dirichlet_loading_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/tool_box/math_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/tool_box/mesh_info_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/tool_box/mesh_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/tool_box/neumann_loading_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/tool_box/node_ordering.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/tool_box/optimization_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/tool_box/parametric_curves_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/tool_box/sensitivity_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/FENN/tool_box/tensorflow_utilities.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/GraphUtilities/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/GraphUtilities/aa_tests/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/GraphUtilities/aa_tests/cauchy_tetrahedron.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/GraphUtilities/aa_tests/continuum_mechanics_potato_collage.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/GraphUtilities/aa_tests/fake_book_spines.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/GraphUtilities/aa_tests/null_space_architecture.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/GraphUtilities/aa_tests/strain_tensors.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/GraphUtilities/aa_tests/tests_collage_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/GraphUtilities/aa_tests/tests_delaunay.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/GraphUtilities/aa_tests/tests_paraview_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/GraphUtilities/aa_tests/tests_plotting_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/GraphUtilities/collage_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/GraphUtilities/paraview_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/GraphUtilities/plotting_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/GraphUtilities/tool_box/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/GraphUtilities/tool_box/arrows_lines_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/GraphUtilities/tool_box/box_and_markers_classes.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/GraphUtilities/tool_box/box_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/GraphUtilities/tool_box/collage_classes.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/GraphUtilities/tool_box/curves_setter.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/GraphUtilities/tool_box/image_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/GraphUtilities/tool_box/interactivity_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/GraphUtilities/tool_box/paraview_scripts.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/GraphUtilities/tool_box/perspective_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/GraphUtilities/tool_box/text_excerpt_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/LaTeXUtilities/LaTeXUtilities.sty +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/LaTeXUtilities/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/LaTeXUtilities/aa_tests/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/LaTeXUtilities/aa_tests/latex_parser_tests.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/LaTeXUtilities/latex_parser.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/LaTeXUtilities/tool_box/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/LaTeXUtilities/tool_box/command_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/LaTeXUtilities/tool_box/parsing_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/LaTeXUtilities/tool_box/sty_file_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/heat_transfer/heat_box.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/hyperelasticity/beam_with_fibers.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/hyperelasticity/box_with_young_modulus_field.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/hyperelasticity/disc_HGO.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/hyperelasticity/disc_neo_hookean.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/hyperelasticity/disc_neo_hookean_incompressible.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/hyperelasticity/hyperelastic_box.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/hyperelasticity/incompressible_hyperelastic_box.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/hyperelasticity/intervertebral_disc/cylindrical_coordinates_material_property.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/hyperelasticity/intervertebral_disc/disc_HGO.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/hyperelasticity/intervertebral_disc/local_coordinate_system_generation.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/hyperelasticity/parallel_hyperelastic_box.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/hyperelasticity/parallel_incompressible_box.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/hyperelasticity/read_dofs_in_volume.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/hyperelasticity/young_modulus_field.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/micropolar/bending_case/beam_with_fibers_macroscale.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/micropolar/bending_case/beam_with_fibers_microscale.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/micropolar/deformation_laboratory/microscale_deformation_lab.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/micropolar/disc_micropolar_neo_hookean.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/micropolar/old_tests/Bauer_et_al/beam.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/micropolar/old_tests/Bauer_et_al/beam_neo_hookean.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/micropolar/old_tests/Bauer_et_al/beam_neo_hookean_pure_dolfin.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/micropolar/old_tests/Bauer_et_al/beam_neo_hookean_pure_dolfin_old.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/micropolar/old_tests/Suh_et_al/suh_implementation.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/micropolar/old_tests/micropolar_with_homogenization.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/micropolar/old_tests/micropolar_with_homogenization_original.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/micropolar/old_tests/tools_homogenization.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/micropolar/old_tests/tools_io.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/micropolar/stress_plots.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/micropolar/tangent_operators/numerical_differentiation.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/micropolar/tangent_operators/numerical_differentiation_second_elasticity_tensor.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/micropolar/tangent_operators/tangent_operator_plotter.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/micropolar/torsion_case/beam_with_fibers_macroscale.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/micropolar/torsion_case/beam_with_fibers_microscale.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/micropolar/traction_case/beam_with_fibers_macroscale.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/micropolar/traction_case/beam_with_fibers_microscale.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/minimal_working_examples_forum/curve_fitting.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/minimal_working_examples_forum/cylindrical_coordinates_field.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/minimal_working_examples_forum/cylindrical_coordinates_material_property.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/minimal_working_examples_forum/elasticity_tensor.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/minimal_working_examples_forum/incompressible.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/minimal_working_examples_forum/linear_expression_test.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/minimal_working_examples_forum/petsc_2D.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/minimal_working_examples_forum/test_periodic.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/minimal_working_examples_forum/test_periodic_class.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/minimal_working_examples_forum/test_shifted_field.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/minimal_working_examples_forum/teste_afim.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/minimal_working_examples_forum/working_example_dictionaries.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/multiscale/hyperelasticity/beam_with_fibers_microscale.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/physics_prototypes/compressible_hyperelasticity.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/physics_prototypes/incompressible_hyperelasticity.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/test_meshes/beam_gmsh.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/test_meshes_paths.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/aa_tests_and_examples/various_physics_tests.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/constitutive_models/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/constitutive_models/heat_transfer/isotropic_heat_conduction.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/constitutive_models/hyperelasticity/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/constitutive_models/hyperelasticity/anisotropic_hyperelasticity.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/constitutive_models/hyperelasticity/isotropic_hyperelasticity.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/constitutive_models/hyperelasticity/micropolar_hyperelasticity.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/multiscale/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/multiscale/multiscale_boundary_conditions/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/multiscale/multiscale_boundary_conditions/multiscale_classes.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/multiscale/multiscale_boundary_conditions/multiscale_expressions.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/multiscale/multiscale_hyperelasticity.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/multiscale/multiscale_micropolar.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/physics/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/physics/hyperelastic_cauchy_continuum.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/physics/hyperelastic_incompressible_cauchy_continuum.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/physics/hyperelastic_micropolar_continuum.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/physics/steady_state_heat_transfer.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/post_processes/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/post_processes/post_processes_classes.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/post_processes/post_processes_functions.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/tool_box/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/tool_box/binary_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/tool_box/body_forces_loading_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/tool_box/boundary_conditions_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/tool_box/constitutive_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/tool_box/dirichlet_load_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/tool_box/expressions_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/tool_box/functional_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/tool_box/homogenization_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/tool_box/mesh_handling_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/tool_box/multiscale_boundary_conditions_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/tool_box/numerical_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/tool_box/parallelization_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/tool_box/post_processing_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/tool_box/pseudotime_stepping_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/tool_box/read_write_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/tool_box/surface_loading_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/tool_box/tensor_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/tool_box/variational_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/MultiMech/tool_box/weak_boundary_conditions_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/PythonicUtilities/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/PythonicUtilities/aa_tests/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/PythonicUtilities/aa_tests/tests_template.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/PythonicUtilities/aa_tests/txt_tests.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/PythonicUtilities/coordinate_systems_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/PythonicUtilities/dictionary_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/PythonicUtilities/file_handling_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/PythonicUtilities/fonts/CMU_Serif_Roman.ttf +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/PythonicUtilities/interpolation_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/PythonicUtilities/math_experiments.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/PythonicUtilities/numpy_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/PythonicUtilities/package_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/PythonicUtilities/path_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/PythonicUtilities/recursion_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/PythonicUtilities/string_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/PythonicUtilities/tensor_and_math_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/PythonicUtilities/testing_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/StochasticUtilities/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/StochasticUtilities/aa_tests/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/StochasticUtilities/aa_tests/test_delaunay_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/StochasticUtilities/domain_decomposition/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/StochasticUtilities/tool_box/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/StochasticUtilities/tool_box/delaunay_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/StochasticUtilities/tool_box/sampling_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/StochasticUtilities/tool_box/statistics_tools.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/__init__.py +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout.egg-info/SOURCES.txt +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout.egg-info/dependency_links.txt +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout.egg-info/requires.txt +0 -0
- {davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout.egg-info/top_level.txt +0 -0
|
@@ -24,7 +24,8 @@ class SurrogateModel:
|
|
|
24
24
|
def __init__(self, displacement_data_file, input_data_file,
|
|
25
25
|
saved_model_file, results_path, n_training_samples,
|
|
26
26
|
quotient_space_dimension, n_monte_carlo_realizations, n_best_models,
|
|
27
|
-
n_best_samples, mesh_file_name, screenshots_path
|
|
27
|
+
n_best_samples, mesh_file_name, screenshots_path, optimizer,
|
|
28
|
+
loss_metric):
|
|
28
29
|
|
|
29
30
|
# Stores the data
|
|
30
31
|
|
|
@@ -50,6 +51,10 @@ class SurrogateModel:
|
|
|
50
51
|
|
|
51
52
|
self.screenshots_path = screenshots_path
|
|
52
53
|
|
|
54
|
+
self.optimizer = optimizer
|
|
55
|
+
|
|
56
|
+
self.loss_metric = loss_metric
|
|
57
|
+
|
|
53
58
|
# Reads the two files
|
|
54
59
|
|
|
55
60
|
self.output_data = np.load(self.results_path+"//"+
|
|
@@ -60,7 +65,7 @@ class SurrogateModel:
|
|
|
60
65
|
# Sets a list of layers and the activation functions
|
|
61
66
|
|
|
62
67
|
self.activations_list = [{"elu": {"number of neurons": 100}}, {
|
|
63
|
-
"elu": {"number of neurons":
|
|
68
|
+
"elu": {"number of neurons": 100}}, {"linear":
|
|
64
69
|
self.n_output_neurons}]
|
|
65
70
|
|
|
66
71
|
# Defines a function to train the neural network model
|
|
@@ -108,12 +113,11 @@ class SurrogateModel:
|
|
|
108
113
|
# Sets the optimization class for training
|
|
109
114
|
|
|
110
115
|
training_class = training_tools.ModelCustomTraining(custom_model,
|
|
111
|
-
training_data, training_true_values,
|
|
112
|
-
|
|
113
|
-
maximum_iterations, verbose_deltaIterations=
|
|
116
|
+
training_data, training_true_values, self.loss_metric, verbose=
|
|
117
|
+
True, n_iterations=maximum_iterations, verbose_deltaIterations=
|
|
114
118
|
verbose_delta_iterations, save_model_file=self.saved_model_file,
|
|
115
119
|
match_data_float_type_to_trainables=True, parent_path=
|
|
116
|
-
self.results_path)
|
|
120
|
+
self.results_path, optimizer=self.optimizer)
|
|
117
121
|
|
|
118
122
|
t_initial = time()
|
|
119
123
|
|
|
@@ -515,6 +519,11 @@ if __name__=="__main__":
|
|
|
515
519
|
|
|
516
520
|
n_best_samples = 10
|
|
517
521
|
|
|
522
|
+
optimizer = "Adam"
|
|
523
|
+
|
|
524
|
+
loss_metric = {"name": "LpNormError", "p": 12,
|
|
525
|
+
"use_stable_implementation": True}
|
|
526
|
+
|
|
518
527
|
training_flag = True
|
|
519
528
|
|
|
520
529
|
test_flag = False
|
|
@@ -532,7 +541,8 @@ if __name__=="__main__":
|
|
|
532
541
|
surrogate_model_class = SurrogateModel(displacement_data_file,
|
|
533
542
|
input_data_file, saved_model_file, results_path, n_training_samples,
|
|
534
543
|
quotient_space_dimension, n_monte_carlo_realizations, n_best_models,
|
|
535
|
-
n_best_samples, mesh_file_name, screenshots_path
|
|
544
|
+
n_best_samples, mesh_file_name, screenshots_path, optimizer,
|
|
545
|
+
loss_metric)
|
|
536
546
|
|
|
537
547
|
# Sets training forth if it is the case
|
|
538
548
|
|
|
@@ -951,7 +951,7 @@ class QuadraticLossOverAnyResidualAssembler(tf.keras.losses.Loss):
|
|
|
951
951
|
# Conventional losses #
|
|
952
952
|
########################################################################
|
|
953
953
|
|
|
954
|
-
# Defines a
|
|
954
|
+
# Defines a class for the maximum absolute error
|
|
955
955
|
|
|
956
956
|
class MaximumAbsoluteError(tf.keras.losses.Loss):
|
|
957
957
|
|
|
@@ -965,4 +965,162 @@ class MaximumAbsoluteError(tf.keras.losses.Loss):
|
|
|
965
965
|
|
|
966
966
|
def minimum_absolute_error(self, y_true, y_pred):
|
|
967
967
|
|
|
968
|
-
return tf.reduce_min(tf.abs(y_true - y_pred))
|
|
968
|
+
return tf.reduce_min(tf.abs(y_true - y_pred))
|
|
969
|
+
|
|
970
|
+
# Defines a class for the Lp norm of the absolute error
|
|
971
|
+
|
|
972
|
+
class LpNormError(tf.keras.losses.Loss):
|
|
973
|
+
|
|
974
|
+
"""
|
|
975
|
+
Lp norm of the error. This loss evaluates the following expression,
|
|
976
|
+
|
|
977
|
+
L = (E_ij^p)^(1/p),
|
|
978
|
+
|
|
979
|
+
where E_ij is the error measured at the j-th component of the i-th
|
|
980
|
+
sample.
|
|
981
|
+
|
|
982
|
+
Parameters
|
|
983
|
+
----------
|
|
984
|
+
p : float, default=2.0
|
|
985
|
+
p exponent of the Lp norm.
|
|
986
|
+
|
|
987
|
+
name : str, default="lp_norm_loss"
|
|
988
|
+
Name of the loss function instance.
|
|
989
|
+
"""
|
|
990
|
+
|
|
991
|
+
def __init__(self, p=2.0, epsilon=1E-7, dtype=tf.float32, name="lp"+
|
|
992
|
+
"_norm_loss", use_stable_implementation=False, **kwargs):
|
|
993
|
+
|
|
994
|
+
super().__init__(name=name, dtype=tf.as_dtype(dtype), **kwargs)
|
|
995
|
+
|
|
996
|
+
# Saves the original rawly given objects
|
|
997
|
+
|
|
998
|
+
self.raw_p = float(p)
|
|
999
|
+
|
|
1000
|
+
self.raw_epsilon = float(epsilon)
|
|
1001
|
+
|
|
1002
|
+
self.raw_dtype = tf.as_dtype(dtype).name
|
|
1003
|
+
|
|
1004
|
+
self.use_stable_implementation = use_stable_implementation
|
|
1005
|
+
|
|
1006
|
+
# Saves the live object
|
|
1007
|
+
|
|
1008
|
+
self.epsilon = tf.cast(epsilon, dtype=self.dtype)
|
|
1009
|
+
|
|
1010
|
+
# Verifies if the stable implementation is to be used
|
|
1011
|
+
|
|
1012
|
+
if self.use_stable_implementation:
|
|
1013
|
+
|
|
1014
|
+
self.p = tf.cast(self.raw_p, dtype=self.dtype)
|
|
1015
|
+
|
|
1016
|
+
# Selects the call method that scales and rescales the loss
|
|
1017
|
+
# function to avoid numerical instabilities
|
|
1018
|
+
|
|
1019
|
+
self.call_method = self.scale_evaluate_and_rescale_method
|
|
1020
|
+
|
|
1021
|
+
# Verifies if the exponent p is an even positive integer
|
|
1022
|
+
|
|
1023
|
+
elif self.raw_p%2==0 and self.raw_p>1.0:
|
|
1024
|
+
|
|
1025
|
+
self.p = tf.cast(self.raw_p, dtype=self.dtype)
|
|
1026
|
+
|
|
1027
|
+
# Selects the call method to avoid evaluating the absolute
|
|
1028
|
+
# value
|
|
1029
|
+
|
|
1030
|
+
self.call_method = self.even_exponent_loss
|
|
1031
|
+
|
|
1032
|
+
# Otherwise, changes p to half of p to compensate for the smooth
|
|
1033
|
+
# absolute value
|
|
1034
|
+
|
|
1035
|
+
elif self.raw_p>=1.0:
|
|
1036
|
+
|
|
1037
|
+
self.p = tf.cast(self.raw_p*0.5, dtype=self.dtype)
|
|
1038
|
+
|
|
1039
|
+
# Selects the call method to ensure evaluating the absolute
|
|
1040
|
+
# value before evaluating the Lp norm
|
|
1041
|
+
|
|
1042
|
+
self.call_method = self.non_even_exponent_loss
|
|
1043
|
+
|
|
1044
|
+
else:
|
|
1045
|
+
|
|
1046
|
+
raise ValueError("The 'p' exponent in 'LpNormError' loss c"+
|
|
1047
|
+
"lass must be greater than or equal to 1. Currently, it is"+
|
|
1048
|
+
": "+str(p))
|
|
1049
|
+
|
|
1050
|
+
# Sets the reciprocal of the original p exponent
|
|
1051
|
+
|
|
1052
|
+
self.p_reciprocal = tf.cast(1.0/self.raw_p, dtype=self.dtype)
|
|
1053
|
+
|
|
1054
|
+
# Defines the generic call method to be differentiated using AD
|
|
1055
|
+
|
|
1056
|
+
def call(self, y_true, y_model):
|
|
1057
|
+
|
|
1058
|
+
return self.call_method(y_true, y_model)
|
|
1059
|
+
|
|
1060
|
+
# Defines the call method to evaluate the loss function when the ex-
|
|
1061
|
+
# ponent is an even integer
|
|
1062
|
+
|
|
1063
|
+
def even_exponent_loss(self, y_true, y_model):
|
|
1064
|
+
|
|
1065
|
+
# Computes the Lp norm of the error tensor. Adds a constant epsi-
|
|
1066
|
+
# lon to the computation of the p-th root to avoid exploding gra-
|
|
1067
|
+
# dients when the p-th root tends to zero
|
|
1068
|
+
|
|
1069
|
+
return tf.pow(tf.reduce_sum(tf.pow(y_true-y_model, self.p),
|
|
1070
|
+
axis=-1)+self.epsilon, self.p_reciprocal)
|
|
1071
|
+
|
|
1072
|
+
# Defines the call method to evaluate the loss function when the ex-
|
|
1073
|
+
# ponent is not an integer or when it is an odd integer. Thus, the
|
|
1074
|
+
# absolute value is taken first
|
|
1075
|
+
|
|
1076
|
+
def non_even_exponent_loss(self, y_true, y_model):
|
|
1077
|
+
|
|
1078
|
+
# Evaluates the smooth absolute value of the error tensor first
|
|
1079
|
+
|
|
1080
|
+
absolute_error = tf.square(y_true-y_model)+self.epsilon
|
|
1081
|
+
|
|
1082
|
+
# Computes the Lp norm of the error tensor
|
|
1083
|
+
|
|
1084
|
+
return tf.pow(tf.reduce_sum(tf.pow(absolute_error, self.p),
|
|
1085
|
+
axis=-1), self.p_reciprocal)
|
|
1086
|
+
|
|
1087
|
+
# Defines a safe and numerically stable evaluation of this loss
|
|
1088
|
+
# function common to both even and odd exponents. With the caveat
|
|
1089
|
+
# that the absolute value is calculated using tf.abs
|
|
1090
|
+
|
|
1091
|
+
def scale_evaluate_and_rescale_method(self, y_true, y_model):
|
|
1092
|
+
|
|
1093
|
+
# Evaluates the absolute error tensor
|
|
1094
|
+
|
|
1095
|
+
absolute_error_tensor = tf.abs(y_true-y_model)
|
|
1096
|
+
|
|
1097
|
+
# Gets the maximum error per sample as a tensor
|
|
1098
|
+
|
|
1099
|
+
maximum_per_sample = tf.reduce_max(absolute_error_tensor, axis=
|
|
1100
|
+
-1, keepdims=True)
|
|
1101
|
+
|
|
1102
|
+
# Divides the error tensor by the maximum absolute error. But
|
|
1103
|
+
# care is taken to avoid division by zero
|
|
1104
|
+
|
|
1105
|
+
absolute_error_tensor = tf.math.divide_no_nan(
|
|
1106
|
+
absolute_error_tensor, maximum_per_sample)
|
|
1107
|
+
|
|
1108
|
+
# Evaluates the Lp norm by computing the powers with the scaled
|
|
1109
|
+
# components then muliplying by the scale factor
|
|
1110
|
+
|
|
1111
|
+
return tf.squeeze(maximum_per_sample, axis=-1)*tf.pow(
|
|
1112
|
+
tf.reduce_sum(tf.pow(absolute_error_tensor, self.p), axis=-1),
|
|
1113
|
+
self.p_reciprocal)
|
|
1114
|
+
|
|
1115
|
+
# Defines the get-config method to ensure serialization when saving
|
|
1116
|
+
# and loading models
|
|
1117
|
+
|
|
1118
|
+
def get_config(self):
|
|
1119
|
+
|
|
1120
|
+
config = super().get_config()
|
|
1121
|
+
|
|
1122
|
+
config.update({"p": self.raw_p, "dtype": self.raw_dtype, "epsi"+
|
|
1123
|
+
"lon": self.raw_epsilon, "use_stable_implementation":
|
|
1124
|
+
self.use_stable_implementation})
|
|
1125
|
+
|
|
1126
|
+
return config
|
{davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/DeepMech/tool_box/training_tools.py
RENAMED
|
@@ -24,6 +24,8 @@ from ..tool_box import loss_tools
|
|
|
24
24
|
|
|
25
25
|
from ..tool_box import parameters_tools
|
|
26
26
|
|
|
27
|
+
from ..tool_box import loss_assembler_classes
|
|
28
|
+
|
|
27
29
|
from ...PythonicUtilities import path_tools
|
|
28
30
|
|
|
29
31
|
from ...PythonicUtilities import string_tools
|
|
@@ -32,6 +34,10 @@ from ...PythonicUtilities.function_tools import verify_dictionary_as_function_ar
|
|
|
32
34
|
|
|
33
35
|
from ...PythonicUtilities.user_interaction_tools import PrintForLoopInfo
|
|
34
36
|
|
|
37
|
+
from ...PythonicUtilities.programming_tools import dispatch_classes
|
|
38
|
+
|
|
39
|
+
from ...PythonicUtilities.dictionary_tools import delete_dictionary_keys
|
|
40
|
+
|
|
35
41
|
# Defines a class to optimize the model's parameters
|
|
36
42
|
|
|
37
43
|
class ModelTraining:
|
|
@@ -48,8 +54,6 @@ class ModelTraining:
|
|
|
48
54
|
|
|
49
55
|
self.model = model
|
|
50
56
|
|
|
51
|
-
self.loss_metric = loss_metric
|
|
52
|
-
|
|
53
57
|
self.optimizer = optimizer
|
|
54
58
|
|
|
55
59
|
self.n_iterations = n_iterations
|
|
@@ -60,6 +64,11 @@ class ModelTraining:
|
|
|
60
64
|
|
|
61
65
|
self.verbose = verbose
|
|
62
66
|
|
|
67
|
+
# Transforms the loss metric to a live loss class instance if it
|
|
68
|
+
# were given as a string or dictionary
|
|
69
|
+
|
|
70
|
+
self.loss_metric = verify_loss_metric(loss_metric)
|
|
71
|
+
|
|
63
72
|
# Gets the number of trainable parameters of the model
|
|
64
73
|
|
|
65
74
|
self.number_trainable_parameters = self.model.count_params()
|
|
@@ -233,7 +242,10 @@ class ModelCustomTraining:
|
|
|
233
242
|
|
|
234
243
|
self.verbose = verbose
|
|
235
244
|
|
|
236
|
-
|
|
245
|
+
# Transforms the loss metric to a live loss class instance if it
|
|
246
|
+
# were given as a string or dictionary
|
|
247
|
+
|
|
248
|
+
self.loss_metric = verify_loss_metric(loss_metric)
|
|
237
249
|
|
|
238
250
|
# Gets the number of trainable parameters of the model
|
|
239
251
|
|
|
@@ -389,7 +401,8 @@ class ModelCustomTraining:
|
|
|
389
401
|
# are consistent
|
|
390
402
|
|
|
391
403
|
verify_dictionary_as_function_argument(
|
|
392
|
-
optimizer_class.__init__, optimizer_additional_info
|
|
404
|
+
optimizer_class.__init__, optimizer_additional_info,
|
|
405
|
+
list_of_arguments_not_to_be_verified=["self", "kwargs"])
|
|
393
406
|
|
|
394
407
|
# Sets the hyperparameters
|
|
395
408
|
|
|
@@ -512,6 +525,13 @@ class ModelCustomTraining:
|
|
|
512
525
|
self.model, self.loss_metric, self.training_input,
|
|
513
526
|
model_true_values=self.training_trueValues, verbose=verbose)
|
|
514
527
|
|
|
528
|
+
# Otherwise, initializes the flat tensor of model parameters as
|
|
529
|
+
# a None object
|
|
530
|
+
|
|
531
|
+
else:
|
|
532
|
+
|
|
533
|
+
self.model_parameters = None
|
|
534
|
+
|
|
515
535
|
# Defines a method to evaluate the hessian of each output neuron of
|
|
516
536
|
# the model
|
|
517
537
|
|
|
@@ -576,7 +596,7 @@ class ModelCustomTraining:
|
|
|
576
596
|
# proper for use with Keras' optimizers
|
|
577
597
|
|
|
578
598
|
@tf.function
|
|
579
|
-
def loss_function_keras(self
|
|
599
|
+
def loss_function_keras(self):
|
|
580
600
|
|
|
581
601
|
# Gets the model response
|
|
582
602
|
|
|
@@ -589,12 +609,12 @@ class ModelCustomTraining:
|
|
|
589
609
|
# Defines a method to evaluate the loss function given the trainable
|
|
590
610
|
# parameters as input
|
|
591
611
|
|
|
592
|
-
def loss_function_scipy(self
|
|
612
|
+
def loss_function_scipy(self):
|
|
593
613
|
|
|
594
614
|
# Gets the loss value and returns it
|
|
595
615
|
|
|
596
616
|
return self.loss_class.evaluate_scalar_function(
|
|
597
|
-
model_parameters)
|
|
617
|
+
self.model_parameters)
|
|
598
618
|
|
|
599
619
|
# Defines a function to evaluate the loss function on other sets of
|
|
600
620
|
# data
|
|
@@ -752,7 +772,7 @@ class ModelCustomTraining:
|
|
|
752
772
|
|
|
753
773
|
start_time = time.time()
|
|
754
774
|
|
|
755
|
-
initial_loss = self.loss_function(
|
|
775
|
+
initial_loss = self.loss_function().numpy()
|
|
756
776
|
|
|
757
777
|
# Iterates through the optimization loop
|
|
758
778
|
|
|
@@ -803,8 +823,7 @@ class ModelCustomTraining:
|
|
|
803
823
|
|
|
804
824
|
# Gets the loss function value and the gradient
|
|
805
825
|
|
|
806
|
-
loss_value = self.loss_function(
|
|
807
|
-
self.model_parameters)
|
|
826
|
+
loss_value = self.loss_function()
|
|
808
827
|
|
|
809
828
|
# Gets the gradient from the second position of the
|
|
810
829
|
# call method
|
|
@@ -812,6 +831,14 @@ class ModelCustomTraining:
|
|
|
812
831
|
evaluated_gradient = self.loss_class(
|
|
813
832
|
self.model_parameters)[1]
|
|
814
833
|
|
|
834
|
+
# If it is a Keras' optimizer, the gradient must be
|
|
835
|
+
# flattened
|
|
836
|
+
|
|
837
|
+
else:
|
|
838
|
+
|
|
839
|
+
evaluated_gradient = tf.concat([tf.reshape(tensor,
|
|
840
|
+
[-1]) for tensor in evaluated_gradient], axis=0)
|
|
841
|
+
|
|
815
842
|
# Gets the gradient norm
|
|
816
843
|
|
|
817
844
|
gradient_value = tf.norm(evaluated_gradient).numpy()
|
|
@@ -858,8 +885,7 @@ class ModelCustomTraining:
|
|
|
858
885
|
|
|
859
886
|
# Gets the final loss function
|
|
860
887
|
|
|
861
|
-
final_loss = self.loss_function(
|
|
862
|
-
).numpy()
|
|
888
|
+
final_loss = self.loss_function().numpy()
|
|
863
889
|
|
|
864
890
|
print("\n#################################################"+
|
|
865
891
|
"#######################\n# Trainin"+
|
|
@@ -1099,7 +1125,7 @@ class ModelCustomTraining:
|
|
|
1099
1125
|
print("Loads the best model")
|
|
1100
1126
|
|
|
1101
1127
|
self.model = tf.keras.models.load_model(self.parent_path+"//1_"+
|
|
1102
|
-
"
|
|
1128
|
+
"best_"+model_base_name+".keras")
|
|
1103
1129
|
|
|
1104
1130
|
########################################################################
|
|
1105
1131
|
# Utilities #
|
|
@@ -1122,4 +1148,125 @@ def integer_toString(number, maximum_digits):
|
|
|
1122
1148
|
|
|
1123
1149
|
number_string = " "+number_string
|
|
1124
1150
|
|
|
1125
|
-
return number_string
|
|
1151
|
+
return number_string
|
|
1152
|
+
|
|
1153
|
+
# Defines a function to verify if a given loss metric is a valid Keras'
|
|
1154
|
+
# loss or whether it is a custom loss
|
|
1155
|
+
|
|
1156
|
+
def verify_loss_metric(loss_metric):
|
|
1157
|
+
|
|
1158
|
+
# Assembles a dictionary of all natively available Keras' losses
|
|
1159
|
+
|
|
1160
|
+
available_keras_losses = {}
|
|
1161
|
+
|
|
1162
|
+
for loss_name, loss_class in inspect.getmembers(tf.keras.losses):
|
|
1163
|
+
|
|
1164
|
+
# Verifies if the object is indeed a class and if it is a sub-
|
|
1165
|
+
# class of the Keras' Loss parent class. Also excludes objects
|
|
1166
|
+
# starting with _
|
|
1167
|
+
|
|
1168
|
+
if inspect.isclass(loss_class) and issubclass(loss_class,
|
|
1169
|
+
tf.keras.losses.Loss) and (not loss_name.startswith("_")):
|
|
1170
|
+
|
|
1171
|
+
# Saves the object's name in lower case
|
|
1172
|
+
|
|
1173
|
+
available_keras_losses[loss_name.lower()] = loss_class
|
|
1174
|
+
|
|
1175
|
+
# Verifies if the loss metric is a string
|
|
1176
|
+
|
|
1177
|
+
if isinstance(loss_metric, str):
|
|
1178
|
+
|
|
1179
|
+
# Converts it to a dictionary first
|
|
1180
|
+
|
|
1181
|
+
loss_metric = {"name": loss_metric}
|
|
1182
|
+
|
|
1183
|
+
# Verifies if the loss metric is a dictionary
|
|
1184
|
+
|
|
1185
|
+
if isinstance(loss_metric, dict):
|
|
1186
|
+
|
|
1187
|
+
# Verifies if this dictionary has the key name
|
|
1188
|
+
|
|
1189
|
+
if not ("name" in loss_metric):
|
|
1190
|
+
|
|
1191
|
+
raise ValueError("'loss_metric' is a dictionary, but it do"+
|
|
1192
|
+
"es not have the key 'name'. This key is essential to find"+
|
|
1193
|
+
"ing the loss metric. Check the given 'loss_metric':\n"+str(
|
|
1194
|
+
loss_metric))
|
|
1195
|
+
|
|
1196
|
+
# Recovers the name of the loss metric and removes this key-value
|
|
1197
|
+
# pair from the dictionary
|
|
1198
|
+
|
|
1199
|
+
loss_metric_name = loss_metric["name"]
|
|
1200
|
+
|
|
1201
|
+
loss_metric_info = delete_dictionary_keys(loss_metric, "name")
|
|
1202
|
+
|
|
1203
|
+
# Verifies if this loss is a Keras' loss
|
|
1204
|
+
|
|
1205
|
+
if loss_metric_name.lower() in available_keras_losses:
|
|
1206
|
+
|
|
1207
|
+
# Recovers the loss class
|
|
1208
|
+
|
|
1209
|
+
loss_metric = available_keras_losses[
|
|
1210
|
+
loss_metric_name.lower()]
|
|
1211
|
+
|
|
1212
|
+
# Verifies if the input dictionary has valid arguments for
|
|
1213
|
+
# the instantiation of the class
|
|
1214
|
+
|
|
1215
|
+
verify_dictionary_as_function_argument(loss_metric.__init__,
|
|
1216
|
+
loss_metric_info, list_of_arguments_not_to_be_verified=["s"+
|
|
1217
|
+
"elf", "kwargs"])
|
|
1218
|
+
|
|
1219
|
+
# Instantiates the class
|
|
1220
|
+
|
|
1221
|
+
return loss_metric(**loss_metric_info)
|
|
1222
|
+
|
|
1223
|
+
# Otherwise, verifies if they are a custom loss function defined
|
|
1224
|
+
# in loss_assembler_class.py
|
|
1225
|
+
|
|
1226
|
+
else:
|
|
1227
|
+
|
|
1228
|
+
# Verifies if the given loss name is a valid class
|
|
1229
|
+
|
|
1230
|
+
loss_metric_result = dispatch_classes([loss_metric_name],
|
|
1231
|
+
loss_assembler_classes, class_input=loss_metric_info,
|
|
1232
|
+
class_kind_name_for_error_message="loss class",
|
|
1233
|
+
return_error_message=True)
|
|
1234
|
+
|
|
1235
|
+
# If the result is a string, it means the loss class was not
|
|
1236
|
+
# found
|
|
1237
|
+
|
|
1238
|
+
if isinstance(loss_metric_result, str):
|
|
1239
|
+
|
|
1240
|
+
keras_losses = ""
|
|
1241
|
+
|
|
1242
|
+
for name in available_keras_losses:
|
|
1243
|
+
|
|
1244
|
+
keras_losses += "\n'"+str(name)+"'"
|
|
1245
|
+
|
|
1246
|
+
raise ValueError("'loss_metric' was not found in Keras"+
|
|
1247
|
+
"' native loss functions nor in the custom-built ones."+
|
|
1248
|
+
"\nThe given name is '"+str(loss_metric_name)+"'. Chec"+
|
|
1249
|
+
"k the available Keras' loss functions:\n"+keras_losses+
|
|
1250
|
+
"\n\nCheck the error for the custom-built losses:\n"+
|
|
1251
|
+
loss_metric_result)
|
|
1252
|
+
|
|
1253
|
+
# Otherwise, takes the loss class instance from the result
|
|
1254
|
+
# dictionary
|
|
1255
|
+
|
|
1256
|
+
return loss_metric_result[loss_metric_name]
|
|
1257
|
+
|
|
1258
|
+
# Otherwise, verifies if the loss metric is a Keras' loss instance
|
|
1259
|
+
|
|
1260
|
+
elif not isinstance(loss_metric, tf.keras.losses.Loss):
|
|
1261
|
+
|
|
1262
|
+
raise TypeError("'loss_metric' can be a string with the name o"+
|
|
1263
|
+
"f a loss function from\nKeras or from the custom-built loss f"+
|
|
1264
|
+
"unctions. It can also be a dictio-\nnary with the name of the"+
|
|
1265
|
+
" loss function and additional information. Fi-\nnally, 'loss_"+
|
|
1266
|
+
"metric' can be an instance of a Keras' native loss. Curren-\n"+
|
|
1267
|
+
"tly, it is neither. Check the provided 'loss_metric':\n"+str(
|
|
1268
|
+
loss_metric))
|
|
1269
|
+
|
|
1270
|
+
# If no error has been risen, just returns the loss instance
|
|
1271
|
+
|
|
1272
|
+
return loss_metric
|
{davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/PythonicUtilities/function_tools.py
RENAMED
|
@@ -81,7 +81,7 @@ False):
|
|
|
81
81
|
# arguments? Does it have any keys that are not keyword arguments?
|
|
82
82
|
|
|
83
83
|
def verify_dictionary_as_function_argument(function_object,
|
|
84
|
-
input_dictionary):
|
|
84
|
+
input_dictionary, list_of_arguments_not_to_be_verified=[]):
|
|
85
85
|
|
|
86
86
|
# Gets the dictionary of keyword arguments and the list of positi-
|
|
87
87
|
# onal arguments
|
|
@@ -93,7 +93,8 @@ input_dictionary):
|
|
|
93
93
|
|
|
94
94
|
for argument_name in positional_arguments_list:
|
|
95
95
|
|
|
96
|
-
if not (argument_name in input_dictionary)
|
|
96
|
+
if (not (argument_name in input_dictionary)) and (not (
|
|
97
|
+
argument_name in list_of_arguments_not_to_be_verified)):
|
|
97
98
|
|
|
98
99
|
# Gets a string with the positional arguments
|
|
99
100
|
|
{davout-0.1.1.dev169 → davout-0.1.1.dev171}/source/Davout/PythonicUtilities/programming_tools.py
RENAMED
|
@@ -41,6 +41,17 @@ sys.modules["dictionary_tools"] = dictionary_tools
|
|
|
41
41
|
|
|
42
42
|
specifications.loader.exec_module(dictionary_tools)
|
|
43
43
|
|
|
44
|
+
# Imports function tools
|
|
45
|
+
|
|
46
|
+
specifications = util.spec_from_file_location("function_tools",
|
|
47
|
+
broken_path[1]/"PythonicUtilities"/"function_tools.py")
|
|
48
|
+
|
|
49
|
+
function_tools = util.module_from_spec(specifications)
|
|
50
|
+
|
|
51
|
+
sys.modules["function_tools"] = function_tools
|
|
52
|
+
|
|
53
|
+
specifications.loader.exec_module(function_tools)
|
|
54
|
+
|
|
44
55
|
########################################################################
|
|
45
56
|
# Progress bar #
|
|
46
57
|
########################################################################
|
|
@@ -688,7 +699,9 @@ None, searched_entity="classes"):
|
|
|
688
699
|
@optional_argumentsInitializer({'reserved_entities': lambda: []})
|
|
689
700
|
|
|
690
701
|
def dispatch_classes(methods_names, searched_file, parent_class=None,
|
|
691
|
-
class_input=None, reserved_entities=None
|
|
702
|
+
class_input=None, reserved_entities=None,
|
|
703
|
+
class_kind_name_for_error_message="class method", return_error_message=
|
|
704
|
+
False):
|
|
692
705
|
|
|
693
706
|
# Assures methods_names is a list, or a tuple or a dictionary
|
|
694
707
|
|
|
@@ -732,9 +745,18 @@ class_input=None, reserved_entities=None):
|
|
|
732
745
|
|
|
733
746
|
available_list += "'"+name+"'\n"
|
|
734
747
|
|
|
748
|
+
# If the error message is to be returned instead of au-
|
|
749
|
+
# tomatically risen
|
|
750
|
+
|
|
751
|
+
if return_error_message:
|
|
752
|
+
|
|
753
|
+
return ("'"+str(method_name)+"' is not an availabl"+
|
|
754
|
+
"e "+class_kind_name_for_error_message+". Find one"+
|
|
755
|
+
" in the list:"+available_list)
|
|
756
|
+
|
|
735
757
|
raise NameError("'"+str(method_name)+"' is not an avai"+
|
|
736
|
-
"lable
|
|
737
|
-
available_list)
|
|
758
|
+
"lable "+class_kind_name_for_error_message+". Find one"+
|
|
759
|
+
" in the list:"+available_list)
|
|
738
760
|
|
|
739
761
|
elif isinstance(class_input, tuple):
|
|
740
762
|
|
|
@@ -756,9 +778,62 @@ class_input=None, reserved_entities=None):
|
|
|
756
778
|
|
|
757
779
|
available_list += "'"+name+"'\n"
|
|
758
780
|
|
|
781
|
+
# If the error message is to be returned instead of au-
|
|
782
|
+
# tomatically risen
|
|
783
|
+
|
|
784
|
+
if return_error_message:
|
|
785
|
+
|
|
786
|
+
return ("'"+str(method_name)+"' is not an availabl"+
|
|
787
|
+
"e "+class_kind_name_for_error_message+". Find one"+
|
|
788
|
+
" in the list:"+available_list)
|
|
789
|
+
|
|
759
790
|
raise NameError("'"+str(method_name)+"' is not an avai"+
|
|
760
|
-
"lable
|
|
761
|
-
available_list)
|
|
791
|
+
"lable "+class_kind_name_for_error_message+". Find one"+
|
|
792
|
+
" in the list:"+available_list)
|
|
793
|
+
|
|
794
|
+
# If the class input is a dictionary
|
|
795
|
+
|
|
796
|
+
elif isinstance(class_input, dict):
|
|
797
|
+
|
|
798
|
+
for method_name in methods_names:
|
|
799
|
+
|
|
800
|
+
# If the name is in the list of available methods, updates
|
|
801
|
+
# the dictionary of classes
|
|
802
|
+
|
|
803
|
+
if method_name in available_methodsNames:
|
|
804
|
+
|
|
805
|
+
# Verifies if the given class input has all the necessary
|
|
806
|
+
# positional arguments and possible keyword arguments
|
|
807
|
+
|
|
808
|
+
function_tools.verify_dictionary_as_function_argument(
|
|
809
|
+
methods_classesDict[method_name].__init__, class_input,
|
|
810
|
+
list_of_arguments_not_to_be_verified=["self", "kwargs"])
|
|
811
|
+
|
|
812
|
+
# Instantiates the class by unpacking the dictionary
|
|
813
|
+
|
|
814
|
+
methods_classes[method_name] = methods_classesDict[
|
|
815
|
+
method_name](**class_input)
|
|
816
|
+
|
|
817
|
+
else:
|
|
818
|
+
|
|
819
|
+
available_list = "\n"
|
|
820
|
+
|
|
821
|
+
for name in available_methodsNames:
|
|
822
|
+
|
|
823
|
+
available_list += "'"+name+"'\n"
|
|
824
|
+
|
|
825
|
+
# If the error message is to be returned instead of au-
|
|
826
|
+
# tomatically risen
|
|
827
|
+
|
|
828
|
+
if return_error_message:
|
|
829
|
+
|
|
830
|
+
return ("'"+str(method_name)+"' is not an availabl"+
|
|
831
|
+
"e "+class_kind_name_for_error_message+". Find one"+
|
|
832
|
+
" in the list:"+available_list)
|
|
833
|
+
|
|
834
|
+
raise NameError("'"+str(method_name)+"' is not an avai"+
|
|
835
|
+
"lable "+class_kind_name_for_error_message+". Find one"+
|
|
836
|
+
" in the list:"+available_list)
|
|
762
837
|
|
|
763
838
|
else:
|
|
764
839
|
|
|
@@ -780,9 +855,18 @@ class_input=None, reserved_entities=None):
|
|
|
780
855
|
|
|
781
856
|
available_list += "'"+name+"'\n"
|
|
782
857
|
|
|
858
|
+
# If the error message is to be returned instead of au-
|
|
859
|
+
# tomatically risen
|
|
860
|
+
|
|
861
|
+
if return_error_message:
|
|
862
|
+
|
|
863
|
+
return ("'"+str(method_name)+"' is not an availabl"+
|
|
864
|
+
"e "+class_kind_name_for_error_message+". Find one"+
|
|
865
|
+
" in the list:"+available_list)
|
|
866
|
+
|
|
783
867
|
raise NameError("'"+str(method_name)+"' is not an avai"+
|
|
784
|
-
"lable
|
|
785
|
-
available_list)
|
|
868
|
+
"lable "+class_kind_name_for_error_message+". Find one"+
|
|
869
|
+
" in the list:"+available_list)
|
|
786
870
|
|
|
787
871
|
# Returns the dictionary of classes that will be used given the na-
|
|
788
872
|
# mes and the available classes
|