class modelhub.ModelHubโ€‹

(time_aggregation='%Y-%m-%d %H:%M:%S.%f', global_contexts=None)


The model hub contains collection of data models and convenience functions that you can take, combine and run on Bach data frames to quickly build highly specific model stacks for product analysis and exploration. It includes models for a wide range of typical product analytics use cases.

All models from the model hub can run on Bach DataFrames that contain data collected by the Objectiv tracker. To instantiate a DataFrame with Objectiv data use get_objectiv_dataframe(). Models from the model hub assume that at least the columns of a DataFrame instantiated with this method are available in order to run properly. These columns are:

The model hub has three main type of functions: helper functions, aggregation models and machine learning models.

  • Helper functions always return a series with the same shape and index as the DataFrame they originate from. This ensures they can be added as a column to that DataFrame. The helper functions can be accessed with the map accessor from a model hub instance.
  • Aggregation models return aggregated data in some form from the DataFrame. The aggregation models can be accessed with the agg or aggregate accessor from a model hub instance.
  • Machine learning models can be instantiated from the modelhub directly using the modelโ€™s name, i.e. : get_logistic_regression().


add_conversion_event([location_stack, ...])Label events that are used as conversions.
get_funnel_discovery()Return an instance of the modelhub.FunnelDiscovery class from the model hub.
get_logistic_regression(*args, **kwargs)Return an instance of the modelhub.LogisticRegression class from the model hub.
get_objectiv_dataframe(*[, db_url, ...])Sets data from sql table into an bach.DataFrame object.
time_agg(data[, time_aggregation])Formats the moment column in the DataFrame, returns a SeriesString.
to_metabase(data[, model_type, config])Plot data in data to Metabase.
visualize_location_stack(data[, ...])Shows the location stack as a sankey chart per element for the selected root location.


aggAccess aggregation methods from the model hub.
aggregateAccess aggregation methods from the model hub.
conversion_eventsDictionary of all events that are labeled as conversion.
mapAccess map methods from the model hub.
time_aggregationTime aggregation used for aggregation models, set when object is instantiated.