| Did you know ... | Search Documentation: |
| Pack logtalk -- logtalk-3.100.1/docs/handbook/_sources/libraries/truncated_svd_projection.rst.txt |
.. _library_truncated_svd_projection:
truncated_svd_projection
Truncated singular value decomposition reducer for continuous datasets.
The library implements the dimension_reducer_protocol defined in the
dimension_reduction_protocols library and learns a low-rank linear
projection by building a preprocessed data matrix using optional
centering and scaling, extracting singular triplets using deterministic
two-sided power iteration, and applying rank-one deflation directly to
the data matrix.
Open the `../../apis/library_index.html#truncated_svd_projection <../../apis/library_index.html#truncated_svd_projection>`__ link in a web browser.
To load this library, load the loader.lgt file:
::
| ?- logtalk_load(truncated_svd_projection(loader)).
To test this library predicates, load the tester.lgt file:
::
| ?- logtalk_load(truncated_svd_projection(tester)).
component_N-Value pairs.The learn/3 predicate accepts the following options:
2. Requests that exceed the numerical rank after shape capping
raise domain_error(component_count, Requested-Extracted) instead
of silently returning fewer components.true or false
(default).true or false
(default).1000.1.0e-8.
The learned diagnostics also include:
convergence(Statuses): Per-component stop reasons, such as
tolerance or maximum_iterations_exhausted.iterations(Counts): Per-component iteration counts aligned with
the extracted singular vectors.final_delta(Deltas): Per-component final update magnitudes aligned
with the extracted singular vectors.
The following examples use the sample datasets shipped with the
dimension_reduction_protocols library:
::
| ?- logtalk_load(dimension_reduction_protocols('test_datasets/low_rank_rectangular')).
Learning a reducer ~~~~~~~~~~~~~~~~~~
::
| ?- truncated_svd_projection::learn(low_rank_rectangular, DimensionReducer).
| ?- truncated_svd_projection::learn(low_rank_rectangular, DimensionReducer, [n_components(1), center(false), feature_scaling(false), maximum_iterations(200), tolerance(1.0e-7)]).
Transforming new instances ~~~~~~~~~~~~~~~~~~~~~~~~~~
::
| ?- truncated_svd_projection::learn(low_rank_rectangular, DimensionReducer),
truncated_svd_projection::transform(DimensionReducer, [f1-1.0, f2-1.0, f3-2.0], ReducedInstance).
Exporting and reusing the reducer ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
| ?- truncated_svd_projection::learn(low_rank_rectangular, DimensionReducer, [n_components(1)]),
truncated_svd_projection::export_to_file(low_rank_rectangular, DimensionReducer, reducer, 'truncated_svd_reducer.pl').
| ?- logtalk_load('truncated_svd_reducer.pl'),
reducer(Reducer),
truncated_svd_projection::transform(Reducer, [f1-1.0, f2-1.0, f3-2.0], ReducedInstance).
The learned dimension reducer is represented by a compound term with the functor chosen by the implementation and arity 4. For example:
::
truncated_svd_reducer(Encoders, Components, SingularValues, Diagnostics)
Where:
Encoders: List of continuous attribute encoders storing attribute
name, centering offset, and scale factor.Components: List of right singular vectors in descending
singular-value order.SingularValues: List of singular values matching the extracted
components.Diagnostics: Learned reducer metadata including the effective
training options, singular values, and per-component convergence
information.