Skip to content

Commit 9f2212a

Browse files
committed
set indentation to 4 spaces.
1 parent f6cc8fe commit 9f2212a

File tree

3 files changed

+590
-576
lines changed

3 files changed

+590
-576
lines changed

src/models/decomposition_models.jl

Lines changed: 83 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,8 @@ MMI.fitted_params(::ICA, fr) = (projection=copy(fr.W), mean = copy(MS.mean(fr)))
284284
285285
$(MMI.doc_header(PCA))
286286
287-
Principal component analysis learns a linear projection onto a lower dimensional space while
288-
preserving most of the initial variance seen in the training data.
287+
Principal component analysis learns a linear projection onto a lower dimensional space
288+
while preserving most of the initial variance seen in the training data.
289289
290290
# Training data
291291
@@ -321,37 +321,38 @@ Train the machine using `fit!(mach, rows=...)`.
321321
dimension and otherwise use `:svd`
322322
323323
- `mean=nothing`: if `nothing`, centering will be computed and applied, if set to `0` no
324-
centering (data is assumed pre-centered); if a vector is passed, the centering is done
325-
with that vector.
324+
centering (data is assumed pre-centered); if a vector is passed, the centering is done
325+
with that vector.
326326
327327
# Operations
328328
329329
- `transform(mach, Xnew)`: Return a lower dimensional projection of the input `Xnew`, which
330-
should have the same scitype as `X` above.
330+
should have the same scitype as `X` above.
331331
332332
- `inverse_transform(mach, Xsmall)`: For a dimension-reduced table `Xsmall`,
333-
such as returned by `transform`, reconstruct a table, having same the number
334-
of columns as the original training data `X`, that transforms to `Xsmall`.
335-
Mathematically, `inverse_transform` is a right-inverse for the PCA projection
336-
map, whose image is orthogonal to the kernel of that map. In particular, if
337-
`Xsmall = transform(mach, Xnew)`, then `inverse_transform(Xsmall)` is
338-
only an approximation to `Xnew`.
333+
such as returned by `transform`, reconstruct a table, having same the number
334+
of columns as the original training data `X`, that transforms to `Xsmall`.
335+
Mathematically, `inverse_transform` is a right-inverse for the PCA projection
336+
map, whose image is orthogonal to the kernel of that map. In particular, if
337+
`Xsmall = transform(mach, Xnew)`, then `inverse_transform(Xsmall)` is
338+
only an approximation to `Xnew`.
339339
340340
# Fitted parameters
341341
342342
The fields of `fitted_params(mach)` are:
343343
344344
- `projection`: Returns the projection matrix, which has size `(indim, outdim)`, where
345-
`indim` and `outdim` are the number of features of the input and output respectively.
345+
`indim` and `outdim` are the number of features of the input and output respectively.
346346
347347
# Report
348348
349349
The fields of `report(mach)` are:
350350
351-
- `indim`: Dimension (number of columns) of the training data and new data to be transformed.
351+
- `indim`: Dimension (number of columns) of the training data and new data to be
352+
transformed.
352353
353354
- `outdim = min(n, indim, maxoutdim)` is the output dimension; here `n` is the number of
354-
observations.
355+
observations.
355356
356357
- `tprincipalvar`: Total variance of the principal components.
357358
@@ -407,19 +408,19 @@ Train the machine using `fit!(mach, rows=...)`.
407408
# Hyper-parameters
408409
409410
- `maxoutdim=0`: Controls the the dimension (number of columns) of the output,
410-
`outdim`. Specifically, `outdim = min(n, indim, maxoutdim)`, where `n` is the number of
411-
observations and `indim` the input dimension.
411+
`outdim`. Specifically, `outdim = min(n, indim, maxoutdim)`, where `n` is the number of
412+
observations and `indim` the input dimension.
412413
413414
- `kernel::Function=(x,y)->x'y`: The kernel function, takes in 2 vector arguments
414-
x and y, returns a scalar value. Defaults to the dot product of `x` and `y`.
415+
x and y, returns a scalar value. Defaults to the dot product of `x` and `y`.
415416
416417
- `solver::Symbol=:eig`: solver to use for the eigenvalues, one of `:eig`(default, uses
417-
`LinearAlgebra.eigen`), `:eigs`(uses `Arpack.eigs`).
418+
`LinearAlgebra.eigen`), `:eigs`(uses `Arpack.eigs`).
418419
419420
- `inverse::Bool=true`: perform calculations needed for inverse transform
420421
421422
- `beta::Real=1.0`: strength of the ridge regression that learns the inverse transform
422-
when inverse is true.
423+
when inverse is true.
423424
424425
- `tol::Real=0.0`: Convergence tolerance for eigenvalue solver.
425426
@@ -428,28 +429,29 @@ Train the machine using `fit!(mach, rows=...)`.
428429
# Operations
429430
430431
- `transform(mach, Xnew)`: Return a lower dimensional projection of the input `Xnew`, which
431-
should have the same scitype as `X` above.
432+
should have the same scitype as `X` above.
432433
433434
- `inverse_transform(mach, Xsmall)`: For a dimension-reduced table `Xsmall`, such as
434-
returned by `transform`, reconstruct a table, having same the number of columns as the
435-
original training data `X`, that transforms to `Xsmall`. Mathematically,
436-
`inverse_transform` is a right-inverse for the PCA projection map, whose image is
437-
orthogonal to the kernel of that map. In particular, if `Xsmall = transform(mach, Xnew)`,
438-
then `inverse_transform(Xsmall)` is only an approximation to `Xnew`.
435+
returned by `transform`, reconstruct a table, having same the number of columns as the
436+
original training data `X`, that transforms to `Xsmall`. Mathematically,
437+
`inverse_transform` is a right-inverse for the PCA projection map, whose image is
438+
orthogonal to the kernel of that map. In particular, if
439+
`Xsmall = transform(mach, Xnew)`, then `inverse_transform(Xsmall)` is only an
440+
approximation to `Xnew`.
439441
440442
# Fitted parameters
441443
442444
The fields of `fitted_params(mach)` are:
443445
444446
- `projection`: Returns the projection matrix, which has size `(indim, outdim)`, where
445-
`indim` and `outdim` are the number of features of the input and ouput respectively.
447+
`indim` and `outdim` are the number of features of the input and ouput respectively.
446448
447449
# Report
448450
449451
The fields of `report(mach)` are:
450452
451453
- `indim`: Dimension (number of columns) of the training data and new data to be
452-
transformed.
454+
transformed.
453455
454456
- `outdim`: Dimension of transformed data.
455457
@@ -496,15 +498,17 @@ In MLJ or MLJBase, bind an instance `model` to data with
496498
Here:
497499
498500
- `X` is any table of input features (eg, a `DataFrame`) whose columns are of scitype
499-
`Continuous`; check column scitypes with `schema(X)`.
501+
`Continuous`; check column scitypes with `schema(X)`.
500502
501503
Train the machine using `fit!(mach, rows=...)`.
502504
503505
# Hyper-parameters
504506
505-
- `outdim::Int=0`: The number of independent components to recover, set automatically if `0`.
507+
- `outdim::Int=0`: The number of independent components to recover, set automatically
508+
if `0`.
506509
507-
- `alg::Symbol=:fastica`: The algorithm to use (only `:fastica` is supported at the moment).
510+
- `alg::Symbol=:fastica`: The algorithm to use (only `:fastica` is supported at the
511+
moment).
508512
509513
- `fun::Symbol=:tanh`: The approximate neg-entropy function, one of `:tanh`, `:gaus`.
510514
@@ -515,18 +519,18 @@ Train the machine using `fit!(mach, rows=...)`.
515519
- `tol::Real=1e-6`: The convergence tolerance for change in the unmixing matrix W.
516520
517521
- `mean::Union{Nothing, Real, Vector{Float64}}=nothing`: mean to use, if nothing (default)
518-
centering is computed and applied, if zero, no centering; otherwise a vector of means can
519-
be passed.
522+
centering is computed and applied, if zero, no centering; otherwise a vector of means
523+
can be passed.
520524
521-
- `winit::Union{Nothing,Matrix{<:Real}}=nothing`: Initial guess for the unmixing matrix `W`:
522-
either an empty matrix (for random initialization of `W`), a matrix of size `m × k` (if
523-
`do_whiten` is true), or a matrix of size `m × k`. Here `m` is the number of components
524-
(columns) of the input.
525+
- `winit::Union{Nothing,Matrix{<:Real}}=nothing`: Initial guess for the unmixing matrix
526+
`W`: either an empty matrix (for random initialization of `W`), a matrix of size
527+
`m × k` (if `do_whiten` is true), or a matrix of size `m × k`. Here `m` is the number
528+
of components (columns) of the input.
525529
526530
# Operations
527531
528-
- `transform(mach, Xnew)`: Return the component-separated version of input
529-
`Xnew`, which should have the same scitype as `X` above.
532+
- `transform(mach, Xnew)`: Return the component-separated version of input `Xnew`, which
533+
should have the same scitype as `X` above.
530534
531535
# Fitted parameters
532536
@@ -540,7 +544,8 @@ The fields of `fitted_params(mach)` are:
540544
541545
The fields of `report(mach)` are:
542546
543-
- `indim`: Dimension (number of columns) of the training data and new data to be transformed.
547+
- `indim`: Dimension (number of columns) of the training data and new data to be
548+
transformed.
544549
545550
- `outdim`: Dimension of transformed data.
546551
@@ -593,9 +598,9 @@ ICA
593598
$(MMI.doc_header(FactorAnalysis))
594599
595600
Factor analysis is a linear-Gaussian latent variable model that is closely related to
596-
probabilistic PCA. In contrast to the probabilistic PCA model, the covariance of conditional
597-
distribution of the observed variable given the latent variable is diagonal rather than
598-
isotropic.
601+
probabilistic PCA. In contrast to the probabilistic PCA model, the covariance of
602+
conditional distribution of the observed variable given the latent variable is diagonal
603+
rather than isotropic.
599604
600605
# Training data
601606
@@ -606,7 +611,7 @@ In MLJ or MLJBase, bind an instance `model` to data with
606611
Here:
607612
608613
- `X` is any table of input features (eg, a `DataFrame`) whose columns
609-
are of scitype `Continuous`; check column scitypes with `schema(X)`.
614+
are of scitype `Continuous`; check column scitypes with `schema(X)`.
610615
611616
Train the machine using `fit!(mach, rows=...)`.
612617
@@ -615,8 +620,8 @@ Train the machine using `fit!(mach, rows=...)`.
615620
- `method::Symbol=:cm`: Method to use to solve the problem, one of `:ml`, `:em`, `:bayes`.
616621
617622
- `maxoutdim=0`: Controls the the dimension (number of columns) of the output,
618-
`outdim`. Specifically, `outdim = min(n, indim, maxoutdim)`, where `n` is the number of
619-
observations and `indim` the input dimension.
623+
`outdim`. Specifically, `outdim = min(n, indim, maxoutdim)`, where `n` is the number of
624+
observations and `indim` the input dimension.
620625
621626
- `maxiter::Int=1000`: Maximum number of iterations.
622627
@@ -625,35 +630,36 @@ Train the machine using `fit!(mach, rows=...)`.
625630
- `eta::Real=tol`: Variance lower bound.
626631
627632
- `mean::Union{Nothing, Real, Vector{Float64}}=nothing`: If `nothing`, centering will be
628-
computed and applied; if set to `0` no centering is applied (data is assumed
629-
pre-centered); if a vector, the centering is done with that vector.
633+
computed and applied; if set to `0` no centering is applied (data is assumed
634+
pre-centered); if a vector, the centering is done with that vector.
630635
631636
# Operations
632637
633638
- `transform(mach, Xnew)`: Return a lower dimensional projection of the input `Xnew`, which
634-
should have the same scitype as `X` above.
639+
should have the same scitype as `X` above.
635640
636641
- `inverse_transform(mach, Xsmall)`: For a dimension-reduced table `Xsmall`,
637-
such as returned by `transform`, reconstruct a table, having same the number
638-
of columns as the original training data `X`, that transforms to `Xsmall`.
639-
Mathematically, `inverse_transform` is a right-inverse for the PCA projection
640-
map, whose image is orthogonal to the kernel of that map. In particular, if
641-
`Xsmall = transform(mach, Xnew)`, then `inverse_transform(Xsmall)` is
642-
only an approximation to `Xnew`.
642+
such as returned by `transform`, reconstruct a table, having same the number
643+
of columns as the original training data `X`, that transforms to `Xsmall`.
644+
Mathematically, `inverse_transform` is a right-inverse for the PCA projection
645+
map, whose image is orthogonal to the kernel of that map. In particular, if
646+
`Xsmall = transform(mach, Xnew)`, then `inverse_transform(Xsmall)` is
647+
only an approximation to `Xnew`.
643648
644649
# Fitted parameters
645650
646651
The fields of `fitted_params(mach)` are:
647652
648653
- `projection`: Returns the projection matrix, which has size `(indim, outdim)`, where
649-
`indim` and `outdim` are the number of features of the input and ouput respectively.
650-
Each column of the projection matrix corresponds to a factor.
654+
`indim` and `outdim` are the number of features of the input and ouput respectively.
655+
Each column of the projection matrix corresponds to a factor.
651656
652657
# Report
653658
654659
The fields of `report(mach)` are:
655660
656-
- `indim`: Dimension (number of columns) of the training data and new data to be transformed.
661+
- `indim`: Dimension (number of columns) of the training data and new data to be
662+
transformed.
657663
658664
- `outdim`: Dimension of transformed data (number of factors).
659665
@@ -706,59 +712,61 @@ In MLJ or MLJBase, bind an instance `model` to data with
706712
Here:
707713
708714
- `X` is any table of input features (eg, a `DataFrame`) whose columns are of scitype
709-
`Continuous`; check column scitypes with `schema(X)`.
715+
`Continuous`; check column scitypes with `schema(X)`.
710716
711717
Train the machine using `fit!(mach, rows=...)`.
712718
713719
# Hyper-parameters
714720
715721
- `maxoutdim=0`: Controls the the dimension (number of columns) of the output,
716-
`outdim`. Specifically, `outdim = min(n, indim, maxoutdim)`, where `n` is the number of
717-
observations and `indim` the input dimension.
722+
`outdim`. Specifically, `outdim = min(n, indim, maxoutdim)`, where `n` is the number of
723+
observations and `indim` the input dimension.
718724
719725
- `method::Symbol=:ml`: The method to use to solve the problem, one of `:ml`, `:em`,
720-
`:bayes`.
726+
`:bayes`.
721727
722728
- `maxiter::Int=1000`: The maximum number of iterations.
723729
724730
- `tol::Real=1e-6`: The convergence tolerance.
725731
726732
- `mean::Union{Nothing, Real, Vector{Float64}}=nothing`: If `nothing`, centering will be
727-
computed and applied; if set to `0` no centering is applied (data is assumed
728-
pre-centered); if a vector, the centering is done with that vector.
733+
computed and applied; if set to `0` no centering is applied (data is assumed
734+
pre-centered); if a vector, the centering is done with that vector.
729735
730736
# Operations
731737
732738
- `transform(mach, Xnew)`: Return a lower dimensional projection of the input `Xnew`, which
733-
should have the same scitype as `X` above.
739+
should have the same scitype as `X` above.
734740
735741
- `inverse_transform(mach, Xsmall)`: For a dimension-reduced table `Xsmall`,
736-
such as returned by `transform`, reconstruct a table, having same the number
737-
of columns as the original training data `X`, that transforms to `Xsmall`.
738-
Mathematically, `inverse_transform` is a right-inverse for the PCA projection
739-
map, whose image is orthogonal to the kernel of that map. In particular, if
740-
`Xsmall = transform(mach, Xnew)`, then `inverse_transform(Xsmall)` is
741-
only an approximation to `Xnew`.
742+
such as returned by `transform`, reconstruct a table, having same the number
743+
of columns as the original training data `X`, that transforms to `Xsmall`.
744+
Mathematically, `inverse_transform` is a right-inverse for the PCA projection
745+
map, whose image is orthogonal to the kernel of that map. In particular, if
746+
`Xsmall = transform(mach, Xnew)`, then `inverse_transform(Xsmall)` is
747+
only an approximation to `Xnew`.
742748
743749
# Fitted parameters
744750
745751
The fields of `fitted_params(mach)` are:
746752
747753
- `projection`: Returns the projection matrix, which has size `(indim, outdim)`, where
748-
`indim` and `outdim` are the number of features of the input and ouput respectively.
749-
Each column of the projection matrix corresponds to a principal component.
754+
`indim` and `outdim` are the number of features of the input and ouput respectively.
755+
Each column of the projection matrix corresponds to a principal component.
750756
751757
# Report
752758
753759
The fields of `report(mach)` are:
754760
755-
- `indim`: Dimension (number of columns) of the training data and new data to be transformed.
761+
- `indim`: Dimension (number of columns) of the training data and new data to be
762+
transformed.
763+
756764
- `outdim`: Dimension of transformed data.
757765
758766
- `tvat`: The variance of the components.
759767
760-
- `loadings`: The models loadings, weights for each variable used when calculating principal
761-
components.
768+
- `loadings`: The models loadings, weights for each variable used when calculating
769+
principal components.
762770
763771
# Examples
764772

0 commit comments

Comments
 (0)