Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
predihood
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Duchateau Fabien
predihood
Commits
ca246281
Commit
ca246281
authored
4 years ago
by
Nelly Barret
Browse files
Options
Downloads
Patches
Plain Diff
[M] fixed remove rural IRIS
parent
8159f977
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
predihood/classes/Data.py
+2
-1
2 additions, 1 deletion
predihood/classes/Data.py
predihood/classes/Dataset.py
+4
-3
4 additions, 3 deletions
predihood/classes/Dataset.py
predihood/predict.py
+4
-4
4 additions, 4 deletions
predihood/predict.py
with
10 additions
and
8 deletions
predihood/classes/Data.py
+
2
−
1
View file @
ca246281
...
...
@@ -17,7 +17,7 @@ warnings.filterwarnings("ignore", category=RuntimeWarning)
class
Data
:
def
__init__
(
self
,
normalization
=
"
density
"
,
filtering
=
True
):
def
__init__
(
self
,
normalization
=
"
density
"
,
filtering
=
True
,
add_assessment
=
False
):
"""
Constructor of the Data class. Initialize attributes.
Args:
...
...
@@ -31,6 +31,7 @@ class Data:
self
.
indicators
=
None
self
.
normalization
=
normalization
self
.
filtering
=
filtering
self
.
add_assessment
=
add_assessment
# retrieve indicators
self
.
get_indicators
()
...
...
This diff is collapsed.
Click to expand it.
predihood/classes/Dataset.py
+
4
−
3
View file @
ca246281
...
...
@@ -13,7 +13,7 @@ class Dataset:
"""
This class represents assessed IRIS with their indicators ans EV values. There are options, such as removing outliers or rural IRIS.
"""
def
__init__
(
self
,
data
,
env
,
_type
,
selected_indicators
=
None
,
indicators_to_remove
=
None
,
train_size
=
TRAIN_SIZE
,
test_size
=
TEST_SIZE
,
outliers
=
False
):
def
__init__
(
self
,
data
,
env
,
_type
,
selected_indicators
=
None
,
indicators_to_remove
=
None
,
train_size
=
TRAIN_SIZE
,
test_size
=
TEST_SIZE
,
outliers
=
False
,
remove_rural
=
False
):
"""
Constructor of the Dataset class. Initialize attributes.
...
...
@@ -43,6 +43,7 @@ class Dataset:
else
:
self
.
env
=
"
building_type
"
self
.
train_size
,
self
.
test_size
=
check_train_test_percentages
(
train_size
,
test_size
)
self
.
outliers
=
outliers
self
.
remove_rural
=
remove_rural
def
init_all_in_one
(
self
):
"""
...
...
@@ -50,8 +51,8 @@ class Dataset:
When the type is
"
unsupervised
"
, split data into X and Y is not relevant (as there is no train/test sets).
"""
if
self
.
type
==
"
supervised
"
:
if
self
.
outliers
:
self
.
remove_
outlier
s
()
if
self
.
outliers
:
self
.
remove_outliers
()
if
self
.
remove_
rural
:
self
.
remove_rural_iri
s
()
self
.
init_X
()
self
.
init_Y
()
self
.
train_test
()
...
...
This diff is collapsed.
Click to expand it.
predihood/predict.py
+
4
−
4
View file @
ca246281
...
...
@@ -61,9 +61,9 @@ def compute_all_accuracies(data, clf, train_size, test_size, remove_outliers=Fal
results
[
env
]
=
OrderedDict
()
log
.
debug
(
"
--- %s ---
"
,
env
)
dataset
=
Dataset
(
data_not_filtered
,
env
,
selected_indicators
=
data_not_filtered
.
indicators
,
train_size
=
train_size
,
test_size
=
test_size
,
outliers
=
remove_outliers
,
_type
=
'
supervised
'
)
dataset
=
Dataset
(
data_not_filtered
,
env
,
selected_indicators
=
data_not_filtered
.
indicators
,
train_size
=
train_size
,
test_size
=
test_size
,
outliers
=
remove_outliers
,
remove_rural
=
remove_rural
,
_type
=
'
supervised
'
)
dataset
.
init_all_in_one
()
if
remove_rural
:
dataset
.
remove_rural_iris
()
#
if remove_rural: dataset.remove_rural_iris()
mean_classifier
=
0.0
algo
=
MethodPrediction
(
name
=
""
,
dataset
=
dataset
,
classifier
=
clf
)
...
...
@@ -78,9 +78,9 @@ def compute_all_accuracies(data, clf, train_size, test_size, remove_outliers=Fal
log
.
info
(
"
accuracy for %s without filtering: %f
"
,
env
,
algo
.
accuracy
)
for
top_k
,
lst
in
lists
.
items
():
dataset
=
Dataset
(
data
,
env
,
selected_indicators
=
lst
[
env
],
train_size
=
train_size
,
test_size
=
test_size
,
outliers
=
remove_outliers
,
_type
=
'
supervised
'
)
dataset
=
Dataset
(
data
,
env
,
selected_indicators
=
lst
[
env
],
train_size
=
train_size
,
test_size
=
test_size
,
outliers
=
remove_outliers
,
remove_rural
=
remove_rural
,
_type
=
'
supervised
'
)
dataset
.
init_all_in_one
()
if
remove_rural
:
dataset
.
remove_rural_iris
()
#
if remove_rural: dataset.remove_rural_iris()
algo2
=
MethodPrediction
(
name
=
''
,
dataset
=
dataset
,
classifier
=
clf
)
algo2
.
fit
()
algo2
.
compute_performance
()
...
...
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