modlee.recommender.recommender module

Recommender for models.

class modlee.recommender.recommender.Recommender(dataloader=None, origin='https://server.modlee.ai:7070', *args, **kwargs)[source]

Bases: object

Recommender for models conditioned on datasets.

analyze(dataloader=None, *args, **kwargs)[source]

Analyze a dataloader and calculate data metafeatures.

Parameters:

dataloader – The dataloader to analyze. If not given, tries to use the class dataloader.

calculate_metafeatures(dataloader, data_metafeature_cls=<class 'modlee.data_metafeatures.DataMetafeatures'>)[source]

Calculate metafeatures.

Parameters:

dataloader – The dataloader on which to calculate metafeatures.

Returns:

The metafeatures of the data as a dictionary.

fit(dataloader=None, *args, **kwargs)

Analyze a dataloader and calculate data metafeatures.

Parameters:

dataloader – The dataloader to analyze. If not given, tries to use the class dataloader.

get_code_text()[source]

Get the code for a model as text (deprecated?).

Returns:

The model code as text.

get_input_torch()[source]

Get an input from the dataloader.

Returns:

A tuple of the inputs (tensors) and their sizes.

property model

The cached model.

train(max_epochs=1, val_dataloaders=None)[source]

Train the recommended model.

Parameters:
  • max_epochs – The maximum epochs to train for.

  • val_dataloaders – The validation dataloaders, optional.

write_file(file_contents, file_path)[source]

Helper function to write a file.

Parameters:
  • file_contents – The contents to write.

  • file_path – The path to the file.