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
313bca15
Commit
313bca15
authored
Apr 27, 2013
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added linear SVM binding
parent
859ccf5e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
18 deletions
+65
-18
svm_c_trainer.cpp
tools/python/src/svm_c_trainer.cpp
+65
-18
No files found.
tools/python/src/svm_c_trainer.cpp
View file @
313bca15
...
...
@@ -83,7 +83,16 @@ class_<trainer_type> setup_trainer (
.
def
(
"set_c"
,
set_c
<
trainer_type
>
)
.
add_property
(
"c_class1"
,
get_c_class1
<
trainer_type
>
,
set_c_class1
<
trainer_type
>
)
.
add_property
(
"c_class2"
,
get_c_class2
<
trainer_type
>
,
set_c_class2
<
trainer_type
>
)
.
add_property
(
"epsilon"
,
get_epsilon
<
trainer_type
>
,
set_epsilon
<
trainer_type
>
)
.
add_property
(
"epsilon"
,
get_epsilon
<
trainer_type
>
,
set_epsilon
<
trainer_type
>
);
}
template
<
typename
trainer_type
>
class_
<
trainer_type
>
setup_trainer2
(
const
std
::
string
&
name
)
{
return
setup_trainer
<
trainer_type
>
(
name
)
.
add_property
(
"cache_size"
,
get_cache_size
<
trainer_type
>
,
set_cache_size
<
trainer_type
>
);
}
...
...
@@ -157,23 +166,61 @@ const binary_test _cross_validate_trainer_t (
void
bind_svm_c_trainer
()
{
setup_trainer
<
svm_c_trainer
<
radial_basis_kernel
<
sample_type
>
>
>
(
"svm_c_trainer_radial_basis"
)
.
add_property
(
"gamma"
,
get_gamma
,
set_gamma
);
def
(
"cross_validate_trainer"
,
_cross_validate_trainer
<
svm_c_trainer
<
radial_basis_kernel
<
sample_type
>
>
>
);
def
(
"cross_validate_trainer_threaded"
,
_cross_validate_trainer_t
<
svm_c_trainer
<
radial_basis_kernel
<
sample_type
>
>
>
);
setup_trainer
<
svm_c_trainer
<
sparse_radial_basis_kernel
<
sparse_vect
>
>
>
(
"svm_c_trainer_sparse_radial_basis"
)
.
add_property
(
"gamma"
,
get_gamma
,
set_gamma
);
def
(
"cross_validate_trainer"
,
_cross_validate_trainer
<
svm_c_trainer
<
sparse_radial_basis_kernel
<
sparse_vect
>
>
>
);
def
(
"cross_validate_trainer_threaded"
,
_cross_validate_trainer_t
<
svm_c_trainer
<
sparse_radial_basis_kernel
<
sparse_vect
>
>
>
);
setup_trainer
<
svm_c_trainer
<
histogram_intersection_kernel
<
sample_type
>
>
>
(
"svm_c_trainer_histogram_intersection"
);
def
(
"cross_validate_trainer"
,
_cross_validate_trainer
<
svm_c_trainer
<
histogram_intersection_kernel
<
sample_type
>
>
>
);
def
(
"cross_validate_trainer_threaded"
,
_cross_validate_trainer_t
<
svm_c_trainer
<
histogram_intersection_kernel
<
sample_type
>
>
>
);
setup_trainer
<
svm_c_trainer
<
sparse_histogram_intersection_kernel
<
sparse_vect
>
>
>
(
"svm_c_trainer_sparse_histogram_intersection"
);
def
(
"cross_validate_trainer"
,
_cross_validate_trainer
<
svm_c_trainer
<
sparse_histogram_intersection_kernel
<
sparse_vect
>
>
>
);
def
(
"cross_validate_trainer_threaded"
,
_cross_validate_trainer_t
<
svm_c_trainer
<
sparse_histogram_intersection_kernel
<
sparse_vect
>
>
>
);
{
typedef
svm_c_trainer
<
radial_basis_kernel
<
sample_type
>
>
T
;
setup_trainer2
<
T
>
(
"svm_c_trainer_radial_basis"
)
.
add_property
(
"gamma"
,
get_gamma
,
set_gamma
);
def
(
"cross_validate_trainer"
,
_cross_validate_trainer
<
T
>
);
def
(
"cross_validate_trainer_threaded"
,
_cross_validate_trainer_t
<
T
>
);
}
{
typedef
svm_c_trainer
<
sparse_radial_basis_kernel
<
sparse_vect
>
>
T
;
setup_trainer2
<
T
>
(
"svm_c_trainer_sparse_radial_basis"
)
.
add_property
(
"gamma"
,
get_gamma
,
set_gamma
);
def
(
"cross_validate_trainer"
,
_cross_validate_trainer
<
T
>
);
def
(
"cross_validate_trainer_threaded"
,
_cross_validate_trainer_t
<
T
>
);
}
{
typedef
svm_c_trainer
<
histogram_intersection_kernel
<
sample_type
>
>
T
;
setup_trainer2
<
T
>
(
"svm_c_trainer_histogram_intersection"
);
def
(
"cross_validate_trainer"
,
_cross_validate_trainer
<
T
>
);
def
(
"cross_validate_trainer_threaded"
,
_cross_validate_trainer_t
<
T
>
);
}
{
typedef
svm_c_trainer
<
sparse_histogram_intersection_kernel
<
sparse_vect
>
>
T
;
setup_trainer2
<
T
>
(
"svm_c_trainer_sparse_histogram_intersection"
);
def
(
"cross_validate_trainer"
,
_cross_validate_trainer
<
T
>
);
def
(
"cross_validate_trainer_threaded"
,
_cross_validate_trainer_t
<
T
>
);
}
{
typedef
svm_c_linear_trainer
<
linear_kernel
<
sample_type
>
>
T
;
setup_trainer
<
T
>
(
"svm_c_trainer_linear"
)
.
add_property
(
"max_iterations"
,
&
T
::
get_max_iterations
,
&
T
::
set_max_iterations
)
.
add_property
(
"force_last_weight_to_1"
,
&
T
::
forces_last_weight_to_1
,
&
T
::
force_last_weight_to_1
)
.
add_property
(
"learns_nonnegative_weights"
,
&
T
::
learns_nonnegative_weights
,
&
T
::
set_learns_nonnegative_weights
)
.
def
(
"be_verbose"
,
&
T
::
be_verbose
)
.
def
(
"be_quiet"
,
&
T
::
be_quiet
);
def
(
"cross_validate_trainer"
,
_cross_validate_trainer
<
T
>
);
def
(
"cross_validate_trainer_threaded"
,
_cross_validate_trainer_t
<
T
>
);
}
{
typedef
svm_c_linear_trainer
<
sparse_linear_kernel
<
sparse_vect
>
>
T
;
setup_trainer
<
T
>
(
"svm_c_trainer_sparse_linear"
)
.
add_property
(
"max_iterations"
,
&
T
::
get_max_iterations
,
&
T
::
set_max_iterations
)
.
add_property
(
"force_last_weight_to_1"
,
&
T
::
forces_last_weight_to_1
,
&
T
::
force_last_weight_to_1
)
.
add_property
(
"learns_nonnegative_weights"
,
&
T
::
learns_nonnegative_weights
,
&
T
::
set_learns_nonnegative_weights
)
.
def
(
"be_verbose"
,
&
T
::
be_verbose
)
.
def
(
"be_quiet"
,
&
T
::
be_quiet
);
def
(
"cross_validate_trainer"
,
_cross_validate_trainer
<
T
>
);
def
(
"cross_validate_trainer_threaded"
,
_cross_validate_trainer_t
<
T
>
);
}
}
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