Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Pnria Projet Deeplever
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PNRIA
Global Helper
Pnria Projet Deeplever
Commits
a0b2d351
Commit
a0b2d351
authored
3 years ago
by
Caroline DE POURTALES
Browse files
Options
Downloads
Patches
Plain Diff
update random forest for faster, clean callbacks
parent
a6db2990
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pages/application/RandomForest/utils/options.py
+0
-154
0 additions, 154 deletions
pages/application/RandomForest/utils/options.py
utils.py
+0
-4
0 additions, 4 deletions
utils.py
with
0 additions
and
158 deletions
pages/application/RandomForest/utils/options.py
deleted
100644 → 0
+
0
−
154
View file @
a6db2990
#!/usr/bin/env python
#-*- coding:utf-8 -*-
##
## options.py
##
## Created on: Dec 7, 2018
## Author: Alexey Ignatiev, Nina Narodytska
## E-mail: aignatiev@ciencias.ulisboa.pt, narodytska@vmware.com
##
#
#==============================================================================
from
__future__
import
print_function
import
getopt
import
math
import
os
import
sys
#
#==============================================================================
class
Options
(
object
):
"""
Class for representing command-line options.
"""
def
__init__
(
self
,
command
):
"""
Constructor.
"""
# actions
self
.
train
=
False
self
.
encode
=
'
none
'
self
.
explain
=
''
self
.
xtype
=
'
abd
'
self
.
use_categorical
=
False
# training options
self
.
accmin
=
0.95
self
.
n_estimators
=
100
self
.
maxdepth
=
3
self
.
testsplit
=
0.2
self
.
seed
=
7
# other options
self
.
files
=
None
self
.
output
=
'
Classifiers
'
self
.
mapfile
=
None
self
.
separator
=
'
,
'
self
.
smallest
=
False
self
.
solver
=
'
g3
'
self
.
verb
=
0
if
command
:
self
.
parse
(
command
)
def
parse
(
self
,
command
):
"""
Parser.
"""
self
.
command
=
command
try
:
opts
,
args
=
getopt
.
getopt
(
command
[
1
:],
'
e:hc:d:Mn:o:s:tvx:X:
'
,
[
'
encode=
'
,
'
help
'
,
'
use-categorical=
'
,
'
maxdepth=
'
,
'
minimum
'
,
'
nbestims=
'
,
'
output=
'
,
'
seed=
'
,
'
solver=
'
,
'
testsplit=
'
,
'
train
'
,
'
verbose
'
,
'
explain=
'
,
'
xtype=
'
])
except
getopt
.
GetoptError
as
err
:
sys
.
stderr
.
write
(
str
(
err
).
capitalize
())
self
.
usage
()
sys
.
exit
(
1
)
for
opt
,
arg
in
opts
:
if
opt
in
(
'
-a
'
,
'
--accmin
'
):
self
.
accmin
=
float
(
arg
)
elif
opt
in
(
'
-c
'
,
'
--use-categorical
'
):
self
.
use_categorical
=
True
elif
opt
in
(
'
-d
'
,
'
--maxdepth
'
):
self
.
maxdepth
=
int
(
arg
)
elif
opt
in
(
'
-e
'
,
'
--encode
'
):
self
.
encode
=
str
(
arg
)
elif
opt
in
(
'
-h
'
,
'
--help
'
):
self
.
usage
()
sys
.
exit
(
0
)
elif
opt
in
(
'
-M
'
,
'
--minimum
'
):
self
.
smallest
=
True
elif
opt
in
(
'
-n
'
,
'
--nbestims
'
):
self
.
n_estimators
=
int
(
arg
)
elif
opt
in
(
'
-o
'
,
'
--output
'
):
self
.
output
=
str
(
arg
)
elif
opt
==
'
--seed
'
:
self
.
seed
=
int
(
arg
)
elif
opt
==
'
--sep
'
:
self
.
separator
=
str
(
arg
)
elif
opt
in
(
'
-s
'
,
'
--solver
'
):
self
.
solver
=
str
(
arg
)
elif
opt
==
'
--testsplit
'
:
self
.
testsplit
=
float
(
arg
)
elif
opt
in
(
'
-t
'
,
'
--train
'
):
self
.
train
=
True
elif
opt
in
(
'
-v
'
,
'
--verbose
'
):
self
.
verb
+=
1
elif
opt
in
(
'
-x
'
,
'
--explain
'
):
self
.
explain
=
str
(
arg
)
elif
opt
in
(
'
-X
'
,
'
--xtype
'
):
self
.
xtype
=
str
(
arg
)
else
:
assert
False
,
'
Unhandled option: {0} {1}
'
.
format
(
opt
,
arg
)
if
self
.
encode
==
'
none
'
:
self
.
encode
=
None
self
.
files
=
args
def
usage
(
self
):
"""
Print usage message.
"""
print
(
'
Usage:
'
+
os
.
path
.
basename
(
self
.
command
[
0
])
+
'
[options] input-file
'
)
print
(
'
Options:
'
)
#print(' -a, --accmin=<float> Minimal accuracy')
#print(' Available values: [0.0, 1.0] (default = 0.95)')
#print(' -c, --use-categorical Treat categorical features as categorical (with categorical features info if available)')
print
(
'
-d, --maxdepth=<int> Maximal depth of a tree
'
)
print
(
'
Available values: [1, INT_MAX] (default = 3)
'
)
#print(' -e, --encode=<smt> Encode a previously trained model')
#print(' Available values: sat, maxsat, none (default = none)')
print
(
'
-h, --help Show this message
'
)
#print(' -m, --map-file=<string> Path to a file containing a mapping to original feature values. (default: none)')
#print(' -M, --minimum Compute a smallest size explanation (instead of a subset-minimal one)')
print
(
'
-n, --nbestims=<int> Number of trees in the ensemble
'
)
print
(
'
Available values: [1, INT_MAX] (default = 100)
'
)
print
(
'
-o, --output=<string> Directory where output files will be stored (default:
\'
temp
\'
)
'
)
print
(
'
--seed=<int> Seed for random splitting
'
)
print
(
'
Available values: [1, INT_MAX] (default = 7)
'
)
print
(
'
--sep=<string> Field separator used in input file (default =
\'
,
\'
)
'
)
print
(
'
-s, --solver=<string> A SAT oracle to use
'
)
print
(
'
Available values: glucose3, minisat (default = g3)
'
)
print
(
'
-t, --train Train a model of a given dataset
'
)
print
(
'
--testsplit=<float> Training and test sets split
'
)
print
(
'
Available values: [0.0, 1.0] (default = 0.2)
'
)
print
(
'
-v, --verbose Increase verbosity level
'
)
print
(
'
-x, --explain=<string> Explain a decision for a given comma-separated sample (default: none)
'
)
print
(
'
-X, --xtype=<string> Type of explanation to compute: abductive or contrastive
'
)
This diff is collapsed.
Click to expand it.
utils.py
+
0
−
4
View file @
a0b2d351
...
@@ -10,10 +10,6 @@ from pages.application.RandomForest.utils import xrf
...
@@ -10,10 +10,6 @@ from pages.application.RandomForest.utils import xrf
from
pages.application.RandomForest.utils.xrf
import
*
from
pages.application.RandomForest.utils.xrf
import
*
sys
.
modules
[
'
xrf
'
]
=
xrf
sys
.
modules
[
'
xrf
'
]
=
xrf
from
pages.application.RandomForest.utils
import
options
sys
.
modules
[
'
options
'
]
=
options
def
parse_contents_graph
(
contents
,
filename
):
def
parse_contents_graph
(
contents
,
filename
):
content_type
,
content_string
=
contents
.
split
(
'
,
'
)
content_type
,
content_string
=
contents
.
split
(
'
,
'
)
decoded
=
base64
.
b64decode
(
content_string
)
decoded
=
base64
.
b64decode
(
content_string
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment