src.utils.ftransf.feature_transformer
Classes
|
Exceptions
|
- exception src.utils.ftransf.feature_transformer.FeatureTransformerException(message='')
- Author:
Alberto M. Esmoris Pena
Class for exceptions related to feature transformation components. See
VL3DException- __init__(message='')
- class src.utils.ftransf.feature_transformer.FeatureTransformer(**kwargs)
- Author:
Alberto M. Esmoris Pena
Class for feature transformation operations.
- Variables:
fnames (list or tuple) – The names of the features to be transformed (by default).
report_path (str) – The path to write the report file reporting the behavior of the transformer.
plot_path (str) – The path to write the plot file. From some feature transformers it might be the path to the directory where many plots will be stored.
selected_features (list) – Either boolean mask or list of indices corresponding to the selected features (columns of the feature matrix).
update_and_preserve (bool) – Boolean flag to control whether to discard all features but the transformed/updated ones (False, default) or to update the transformed features and preserve all the other features (True).
- static extract_ftransf_args(spec)
Extract the arguments to initialize/instantiate a FeatureTransformer from a key-word specification.
- Parameters:
spec – The key-word specification containing the arguments.
- Returns:
The arguments to initialize/instantiate a FeatureTransformer.
- __init__(**kwargs)
Initialize/instantiate a FeatureTransformer.
- Parameters:
kwargs – The attributes for the FeatureTransformer.
- abstractmethod transform(F, y=None, fnames=None, out_prefix=None)
The fundamental transformation logic defining the feature transformer.
- Parameters:
F (
np.ndarray) – The input matrix of features to be transformed.y (
np.ndarray) – The vector of point-wise classes.fnames (list or tuple) – The list of features to be transformed. If None, it will be taken from the internal fnames of the feature transformer. If those are None too, then an exception will raise.
out_prefix (str) – The output prefix (OPTIONAL). It might be used by a report to particularize the output path.
- Returns:
The transformed matrix of features.
- Return type:
np.ndarray
- transform_pcloud(pcloud, fnames=None, out_prefix=None)
Apply the transform method to a point cloud.
See
feature_transformer.FeatureTransformer.transform()- Parameters:
pcloud (
PointCloud) – The point cloud to be transformed.fnames (list or tuple) – The list of features to be transformed. If None, it will be taken from the internal fnames of the feature transformer. If those are None too, then an exception will raise.
out_prefix (str) – The output prefix (OPTIONAL). It might be used by a report to particularize the output path.
- Returns:
A new point cloud that is the transformed version of the input point cloud.
- Return type:
- report(report, out_prefix=None)
Handle the way a report is reported. First, it will be reported using the logging system. Then, it will be written to a file if the transformer has a not None report_path.
- Parameters:
report – The report to be reported.
out_prefix – The output prefix in case the output path must be expanded.
- Returns:
Nothing.
- build_new_las_header(pcloud)
Build the LAS header for the output point cloud.
See
PointCloudandfeature_transformer.FeatureTransformer.transform_pcloud().- Parameters:
pcloud (
PointCloud) – The input point cloud as reference to build the header for the new point cloud.- Returns:
The LAS header for the output point cloud.
- get_names_of_transformed_features(**kwargs)
Obtain the names that correspond to the transformed features.
- Returns:
The list of strings representing the names of the transformed features.
- Return type:
list
- safely_handle_fnames(fnames=None)
Handle given fnames in a safe-way, i.e., raising an exception if no valid fnames cannot be figured out from given input and the current state of the internal variables.
- Parameters:
fnames (list of str) – Given input feature names.
- Returns:
The handled feature names.
- Return type:
list of str