Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
d69a1c95
Commit
d69a1c95
authored
Mar 02, 2013
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added an overload of cca() that can take random_subset_selector objects.
parent
0a9411bf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
0 deletions
+49
-0
cca.h
dlib/statistics/cca.h
+17
-0
cca_abstract.h
dlib/statistics/cca_abstract.h
+32
-0
No files found.
dlib/statistics/cca.h
View file @
d69a1c95
...
...
@@ -7,6 +7,7 @@
#include "../algs.h"
#include "../matrix.h"
#include "../sparse_vector.h"
#include "random_subset_selector.h"
namespace
dlib
{
...
...
@@ -152,6 +153,22 @@ namespace dlib
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 @@
#ifdef DLIB_CCA_AbSTRACT_H__
#include "../matrix/matrix_la_abstract.h"
#include "random_subset_selector_abstract.h"
namespace
dlib
{
...
...
@@ -129,6 +130,37 @@ namespace dlib
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