Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
d69a1c95
Commit
d69a1c95
authored
Mar 02, 2013
by
Davis King
Browse files
Added an overload of cca() that can take random_subset_selector objects.
parent
0a9411bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
0 deletions
+49
-0
dlib/statistics/cca.h
dlib/statistics/cca.h
+17
-0
dlib/statistics/cca_abstract.h
dlib/statistics/cca_abstract.h
+32
-0
No files found.
dlib/statistics/cca.h
View file @
d69a1c95
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#include "../algs.h"
#include "../algs.h"
#include "../matrix.h"
#include "../matrix.h"
#include "../sparse_vector.h"
#include "../sparse_vector.h"
#include "random_subset_selector.h"
namespace
dlib
namespace
dlib
{
{
...
@@ -152,6 +153,22 @@ namespace dlib
...
@@ -152,6 +153,22 @@ namespace dlib
return
impl_cca
(
L
,
R
,
Ltrans
,
Rtrans
,
num_correlations
,
extra_rank
,
q
,
num_output_correlations
);
return
impl_cca
(
L
,
R
,
Ltrans
,
Rtrans
,
num_correlations
,
extra_rank
,
q
,
num_output_correlations
);
}
}
// ----------------------------------------------------------------------------------------
template
<
typename
sparse_vector_type
,
typename
Rand_type
,
typename
T
>
matrix
<
T
,
0
,
1
>
cca
(
const
random_subset_selector
<
sparse_vector_type
,
Rand_type
>&
L
,
const
random_subset_selector
<
sparse_vector_type
,
Rand_type
>&
R
,
matrix
<
T
>&
Ltrans
,
matrix
<
T
>&
Rtrans
,
unsigned
long
num_correlations
,
unsigned
long
extra_rank
=
5
,
unsigned
long
q
=
2
)
{
return
cca
(
L
.
to_std_vector
(),
R
.
to_std_vector
(),
Ltrans
,
Rtrans
,
num_correlations
,
extra_rank
,
q
);
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
}
}
...
...
dlib/statistics/cca_abstract.h
View file @
d69a1c95
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
#ifdef DLIB_CCA_AbSTRACT_H__
#ifdef DLIB_CCA_AbSTRACT_H__
#include "../matrix/matrix_la_abstract.h"
#include "../matrix/matrix_la_abstract.h"
#include "random_subset_selector_abstract.h"
namespace
dlib
namespace
dlib
{
{
...
@@ -129,6 +130,37 @@ namespace dlib
...
@@ -129,6 +130,37 @@ namespace dlib
sparse_matrix_vector_multiply(trans(Ltrans), your_sparse_vector)
sparse_matrix_vector_multiply(trans(Ltrans), your_sparse_vector)
!*/
!*/
// ----------------------------------------------------------------------------------------
template
<
typename
sparse_vector_type
,
typename
Rand_type
,
typename
T
>
matrix
<
T
,
0
,
1
>
cca
(
const
random_subset_selector
<
sparse_vector_type
,
Rand_type
>&
L
,
const
random_subset_selector
<
sparse_vector_type
,
Rand_type
>&
R
,
matrix
<
T
>&
Ltrans
,
matrix
<
T
>&
Rtrans
,
unsigned
long
num_correlations
,
unsigned
long
extra_rank
=
5
,
unsigned
long
q
=
2
);
/*!
requires
- num_correlations > 0
- L.size() == R.size()
- max_index_plus_one(L) > 0 && max_index_plus_one(R) > 0
(i.e. L and R can't represent empty matrices)
- L and R must contain sparse vectors (see the top of dlib/svm/sparse_vector_abstract.h
for a definition of sparse vector)
ensures
- returns cca(L.to_std_vector(), R.to_std_vector(), Ltrans, Rtrans, num_correlations, extra_rank, q)
(i.e. this is just a convenience function for calling the cca() routine when
your sparse vectors are contained inside a random_subset_selector rather than
a std::vector)
!*/
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment