Various helper functions
- class helpers.LightwoodAutocast(enabled=True)[source]¶
Equivalent to torch.cuda.amp.autocast, but checks device compute capability to activate the feature only when the GPU has tensor cores to leverage AMP.
- helpers.add_tn_num_conf_bounds(data, tss_args)[source]¶
Deprecated. Instead we now opt for the much better solution of having scores for each timestep (see all TS classes in analysis/nc)
Add confidence (and bounds if applicable) to t+n predictions, for n>1 TODO: active research question: how to guarantee 1-e coverage for t+n, n>1 For now, (conservatively) increases width by the confidence times the log of the time step (and a scaling factor).
- helpers.get_group_matches(data, combination, group_columns, copy=False)[source]¶
Given a particular group combination, return the data subset that belongs to it.
- Return type
Pandas has no way to guarantee “stability” for the type of a column, it choses to arbitrarily change it based on the values. Pandas also change the values in the columns based on the types. Lightwood relies on having
Nonevalues for a cells that represent “missing” or “corrupt”.
When we assign
Noneto a cell in a dataframe this might get turned to nan or other values, this function checks if a cell is
Noneor any other values a pd.DataFrame might convert
It also checks some extra values (like
'') that pandas never converts
Noneto (hopefully). But lightwood would still consider those values “None values”, and this will allow for more generic use later.