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
79656869
Commit
79656869
authored
Dec 13, 2012
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplified CLI code
parent
25bf3c51
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
25 deletions
+25
-25
common.h
tools/mltool/src/common.h
+1
-1
main.cpp
tools/mltool/src/main.cpp
+5
-5
option_range.cpp
tools/mltool/src/option_range.cpp
+1
-1
option_range.h
tools/mltool/src/option_range.h
+1
-1
regression.cpp
tools/mltool/src/regression.cpp
+13
-13
regression.h
tools/mltool/src/regression.h
+4
-4
No files found.
tools/mltool/src/common.h
View file @
79656869
...
...
@@ -12,8 +12,8 @@
#include "dlib/matrix.h"
typedef
dlib
::
cmd_line_parser
<
char
>::
check_1a_c
clp
;
using
dlib
::
command_line_parser
;
typedef
std
::
map
<
unsigned
long
,
double
>
sparse_sample_type
;
typedef
dlib
::
matrix
<
sparse_sample_type
::
value_type
::
second_type
,
0
,
1
>
dense_sample_type
;
...
...
tools/mltool/src/main.cpp
View file @
79656869
...
...
@@ -16,6 +16,7 @@
#include <vector>
#include "dlib/cmd_line_parser.h"
#include "dlib/data_io.h"
#include "dlib/svm.h"
...
...
@@ -24,7 +25,7 @@ using namespace dlib;
// ----------------------------------------------------------------------------------------
static
void
parse_args
(
c
lp
&
parser
,
int
argc
,
char
*
argv
[])
parse_args
(
c
ommand_line_parser
&
parser
,
int
argc
,
char
*
argv
[])
{
try
{
// Algorithm-independent options
...
...
@@ -107,18 +108,16 @@ parse_args (clp& parser, int argc, char* argv[])
int
main
(
int
argc
,
char
*
argv
[])
{
c
lp
parser
;
c
ommand_line_parser
parser
;
parse_args
(
parser
,
argc
,
argv
);
const
clp
::
option_type
&
option_alg
=
parser
.
option
(
"a"
);
const
clp
::
option_type
&
option_in
=
parser
.
option
(
"in"
);
std
::
vector
<
sparse_sample_type
>
sparse_samples
;
std
::
vector
<
double
>
labels
;
load_libsvm_formatted_data
(
option_in
.
argument
(),
parser
.
option
(
"in"
)
.
argument
(),
sparse_samples
,
labels
);
...
...
@@ -155,6 +154,7 @@ main (int argc, char* argv[])
// Randomize the order of the samples, labels
randomize_samples
(
dense_samples
,
labels
);
const
command_line_parser
::
option_type
&
option_alg
=
parser
.
option
(
"a"
);
if
(
!
option_alg
)
{
// Do KRR if user didn't specify an algorithm
std
::
cout
<<
"No algorithm specified, default to KRR
\n
"
;
...
...
tools/mltool/src/option_range.cpp
View file @
79656869
...
...
@@ -21,7 +21,7 @@ exp10_ (double m)
void
option_range
::
set_option
(
c
lp
&
parser
,
c
ommand_line_parser
&
parser
,
std
::
string
const
&
option
,
float
default_val
)
...
...
tools/mltool/src/option_range.h
View file @
79656869
...
...
@@ -32,7 +32,7 @@ public:
max_value
=
100
;
incr
=
10
;
}
void
set_option
(
c
lp
&
parser
,
std
::
string
const
&
option
,
void
set_option
(
c
ommand_line_parser
&
parser
,
std
::
string
const
&
option
,
float
default_val
);
float
get_min_value
();
float
get_max_value
();
...
...
tools/mltool/src/regression.cpp
View file @
79656869
...
...
@@ -20,7 +20,7 @@ using namespace std;
static
const
char
*
get_kernel
(
c
lp
&
parser
c
ommand_line_parser
&
parser
)
{
const
char
*
kernel
=
"rbk"
;
...
...
@@ -34,7 +34,7 @@ get_kernel (
static
void
get_rbk_gamma
(
c
lp
&
parser
,
c
ommand_line_parser
&
parser
,
std
::
vector
<
dense_sample_type
>&
dense_samples
,
option_range
&
range
)
{
...
...
@@ -47,7 +47,7 @@ get_rbk_gamma (
static
void
get_krls_tolerance
(
c
lp
&
parser
,
c
ommand_line_parser
&
parser
,
std
::
vector
<
dense_sample_type
>&
dense_samples
,
option_range
&
range
)
...
...
@@ -60,7 +60,7 @@ get_krls_tolerance (
static
double
get_mlp_hidden_units
(
c
lp
&
parser
,
c
ommand_line_parser
&
parser
,
std
::
vector
<
dense_sample_type
>&
dense_samples
)
{
...
...
@@ -75,7 +75,7 @@ get_mlp_hidden_units (
static
double
get_mlp_num_iterations
(
c
lp
&
parser
,
c
ommand_line_parser
&
parser
,
std
::
vector
<
dense_sample_type
>&
dense_samples
)
{
...
...
@@ -90,7 +90,7 @@ get_mlp_num_iterations (
static
void
get_svr_c
(
c
lp
&
parser
,
c
ommand_line_parser
&
parser
,
std
::
vector
<
dense_sample_type
>&
dense_samples
,
option_range
&
range
)
...
...
@@ -103,7 +103,7 @@ get_svr_c (
static
double
get_svr_epsilon_insensitivity
(
c
lp
&
parser
,
c
ommand_line_parser
&
parser
,
std
::
vector
<
dense_sample_type
>&
dense_samples
)
{
...
...
@@ -125,7 +125,7 @@ get_svr_epsilon_insensitivity (
void
krls_test
(
c
lp
&
parser
,
c
ommand_line_parser
&
parser
,
std
::
vector
<
dense_sample_type
>&
dense_samples
,
std
::
vector
<
double
>&
labels
)
...
...
@@ -176,7 +176,7 @@ krls_test (
static
void
krr_rbk_test
(
c
lp
&
parser
,
c
ommand_line_parser
&
parser
,
std
::
vector
<
dense_sample_type
>&
dense_samples
,
std
::
vector
<
double
>&
labels
)
...
...
@@ -229,7 +229,7 @@ krr_rbk_test (
static
void
krr_lin_test
(
c
lp
&
parser
,
c
ommand_line_parser
&
parser
,
std
::
vector
<
dense_sample_type
>&
dense_samples
,
std
::
vector
<
double
>&
labels
)
...
...
@@ -250,7 +250,7 @@ krr_lin_test (
void
krr_test
(
c
lp
&
parser
,
c
ommand_line_parser
&
parser
,
std
::
vector
<
dense_sample_type
>&
dense_samples
,
std
::
vector
<
double
>&
labels
)
...
...
@@ -271,7 +271,7 @@ krr_test (
void
mlp_test
(
c
lp
&
parser
,
c
ommand_line_parser
&
parser
,
std
::
vector
<
dense_sample_type
>&
dense_samples
,
std
::
vector
<
double
>&
labels
)
...
...
@@ -321,7 +321,7 @@ mlp_test (
void
svr_test
(
c
lp
&
parser
,
c
ommand_line_parser
&
parser
,
std
::
vector
<
dense_sample_type
>&
dense_samples
,
std
::
vector
<
double
>&
labels
)
...
...
tools/mltool/src/regression.h
View file @
79656869
...
...
@@ -12,28 +12,28 @@
void
krr_test
(
c
lp
&
parser
,
c
ommand_line_parser
&
parser
,
std
::
vector
<
dense_sample_type
>&
dense_samples
,
std
::
vector
<
double
>&
labels
);
void
krls_test
(
c
lp
&
parser
,
c
ommand_line_parser
&
parser
,
std
::
vector
<
dense_sample_type
>&
dense_samples
,
std
::
vector
<
double
>&
labels
);
void
mlp_test
(
c
lp
&
parser
,
c
ommand_line_parser
&
parser
,
std
::
vector
<
dense_sample_type
>&
dense_samples
,
std
::
vector
<
double
>&
labels
);
void
svr_test
(
c
lp
&
parser
,
c
ommand_line_parser
&
parser
,
std
::
vector
<
dense_sample_type
>&
dense_samples
,
std
::
vector
<
double
>&
labels
);
...
...
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