Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions bayesalpha/author_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,6 @@ def rebuild_model(self, data=None):
._data
.to_pandas()
.reset_index()
# Rename back to the expected column names.
.rename_axis(['meta_user_id',
'meta_algorithm_id',
'meta_code_id',
'perf_sharpe_ratio_is'], axis=1)
.copy())

return AuthorModelBuilder(data)
Expand Down Expand Up @@ -194,6 +189,8 @@ def fit_authors(data,
sampler_type : str
Whether to use Markov chain Monte Carlo or variational inference.
Either 'mcmc' or 'vi'. Defaults to 'mcmc'.
sampler_args : dict
Additional parameters for `pm.sample`.
save_data : bool
Whether to store the dataset in the result object.
seed : int
Expand Down Expand Up @@ -244,15 +241,9 @@ def fit_authors(data,
trace.attrs['model-type'] = AUTHOR_MODEL_TYPE

if save_data:
d = (data.set_index(['meta_user_id',
'meta_algorithm_id',
'meta_code_id'])
# Rename index names to avoid name collision.
.rename_axis(['data_meta_user_id',
'data_meta_algorithm_id',
'data_meta_code_id'], axis=0)
.squeeze())
trace['_data'] = xr.DataArray(d)
# Store the data in long format to avoid creating more dimensions
trace['_data'] = xr.DataArray(data, dims=['data_index',
'data_columns'])

return AuthorModelResult(trace)

Expand Down