utils package
Subpackages
- utils.ctransf package
- Submodules
- utils.ctransf.class_reducer module
- utils.ctransf.class_setter module
- utils.ctransf.class_transformer module
- utils.ctransf.distance_reclassifier module
DistanceReclassifierDistanceReclassifier.extract_ctransf_args()DistanceReclassifier.__init__()DistanceReclassifier.transform()DistanceReclassifier.transform_pcloud()DistanceReclassifier.apply_conditions()DistanceReclassifier.apply_distance_filters()DistanceReclassifier.compute_centroids()DistanceReclassifier.determine_fnames()
- Module contents
- utils.ftransf package
- Submodules
- utils.ftransf.explicit_selector module
- utils.ftransf.feature_transformer module
FeatureTransformerExceptionFeatureTransformerFeatureTransformer.extract_ftransf_args()FeatureTransformer.__init__()FeatureTransformer.transform()FeatureTransformer.transform_pcloud()FeatureTransformer.report()FeatureTransformer.build_new_las_header()FeatureTransformer.get_names_of_transformed_features()FeatureTransformer.safely_handle_fnames()
- utils.ftransf.kbest_selector module
- utils.ftransf.minmax_normalizer module
- utils.ftransf.pca_transformer module
- utils.ftransf.percentile_selector module
- utils.ftransf.standardizer module
- utils.ftransf.variance_selector module
- Module contents
- utils.imput package
- utils.neighborhood package
- utils.preds package
- Submodules
- utils.preds.argmax_pred_select_strategy module
- utils.preds.entropic_pred_reduce_strategy module
- utils.preds.max_pred_reduce_strategy module
- utils.preds.mean_pred_reduce_strategy module
- utils.preds.pred_reduce_strategy module
- utils.preds.pred_select_strategy module
- utils.preds.prediction_reducer module
- utils.preds.prediction_reducer_factory module
- utils.preds.sum_pred_reduce_strategy module
- Module contents
- utils.ptransf package
- Submodules
- utils.ptransf.data_augmentor module
- utils.ptransf.fps_decorator_transformer module
- utils.ptransf.min_dist_decimator_decorator module
- utils.ptransf.point_cloud_sampler module
PointCloudSamplerPointCloudSampler.extract_ptransf_args()PointCloudSampler.__init__()PointCloudSampler.transform()PointCloudSampler.transform_pcloud()PointCloudSampler.apply_neighborhood_sampling()PointCloudSampler.update_selected_indices()PointCloudSampler.filter_support_points()PointCloudSampler.apply_condition()PointCloudSampler.compute_neighborhoods()
- utils.ptransf.point_cloud_sampler_decorator module
PointCloudSamplerDecoratorPointCloudSamplerDecorator.__init__()PointCloudSamplerDecorator.transform()PointCloudSamplerDecorator.transform_pcloud()PointCloudSamplerDecorator.propagate()PointCloudSamplerDecorator.reduce()PointCloudSamplerDecorator.handle_encoding_neighbors()PointCloudSamplerDecorator.handle_decoding_neighbors()PointCloudSamplerDecorator.encode()PointCloudSamplerDecorator.handle_encoding_neighborhoods_release()PointCloudSamplerDecorator.export_representation()PointCloudSamplerDecorator.encode_decode_release_and_export()
- utils.ptransf.point_transformer module
- utils.ptransf.receptive_field module
- utils.ptransf.receptive_field_fps module
ReceptiveFieldFPSReceptiveFieldFPS.__init__()ReceptiveFieldFPS.fit()ReceptiveFieldFPS.centroids_from_points()ReceptiveFieldFPS.propagate_values()ReceptiveFieldFPS.do_propagate_values()ReceptiveFieldFPS.reduce_values()ReceptiveFieldFPS.do_reduce_values()ReceptiveFieldFPS.center_and_scale()ReceptiveFieldFPS.undo_center_and_scale()ReceptiveFieldFPS.compute_fps_on_3D_pcloud()ReceptiveFieldFPS.oversample()ReceptiveFieldFPS.nearest_oversample()ReceptiveFieldFPS.knn_oversample()ReceptiveFieldFPS.spherical_oversample()ReceptiveFieldFPS.naive_spherical_oversample()ReceptiveFieldFPS.gaussian_knn_oversample()ReceptiveFieldFPS.spherical_radiation_oversample()ReceptiveFieldFPS.naive_spherical_radiation_oversample()ReceptiveFieldFPS.canibalize()
- utils.ptransf.receptive_field_fpspp module
- utils.ptransf.receptive_field_gs module
ReceptiveFieldGSReceptiveFieldGS.__init__()ReceptiveFieldGS.fit()ReceptiveFieldGS.centroids_from_points()ReceptiveFieldGS.propagate_values()ReceptiveFieldGS.reduce_values()ReceptiveFieldGS.shadow_indexing_matrix_from_points()ReceptiveFieldGS.center_and_scale()ReceptiveFieldGS.undo_center_and_scale()ReceptiveFieldGS.get_center_of_empty_cells()ReceptiveFieldGS.num_cells_from_cell_size()ReceptiveFieldGS.canibalize()
- utils.ptransf.receptive_field_hierarchical_fps module
ReceptiveFieldHierarchicalFPSReceptiveFieldHierarchicalFPS.__init__()ReceptiveFieldHierarchicalFPS.fit()ReceptiveFieldHierarchicalFPS.centroids_from_points()ReceptiveFieldHierarchicalFPS.propagate_values()ReceptiveFieldHierarchicalFPS.reduce_values()ReceptiveFieldHierarchicalFPS.get_downsampling_matrices()ReceptiveFieldHierarchicalFPS.get_neighborhood_matrices()ReceptiveFieldHierarchicalFPS.get_upsampling_matrices()ReceptiveFieldHierarchicalFPS.center_and_scale()ReceptiveFieldHierarchicalFPS.undo_center_and_scale()ReceptiveFieldHierarchicalFPS.optimize_indexing_memory()ReceptiveFieldHierarchicalFPS.canibalize()
- utils.ptransf.receptive_field_hierarchical_fpspp module
- utils.ptransf.receptive_field_hierarchical_sg module
ReceptiveFieldHierarchicalSGReceptiveFieldHierarchicalSG.__init__()ReceptiveFieldHierarchicalSG.fit()ReceptiveFieldHierarchicalSG.get_submanifold_maps()ReceptiveFieldHierarchicalSG.get_downsampling_vectors()ReceptiveFieldHierarchicalSG.get_upsampling_vectors()ReceptiveFieldHierarchicalSG.get_num_partitions()ReceptiveFieldHierarchicalSG.get_min_point()ReceptiveFieldHierarchicalSG.get_max_depth()ReceptiveFieldHierarchicalSG.get_submanifold_windows()ReceptiveFieldHierarchicalSG.get_downsampling_windows()ReceptiveFieldHierarchicalSG.get_upsampling_windows()ReceptiveFieldHierarchicalSG.compute_active_centroids()ReceptiveFieldHierarchicalSG.get_submanifold_map_as_dict()
- utils.ptransf.sampling_decorator_utils module
- utils.ptransf.simple_data_augmentor module
- utils.ptransf.simple_smoother_decorator_transformer module
- utils.ptransf.simple_structure_smootherpp module
- Module contents
- utils.raster package
- Submodules
- utils.raster.dem_generator module
- utils.raster.grid_interpolator_2d module
GridInterpolator2DGridInterpolator2D.__init__()GridInterpolator2D.__call__()GridInterpolator2D.compute_domain_mask()GridInterpolator2D.compute_all_domain()GridInterpolator2D.compute_target_domain()GridInterpolator2D.compute_polygonal_contour_domain()GridInterpolator2D.compute_polygonal_contour_target_domain()GridInterpolator2D.compute_interpolation()GridInterpolator2D.compute_relational_mask()GridInterpolator2D.compute_erosions()GridInterpolator2D.compute_dilations()
- Module contents
- utils.tuning package
Submodules
utils.ctransf_utils module
- class utils.ctransf_utils.CtransfUtils
Bases:
object- Author:
Alberto M. Esmoris Pena
Class with util static methods to work with class transformers.
- static extract_ctransf_class(spec)
Extract the classification transformer’s class from the key-word specification.
- Parameters:
spec – The key-word specification.
- Returns:
Class representing/realizing a class transformer.
- Return type:
utils.dict_utils module
- class utils.dict_utils.DictUtils
Bases:
object- Author:
Alberto M. Esmoris Pena
Class with util static methods to work with dictionaries.
- static delete_by_val(dict, val)
- Delete all the entries on the dictionary with exactly the
given value.
- Parameters:
dict – The dictionary to be updated.
val – The value of the entries to be removed.
- Returns:
A version of the input dictionary after deleting the requested entries.
- static add_defaults(dict, defaults)
For any value that is not explicitly available in the input dictionary dict, set it from the defaults dictionary (if available).
NOTE updates are done in place.
- Parameters:
dict – The input dictionary whose defaults must be set.
defaults – The dictionary with the default values.
- Returns:
The updated input dictionary dict.
- static merge(x, y)
Merge two dictionaries into a single one.
- Parameters:
x (dict) – The first dictionary to merge.
y (dict) – The second dictionary to merge.
- Returns:
A dictionary that is the result of merging the two input dictionaries.
- Return type:
dict
utils.dl_utils module
- class utils.dl_utils.DLUtils
Bases:
object- Author:
Alberto M. Esmoris Pena
Class with utils static methods to work with deep learning.
- static is_using_binary_crossentropy(comp_args, default=False)
Check whether the compilation arguments dictionary uses a binary cross-entropy loss function (True) or not (False).
- Parameters:
comp_args (dict) – The compilation arguments.
default (bool) – Default value to be assummed when the loss function cannot be explicitly checked.
- Returns:
True if a binary cross-entropy is used, False otherwise.
- Return type:
bool
- static activation_layer_from_name(act_name, **kwargs)
Return the corresponding keras activation layer from the given name and arguments.
- Parameters:
act_name (str) – The name of the activation function to be instantiated as a layer.
kwargs (dict) – The key-word arguments for the activation layer.
- Returns:
The activation layer.
utils.ftransf_utils module
- class utils.ftransf_utils.FtransfUtils
Bases:
object- Author:
Alberto M. Esmoris Pena
Class with util static methods to work with feature transformers.
- static extract_ftransf_class(spec)
Extract the feature transformer’s class from the key-word specification.
- Parameters:
spec – The key-word specification.
- Returns:
Class representing/realizing a feature transformer.
- Return type:
utils.imputer_utils module
- class utils.imputer_utils.ImputerUtils
Bases:
object- Author:
Alberto M. Esmoris Pena
Class with util static methods to work with imputers.
utils.keras_utils module
- class utils.keras_utils.KerasUtils
Bases:
object- Author:
Alberto M. Esmoris Pena
Class with util static methods to extend Keras functionalities.
- static merge_history(a, b)
Merge history a with history b. Note that history a must be chronologically before history b so the values can be properly sorted over time.
- Parameters:
a – The first training history (also chronologically predecessor of history b).
b – The second training history (also chronologically successor of history a).
- Returns:
The merged history (which is the history a again because it is updated in place).
- static set_learning_rate(nn, lr)
Set the learning rate of a compiled neural network.
- Parameters:
nn – The neural network whose learning rate must be set.
lr (float) – The new learning rate for the neural network.
- Returns:
The neural network itself (which is updated in place), for fluent programming purposes.
- static handle_h5_layer_rename(layer, cache)
Handle the renaming of a layer to make it compatible with the Keras naming convention for HDF5 files (which is based on snake case). The first time a given type of layer (where the type is given by the class), the renaming consists of the snake case version of the class name. The second time, the name is the same but appending _1 at the end, the third time appending _2, and so on.
- Parameters:
layer – The layer whose HDF5 name must be computed.
cache (dict) – The cache to track already named layers. It will be updated for each call to this function. The keys are the class names, the values how many times it has been used.
- Returns:
The new name for the class compatible with Keras HDF5 naming convention.
- Return type:
str
utils.num_utils module
- class utils.num_utils.NumUtils
Bases:
object- Author:
Alberto M. Esmoris Pena
Class with util numerical methods.
- static find_decimal_scale(x, min_scale=None)
Find the minimum decimal scale \(\lambda = 10^{k} \in \mathbb{R}\) that must be used to represent the numbers in \(\pmb{x}\) without loosing precision.
\[k = \lfloor{ \log_{10}\left( \min \left\{ \tilde{x}_{i} : 1 \leq i \leq m \right\} \right) }\rfloor\]where \(m \in \mathbb{Z}_{>0}\) is the amount of input numbers and \(\tilde{x}_i\) is the \(i\)-th number in the sorted input
\[\pmb{\tilde{x}} = \left( \tilde{x}_1=x_{j_1}, \ldots, \tilde{x}_{m}=x_{j_m} \right) \;\text{s.t.}\; \tilde{x}_{i} > \tilde{x}_{i+1} .\]Note that if the input is an array or a tensor of greater dimensionality than a vector it will be flattened and treated as a vector. On top of that, repeated values are discarded. In other words, if the input contains \(R \in \mathbb{Z}_{\geq 0}\) repeated numbers, the dimensionality considered in the computations will be \(m=N-R\), where \(N \in \mathbb{Z}_{>0}\) is the original amount of input numbers.
- Parameters:
x (
np.ndarray) – The input numbers.min_scale (float) – The minimum decimal scale. If not given, then it will be automatically determined from input data.
- Returns:
\(\lambda = 10^{k} \in \mathbb{R}\)
- Return type:
float
- static compute_decimal_scale(x)
Assist the
NumUtils.find_decimal_scale()by computing\[10^{k}\]with
\[k = \lfloor{ \log_{10}\left( \min \left\{ \tilde{x}_{i} : 1 \leq i \leq m \right\} \right) }\rfloor .\]- Parameters:
x (float) – The decimal number that must be representable for the computed decimal scale.
- Returns:
The decimal scale.
utils.ptransf_utils module
- class utils.ptransf_utils.PtransfUtils
Bases:
object- Author:
Alberto M. Esmoris Pena
Class with util static methods to work with point transformers.
- static extract_ptransf_class(spec)
Extract the point transformer’s class from the key-word specification.
- Parameters:
spec – The key-word specification.
- Returns:
Class representing/realizing a point transformer.
- Return type:
utils.str_utils module
- class utils.str_utils.StrUtils
Bases:
object- Author:
Alberto M. Esmoris Pena
Class with util static methods to work with strings.
- static to_numpy_expr(expr)
Receive an evaluable expression and replace any call to a standard math function to use numpy aliased as np instead.
- Parameters:
expr (str) – The expression to be numpyfied.
- Returns:
The numpyfied expression.
utils.sys_utils module
- class utils.sys_utils.SysUtils
Bases:
object- Author:
Alberto M. Esmoris Pena
Class with util static methods related to the system where the VL3D framework is run.
- static get_sys_mem()
Obtain the system memory, in bytes.
- Returns:
System memory, in bytes.
- Return type:
int
- static get_sys_threads()
Obtain the maximum number of parallel threads.
- Returns:
Maximum number of parallel threads.
- Return type:
int
- static validate_requested_threads(nthreads, warning=True, raise_exception=False, caller='CALLER')
Validate that the number of threads (nthreads) is not greater than the number of available threads.
- Parameters:
nthreads (int) – The number of threads.
warning (bool) – Flag to control whether to emit a warning message through the logging system (True) or not (False).
raise_exception (bool) – Flag to control whether to raise a exception when
caller (str or class) – The method’s caller. It can be either the name or the class.
utils.tuner_utils module
- class utils.tuner_utils.TunerUtils
Bases:
object- Author:
Alberto M. Esmoris Pena
Class with util static methods to work with model tuners.
Module contents
- author:
Alberto M. Esmoris Pena
The utils package contains common utils to assist the development of the many components.