-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from JannisHoch/dev
v0.0.2
- Loading branch information
Showing
14 changed files
with
3,188 additions
and
751 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,8 +128,5 @@ dmypy.json | |
# Pyre type checker | ||
.pyre/ | ||
|
||
# run settings | ||
*/run_setting.cfg | ||
|
||
#output folders | ||
OUT*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,8 @@ | |
from . import utils | ||
from . import get_boolean_conflict | ||
from . import get_var_from_nc | ||
from . import machine_learning | ||
|
||
__author__ = """Jannis M. Hoch""" | ||
__email__ = '[email protected]' | ||
__version__ = '0.0.2b3' | ||
__version__ = '0.0.2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import os | ||
from sklearn import svm, neighbors, preprocessing | ||
|
||
def define_scaling(config): | ||
"""[summary] | ||
Args: | ||
config ([type]): [description] | ||
Raises: | ||
ValueError: [description] | ||
Returns: | ||
[type]: [description] | ||
""" | ||
|
||
if config.getboolean('general', 'sensitivity_analysis'): | ||
scalers = [preprocessing.MinMaxScaler(), | ||
preprocessing.StandardScaler(), | ||
preprocessing.RobustScaler(), | ||
preprocessing.QuantileTransformer(random_state=42)] | ||
|
||
elif not config.getboolean('general', 'sensitivity_analysis'): | ||
if config.get('machine_learning', 'scaler') == 'MinMaxScaler': | ||
scalers = [preprocessing.MinMaxScaler()] | ||
elif config.get('machine_learning', 'scaler') == 'StandardScaler': | ||
scalers = [preprocessing.StandardScaler()] | ||
elif config.get('machine_learning', 'scaler') == 'RobustScaler': | ||
scalers = [preprocessing.RobustScaler()] | ||
elif config.get('machine_learning', 'scaler') == 'QuantileTransformer': | ||
scalers = [preprocessing.QuantileTransformer(random_state=42)] | ||
else: | ||
raise ValueError('no supported scaling-algorithm selected - choose between MinMaxScaler, StandardScaler, RobustScaler or QuantileTransformer') | ||
|
||
print('chosen scaling method is {}'.format(scalers[0])) | ||
|
||
return scalers | ||
|
||
def define_model(config): | ||
"""[summary] | ||
Args: | ||
config ([type]): [description] | ||
Raises: | ||
ValueError: [description] | ||
Returns: | ||
[type]: [description] | ||
""" | ||
|
||
if config.getboolean('general', 'sensitivity_analysis'): | ||
clfs = [svm.NuSVC(nu=0.1, kernel='rbf', class_weight={1: 100}, random_state=42, probability=True, degree=10, gamma=10), | ||
neighbors.KNeighborsClassifier(n_neighbors=10, weights='distance')] | ||
|
||
elif not config.getboolean('general', 'sensitivity_analysis'): | ||
if config.get('machine_learning', 'model') == 'NuSVC': | ||
clfs = [svm.NuSVC(nu=0.1, kernel='rbf', class_weight={1: 100}, random_state=42, probability=True, degree=10, gamma=10)] | ||
elif config.get('machine_learning', 'model') == 'KNeighborsClassifier': | ||
clfs = [neighbors.KNeighborsClassifier(n_neighbors=10, weights='distance')] | ||
else: | ||
raise ValueError('no supported ML model selected - choose between NuSVC or KNeighborsClassifier') | ||
|
||
print('chosen ML model is {}'.format(clfs[0])) | ||
|
||
return clfs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ dependencies: | |
- netcdf4 | ||
- ConfigParser | ||
- click | ||
- seaborn | ||
- pip | ||
- pip: | ||
- rasterstats>=0.14.0 | ||
|
Oops, something went wrong.