Skip to content

Commit

Permalink
Use scikit-learn in requirements instead of deprecated sklearn (O…
Browse files Browse the repository at this point in the history
…asisLMF#1186)

* use scikit-learn in requirements

* more PEP8
  • Loading branch information
mtazzari authored Dec 20, 2022
1 parent 2ccb138 commit 413187a
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion oasislmf/computation/generate/losses.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ def run(self):
guls_fp = os.path.join(output_dir, "raw_guls.csv")
guls.to_csv(guls_fp, index=False)

#il_stream_type = 2 if self.fmpy else 1
# il_stream_type = 2 if self.fmpy else 1
ils_fp = os.path.join(output_dir, 'raw_ils.csv')

# Create IL fmpy financial structures
Expand Down
2 changes: 1 addition & 1 deletion oasislmf/lookup/builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def build_rtree(self, file_path, file_type, id_columns, nearest_neighbor_min_dis

if nearest_neighbor_min_distance > 0:
if BallTree is None:
raise OasisException(f"sklearn modules are needed for rtree with nearest_neighbor_min_distance, {OPT_INSTALL_MESSAGE}")
raise OasisException(f"scikit-learn modules are needed for rtree with nearest_neighbor_min_distance, {OPT_INSTALL_MESSAGE}")
gdf_area_peril['center'] = gdf_area_peril.centroid
base_geometry_name = gdf_area_peril.geometry.name

Expand Down
4 changes: 2 additions & 2 deletions oasislmf/pytools/fm/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
logger = logging.getLogger(__name__)


#gul_header = np.int32(1 << 24).tobytes()
# gul_header = np.int32(1 << 24).tobytes()
fm_header = np.int32(1 | 2 << 24).tobytes()


Expand Down Expand Up @@ -215,7 +215,7 @@ def load_event(event_agg, sidx_loss, event_id, nodes_array, losses, loss_indexes
output_id = output_array[node['output_ids'] + layer]
if output_id: # if output is not in xref output_id is 0
loss_index = loss_indexes[node['ba'] + layer]
#print(computes[compute_i], output_id, loss_index, losses[loss_index])
# print(computes[compute_i], output_id, loss_index, losses[loss_index])
while cursor < nb_values:
if i_index == 0:
event_agg[cursor]['event_id'], event_agg[cursor]['agg_id'] = event_id, output_id
Expand Down
2 changes: 1 addition & 1 deletion optional-package.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
shapely>=1.3.0
geopandas>=0.8.0
sklearn
scikit-learn
pyarrow>=3.0.0
rtree>=0.8.3
cookiecutter>=1.6.0
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def try_get_bin_install_kwargs(self):
OS = None

# ENV OVERRIDE TO install a localy copy of ktools
#TAR_DIR = os.path.abspath(os.getenv('KTOOLS_TAR_FILE_DIR', ''))
# TAR_DIR = os.path.abspath(os.getenv('KTOOLS_TAR_FILE_DIR', ''))

if os.getenv('KTOOLS_TAR_FILE_DIR', None):
TAR_OVERRIDE = os.path.join(os.path.abspath(os.getenv('KTOOLS_TAR_FILE_DIR')), '{}_{}.tar.gz'.format(OS, ARCH))
Expand Down
2 changes: 1 addition & 1 deletion tests/model_execution/test_bash.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def gen_chunked_bash(self, name,
)

# debug
#print(json.dumps(params, indent=4))
# print(json.dumps(params, indent=4))

fifo_tmp_dir = params['fifo_tmp_dir']
for process_id in range(num_partitions):
Expand Down
6 changes: 3 additions & 3 deletions tests/model_preparation/test_summaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ def test_single_peril__totals_correct(self, data):

# Check number of not-modelled
# WARNING: current assumption is that all cov types must be covered to be modelled
#moddeled = 0
#moddeld_loc_ids = gul_inputs[gul_inputs['status'] == 'success'].loc_id.unique()
# moddeled = 0
# moddeld_loc_ids = gul_inputs[gul_inputs['status'] == 'success'].loc_id.unique()
# for loc_id in moddeld_loc_ids:
# if len(gul_inputs[gul_inputs.loc_id == loc_id].coverage_type_id.unique()) == 4:
# moddeled+=1
#self.assertEqual(len(loc_df) - moddeled, exp_summary['total']['not-modelled']['number_of_locations'])
# self.assertEqual(len(loc_df) - moddeled, exp_summary['total']['not-modelled']['number_of_locations'])

@given(st.data())
@settings(max_examples=10, deadline=None)
Expand Down

0 comments on commit 413187a

Please sign in to comment.