Skip to content

Commit

Permalink
fix: ICP block clips to 2^62 if int casting
Browse files Browse the repository at this point in the history
  • Loading branch information
paxcema committed Oct 7, 2021
1 parent 36ecb97 commit 31232c3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lightwood/analysis/nc/calibrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,9 @@ def explain(self, row_insights: pd.DataFrame, global_insights: Dict[str, object]
# Or if they even need handling yet
pass
elif ns.target_dtype in (dtype.integer):
row_insights['prediction'] = row_insights['prediction'].clip(-pow(2, 63), pow(2, 63)).astype(int)
row_insights['upper'] = row_insights['upper'].clip(-pow(2, 63), pow(2, 63)).astype(int)
row_insights['lower'] = row_insights['lower'].clip(-pow(2, 63), pow(2, 63)).astype(int)
row_insights['prediction'] = row_insights['prediction'].clip(-pow(2, 62), pow(2, 62)).astype(int)
row_insights['upper'] = row_insights['upper'].clip(-pow(2, 62), pow(2, 62)).astype(int)
row_insights['lower'] = row_insights['lower'].clip(-pow(2, 62), pow(2, 62)).astype(int)
elif ns.target_dtype in (dtype.float, dtype.quantity):
row_insights['prediction'] = row_insights['prediction'].astype(float)
row_insights['upper'] = row_insights['upper'].astype(float)
Expand Down
2 changes: 0 additions & 2 deletions lightwood/api/json_ai.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# TODO: lookup_encoder is awkward; similar to dtype, can we make a file with encoder_lookup? People may be interested
# in seeing where these come from and it's not clear that you need to look here.
# TODO: What does `target_class_distribution` and `positive_domain` do?
# TODO: generate_json_ai is really large; can we abstract it into smaller functions to make it more readable?
# TODO: add_implicit_values unit test ensures NO changes for a fully specified file.
from typing import Dict
from lightwood.helpers.templating import call, inline_dict, align
Expand Down
2 changes: 1 addition & 1 deletion lightwood/ensemble/best_of.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self, target, mixers: List[BaseMixer], data: EncodedDs, accuracy_fu
if can_be_nan_numeric(avg_score):
avg_score = -pow(2, 63)
log.warning(f'Change the accuracy of mixer {type(mixer).__name__} to valid value: {avg_score}')

score_list.append(avg_score)

self.indexes_by_accuracy = list(reversed(np.array(score_list).argsort()))
Expand Down

0 comments on commit 31232c3

Please sign in to comment.