fast_psa: Probabilistic Latent Semantic Analysis

Description Usage Arguments Details Value References Examples

View source: R/svs.r

Description

A fast procedure for computing probabilistic latent semantic analysis.

Usage

1
2
3
4
5
6
7
fast_psa(dat, k, symmetric = FALSE, transform = 1, tol = 1e-08)

fast_psi(dat, k, symmetric = FALSE, transform = 1, tol = 1e-08)

fast_plsa(dat, k, symmetric = FALSE, transform = 1, tol = 1e-08)

fast_plsi(dat, k, symmetric = FALSE, transform = 1, tol = 1e-08)

Arguments

dat

Input data: can be a table or a data frame (but the data frame must have only two columns).

k

Numeric specification of the number of latent classes to compute.

symmetric

Logical indicating whether to compute the symmetric or the asymmetric solution.

transform

Numeric specification of the "tempering" transformation as explained in Hofmann (1999: 51-52).

tol

Numeric specification of the convergence criterion.

Details

From version 1.1.0 of the svs package on, probabilistic latent semantic analysis is a special case of latent class analysis.

Value

A list with components:

prob0

The probabilities of the latent classes.

prob1

The probabilities for the first set of levels (viz. the row levels of a frequency table). The rows of prob1 sum to 1 if symmetric = FALSE, the columns sum to 1 if symmetric = TRUE.

prob2

The probabilities for the second set of levels (viz. the column levels of a frequency table). The columns of prob2 sum to 1.

References

Hofmann, Th. (1999). Probabilistic latent semantic indexing. SIGIR'99: Proceedings of the 22nd annual international SIGIR conference on research and development in information retrieval, 50–57.

Examples

1
2
3
4
5
SndT_Fra <- read.table(system.file("extdata", "SndT_Fra.txt", package = "svs"),
   header = TRUE, sep = "\t", quote = "\"", encoding = "UTF-8",
   stringsAsFactors = FALSE)
psa.SndT_Fra <- fast_psa(SndT_Fra, k = 7)
psa.SndT_Fra

Example output

$prob0
[1] 0.22995445 0.22494661 0.21102856 0.13517149 0.10818295 0.06968235 0.02103360

$prob1
                           1             2             3          4
aanvang         0.000000e+00  1.147010e-98  3.835355e-04 0.00000000
begin          5.220146e-287  1.232633e-25  1.000000e+00 0.00000000
beginnen        2.746268e-02  7.956513e-01  4.212875e-02 0.01215805
eerst           9.376642e-01  4.137597e-02  2.095987e-02 0.00000000
gaan           6.712619e-285  1.235050e-01  0.000000e+00 0.00000000
komen           1.203333e-74  9.102385e-16 1.669604e-290 0.00000000
krijgen         1.488922e-01 3.751130e-211  0.000000e+00 0.00000000
ontstaan        6.500000e-01 1.973994e-160  1.672486e-01 0.00000000
openen          1.000000e+00 9.654997e-132  0.000000e+00 0.00000000
oprichten       0.000000e+00  1.076755e-71  0.000000e+00 0.00000000
opstarten      1.897119e-305  4.555378e-11 3.349381e-280 0.00000000
opzetten        5.029269e-01  2.074925e-16  0.000000e+00 0.00000000
start           0.000000e+00  3.622206e-95  8.619168e-01 0.00000000
starten         6.095142e-02  4.767526e-01  3.833153e-05 0.02000000
van start gaan 1.506560e-314  2.610802e-01 2.163344e-243 0.00000000
vanaf           0.000000e+00  0.000000e+00  0.000000e+00 1.00000000
worden          0.000000e+00  5.807865e-01  0.000000e+00 0.00000000
                           5             6             7
aanvang        5.420844e-128  4.160617e-02  9.580103e-01
begin           1.224847e-81 2.541888e-161  5.780879e-22
beginnen        1.082085e-01  1.223045e-02  2.160314e-03
eerst          3.055509e-227 4.091921e-230  1.266778e-28
gaan            7.800066e-01  9.648843e-02  0.000000e+00
komen           5.216735e-24  1.000000e+00 4.508937e-290
krijgen         1.564432e-01  6.946646e-01  0.000000e+00
ontstaan       3.553722e-205 1.099439e-282  1.827514e-01
openen          8.416589e-36 5.325830e-115  0.000000e+00
oprichten       1.000000e+00 1.015665e-128  5.662009e-35
opstarten       1.000000e+00 3.957306e-111 8.123207e-102
opzetten        4.970731e-01 5.684401e-140  0.000000e+00
start           1.380832e-01 1.058162e-136  3.635909e-18
starten         4.002108e-01  1.243751e-02  2.960936e-02
van start gaan  6.489076e-01  9.001223e-02 5.148050e-115
vanaf           0.000000e+00  0.000000e+00  0.000000e+00
worden          5.792672e-25  4.192135e-01  1.755465e-79

$prob2
                             1            2             3             4
<U+00E0> partir de 4.663579e-290 1.480936e-09 8.039300e-255  1.000000e+00
commencer         2.727142e-02 6.274856e-01  1.021747e-02 7.548992e-289
d'abord           5.264036e-01 1.043558e-06 3.868479e-215 2.185659e-304
d<U+00E9>but        4.484207e-41 7.827707e-09  9.746842e-01 4.226717e-290
d<U+00E9>butant    9.272764e-260 2.989576e-02 4.736897e-258 5.562744e-270
d<U+00E9>buter     4.803383e-295 1.314945e-01  1.149707e-02 3.956595e-291
d<U+00E9>marrer    3.439553e-245 5.356274e-04 6.934479e-264 2.950312e-268
entamer          2.765778e-201 1.075287e-01 1.486189e-230 2.248875e-283
entreprendre      0.000000e+00 9.048784e-03 6.051877e-232 5.164837e-307
entrer           1.082745e-290 1.609449e-08 6.965526e-245 3.967685e-294
lancer            3.084002e-03 8.701817e-09  3.601260e-03 2.125848e-295
lancer, se       2.625972e-176 4.145958e-02 9.256895e-253 8.104435e-305
mettre, se       2.667954e-322 2.495021e-02 2.833912e-238 1.664156e-314
ouvrir            4.432410e-01 7.833559e-04 2.429861e-236 7.487267e-276
partir           6.072495e-316 2.010765e-10 3.455134e-138 1.722331e-304
prendre cours     0.000000e+00 1.186889e-02 5.632793e-221 2.915840e-303
recommencer       0.000000e+00 1.494788e-02 2.752016e-255 3.952525e-323
                             5             6             7
<U+00E0> partir de  1.666026e-62 1.685130e-246 9.630925e-212
commencer         3.081703e-02  4.458554e-02 2.568120e-165
d'abord           5.005686e-93 1.582930e-254 1.321238e-266
d<U+00E9>but        5.935367e-62 7.323496e-234  7.080167e-01
d<U+00E9>butant     1.332966e-27 1.052884e-232 2.656229e-174
d<U+00E9>buter      9.288251e-02  3.281865e-02  3.406582e-02
d<U+00E9>marrer     2.257621e-01  2.415537e-02 1.597214e-168
entamer           6.213263e-02 6.293626e-126  2.249888e-01
entreprendre      2.469864e-02 9.177636e-160 3.285326e-303
entrer            7.234871e-23  7.527674e-01  1.370128e-15
lancer            2.633997e-01  6.217839e-02 3.614493e-178
lancer, se        2.568536e-02  4.289907e-64 6.964590e-241
mettre, se        1.129988e-01  7.215336e-02 1.559790e-310
ouvrir            1.266637e-32  1.134124e-02  2.499482e-68
partir            1.616232e-01 1.041371e-153 7.797240e-229
prendre cours     3.812971e-98 9.844292e-231  3.292864e-02
recommencer      2.922057e-114  2.437341e-60 7.539936e-320

svs documentation built on Nov. 10, 2020, 1:09 a.m.